<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hi Charlotte,
<br>
<br>
the conversion looks OK to me. In genind, data are recoded as alleles counts for each [locus.allele]. So if tb109 is "-9" (=missing), then all the alleles for tb109 are 'NA'.
<br>
<br>
If you want to double check that conversion worked, it is probably best to compare your input to genind2df(x) where 'x' is your converted genind.
<br>
<br>
Best<br>
Thibaut<br>
<div><br>
<div style="font-family:Tahoma; font-size:13px">
<div class="BodyFragment"><font size="2"><span style="font-size:10pt">
<div class="PlainText"> <br>
<br>
<br>
</div>
</span></font></div>
</div>
</div>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div style="direction: ltr;" id="divRpF560923"><font face="Tahoma" color="#000000" size="2"><b>From:</b> Charlotte Hurry [charlotte.hurry@griffithuni.edu.au]<br>
<b>Sent:</b> 29 July 2015 08:51<br>
<b>To:</b> Jombart, Thibaut<br>
<b>Cc:</b> adegenet-forum@lists.r-forge.r-project.org<br>
<b>Subject:</b> Re: [adegenet-forum] Problem converting structure file to genind (length of 'dimnames' [2] not equal to array extent)<br>
</font><br>
</div>
<div></div>
<div>
<div dir="ltr">
<div>
<div>
<div>
<div>
<div>
<div>Hello again<br>
<br>
</div>
I hope you don't mind but I'd like to double check my file conversion to genind. I understand that missing values are transformed to NA but I don't understand why I have NA values at all loci for some individuals. I have read the information online regarding
Genind objects but nothing that explains the conversion of allele data to the values in the Genind object.<br>
<br>
</div>
For instance my genind object is as follows:<br>
> tab(obj[loc=1])<br>
tb109.118 tb109.120 tb109.114 tb109.116 tb109.112 tb109.122 tb109.108<br>
GM4_283 1 1 0 0 0 0 0<br>
GM336 0 0 1 1 0 0 0<br>
GM337 NA NA NA NA NA NA NA<br>
E276 2 0 0 0 0 0 0<br>
E277 1 0 0 1 0 0 0<br>
E278 0 0 2 0 0 0 0<br>
<br>
</div>
Whereas my original data file is this:<br>
tb109 tb117 tb129 tb130 tb136 tb187 tb188<br>
GM4_283 1 118 108 132 125 122 168 159<br>
GM4_283 1 120 112 138 129 122 176 168<br>
GM336 1 114 112 128 123 124 168 -9<br>
GM336 1 116 112 136 123 128 176 -9<br>
GM337 1 -9 110 126 123 126 168 159<br>
GM337 1 -9 112 126 123 126 176 174<br>
E276 2 118 108 -9 -9 122 166 165<br>
E276 2 118 112 -9 -9 122 176 190<br>
E277 2 116 108 126 119 124 168 159<br>
E277 2 118 112 138 129 128 176 174<br>
<br>
</div>
What is the mechanism that forces all values of GM336 to be NA values in the Genind, and is this correct?<br>
<br>
</div>
Thank you once again.<br>
<br>
</div>
Charlotte<br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On 29 July 2015 at 01:57, Jombart, Thibaut <span dir="ltr">
<<a href="mailto:t.jombart@imperial.ac.uk" target="_blank">t.jombart@imperial.ac.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div>
<div style="direction:ltr; font-family:Tahoma; color:#000000; font-size:10pt">Hi Charlotte,
<br>
<br>
thanks for a detailed report. <br>
<br>
STRUCTURE files are a bit of a pain because of all the possible options, so in general if you can get them in a different format (e.g. GENETIX, Fstat) it will make your life easier.<br>
<div><br>
Here, your instruction seems okay given the sample of the file, but the file itself seems wrong. STRUCTURE's doc suggests you should remove 'Ind' and 'Pop' from the first line.<br>
<a href="http://pritchardlab.stanford.edu/structure_software/release_versions/v2.3.4/structure_doc.pdf" target="_blank">http://pritchardlab.stanford.edu/structure_software/release_versions/v2.3.4/structure_doc.pdf</a><br>
<br>
It works on the sample provided.<br>
<br>
Was this file generated by STRUCTURE directly?<br>
<br>
If the STRUCTURE standards have changed, please fill in an issue and we'll adapt read.structure:<br>
<a href="https://github.com/thibautjombart/adegenet/issues" target="_blank">https://github.com/thibautjombart/adegenet/issues</a><br>
<br>
Best<br>
Thibaut <br>
<div style="font-family:Tahoma; font-size:13px">
<div><font size="2"><span style="font-size:10pt">
<div><br>
</div>
</span></font></div>
</div>
</div>
<div style="font-family:Times New Roman; color:#000000; font-size:16px">
<hr>
<div style="direction:ltr"><font face="Tahoma" color="#000000" size="2"><b>From:</b>
<a href="mailto:adegenet-forum-bounces@lists.r-forge.r-project.org" target="_blank">
adegenet-forum-bounces@lists.r-forge.r-project.org</a> [<a href="mailto:adegenet-forum-bounces@lists.r-forge.r-project.org" target="_blank">adegenet-forum-bounces@lists.r-forge.r-project.org</a>] on behalf of Charlotte Hurry [<a href="mailto:charlotte.hurry@griffithuni.edu.au" target="_blank">charlotte.hurry@griffithuni.edu.au</a>]<br>
<b>Sent:</b> 24 July 2015 05:08<br>
<b>To:</b> <a href="mailto:adegenet-forum@lists.r-forge.r-project.org" target="_blank">
adegenet-forum@lists.r-forge.r-project.org</a><br>
<b>Subject:</b> [adegenet-forum] Problem converting structure file to genind (length of 'dimnames' [2] not equal to array extent)<br>
</font><br>
</div>
<div>
<div class="h5">
<div></div>
<div>
<div dir="ltr">
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<h1><span style="font-weight:normal">Hello</span><br>
</h1>
</div>
</div>
I have been trying to convert my structure file to a genind object but I am having some issues. I am getting this error and I can't find an appropriate fix. I have looked through forum history and found a similar issue but the fix suggested didn't work for
me.<br>
<br>
</div>
my file looks like this:<br>
Ind Pop tb109 tb117 tb129 tb130 tb136 tb187 tb188<br>
GM4_283 1 118 108 132 125 122 168 159<br>
GM4_283 1 120 112 138 129 122 176 168<br>
GM336 1 114 112 128 123 124 168 0<br>
GM336 1 116 112 136 123 128 176 0<br>
GM337 1 0 110 126 123 126 168 159<br>
GM337 1 0 112 126 123 126 176 174<br>
E276 2 118 108 0 0 122 166 165<br>
E276 2 118 112 0 0 122 176 190<br>
E277 2 116 108 126 119 124 168 159<br>
E277 2 118 112 138 129 128 176 174<br>
E278 2 114 108 124 121 122 168 162<br>
E278 2 114 112 126 125 128 176 180<br>
<br>
</div>
I used the script<br>
<b>> tems<-read.structure("TBtest1.str",row.marknames=1,onerowperind=FALSE, n.ind=190, n.loc=7, col.lab=1, col.pop=2, ask=TRUE)</b><br>
<br>
</div>
Which brings up the following message, and I press RETURN: <br>
<b> Which other optional columns should be read (press 'return' when done)? 1: <br>
<br>
Converting data from a STRUCTURE .stru file to a genind object... </b><br>
<br>
Then get this error:<br>
<br>
<b>Error in `colnames<-`(`*tmp*`, value = c("Ind", "Pop", "tb109", "tb117", : <br>
length of 'dimnames' [2] not equal to array extent<br>
</b><br>
Has anybody got a fix to get my original STRUCTURE file to work as a Genind object.?<br>
<br>
</div>
As an aside, on the forum I found a work around under the title "Trouble converting to genid object", which converts a read.table document into genind which I followed and I got this error:<br>
Warning message:<br>
In .local(.Object, ...) : NAs introduced by coercion <br>
</div>
and this file:<br>
> head(as.matrix(obj1))<br>
V1 V2 V3 V4 V5 V6 V7 V8 V9<br>
001 NA NA NA NA NA NA NA NA NA<br>
002 NA 1 118 108 132 125 122 168 159<br>
003 NA 1 120 112 138 129 122 176 168<br>
004 NA 1 114 112 128 123 124 168 0<br>
005 NA 1 116 112 136 123 128 176 0<br>
006 NA 1 0 110 126 123 126 168 159<br>
<br>
</div>
So i would like a different solution to my problem if possible.<br>
</div>
Many thanks<br>
</div>
Charlotte<br>
<div>
<div>
<div>
<div>
<div><br>
<div>
<div>
<div><br>
<div>
<div>
<div>
<div>
<div dir="ltr"><span>Charlotte<br>
<br>
</span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<br>
-- <br>
<div class="gmail_signature">
<div dir="ltr"><span>Charlotte Hurry<br>
PhD Candidate<br>
Australian Rivers Institute<br>
Griffith University<br>
07 37356655<br>
<a href="http://www.griffith.edu.au/environment-planning-architecture/australian-rivers-institute/hdr-students/charlotte-hurry" target="_blank">http://www.griffith.edu.au/environment-planning-architecture/australian-rivers-institute/hdr-students/charlotte-hurry</a></span></div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>