[adegenet-forum] unable to import a diploid dataset using read.strucutre

Jombart, Thibaut t.jombart at imperial.ac.uk
Mon Jan 6 15:29:03 CET 2014


Hello, 

this file looks wrong to me:

Individual labels (1 column) + population indication (1 column) + 14 markers (2 columns each = 28 columns) = 30 columns in total.

The best thing to do probably is to re-export your data using a different format (e.g. GENETIX, .gtx format), or manually merge the columns of the same markers together and use read.table and df2genind.

Cheers
Thibaut

________________________________________
From: adegenet-forum-bounces at lists.r-forge.r-project.org [adegenet-forum-bounces at lists.r-forge.r-project.org] on behalf of sun-ye at scib.ac.cn [sun-ye at scib.ac.cn]
Sent: 01 January 2014 01:57
To: adegenet-forum at lists.r-forge.r-project.org
Subject: Re: [adegenet-forum] unable to import a diploid dataset using read.strucutre

Dear Thibaut
         The file (31 columns) is a Structure format file obtained from Genalex.   I try to read. structure by

obj <- read.structure(system.file("files/14loci.stru",package="adegenet"),n.ind=104,n.loc=14,onerowperind=TRUE,col.lab=1,col.pop=2,col.others=3,row.marknames=1,NA.char="-9")

         and always got an error:
Converting data from a STRUCTURE .stru file to a genind object...
df2genind(X = X, pop = pop, missing = missing, ploidy = 2) :
2 alleles cannot be coded by a total of 3 characters

         If I remove the third column (pop flag), and read.structure by

obj <- read.structure(system.file("files/14loci.stru",package="adegenet"),n.ind=104,n.loc=14,onerowperind=TRUE,col.lab=1,col.pop=2,row.marknames=1,NA.char="-9")

        The data cannot be imported and will be asked

       Which other optional columns should be read (press 'return' when done)?

       Can you help fix this?  Thank you!

       Ye


> -----原始邮件-----
> 发件人: "Jombart, Thibaut" <t.jombart at imperial.ac.uk<mailto:t.jombart at imperial.ac.uk>>
> 发送时间: 2013年12月30日 星期一
> 收件人: "sun-ye at scib.ac.cn<mailto:sun-ye at scib.ac.cn>" <sun-ye at scib.ac.cn<mailto:sun-ye at scib.ac.cn>>, "adegenet-forum at lists.r-forge.r-project.org<mailto:adegenet-forum at lists.r-forge.r-project.org>" <adegenet-forum at lists.r-forge.r-project.org<mailto:adegenet-forum at lists.r-forge.r-project.org>>
> 抄送:
> 主题: RE: [adegenet-forum] unable to import a diploid dataset using read.strucutre
>
> Hello,
>
> the file seems to contain one column to many.
> > x <- read.table("temp/14loci.stru",skip=1)
> > head(x)
>      V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13 V14 V15 V16 V17 V18 V19 V20 V21
> 1 QCS10  1  0  2  2 -9 -9 -9 -9  -9  -9   2   2   2   2   1   1  -9  -9   1   2
> 2 QCS13  1  0  2  2 -9 -9  2  2  -9  -9  -9  -9   2   2  -9  -9   1   1   2   2
> 3 QCS16  1  0  2  2 -9 -9 -9 -9   1   1   2   2   2   2  -9  -9   1   1   2   2
> 4 QCS19  1  0 -9 -9  2  8  2  2   1   1   2   2   2   2   1   1   1   1   2   2
> 5 QCS22  1  0 -9 -9  2  2  2  2   1   1   2   2  -9  -9  -9  -9   1   1   2   2
> 6  QCS4  1  0  2  2  1  1  2  2  -9  -9   2   2   1   2   1   1  -9  -9  -9  -9
>   V22 V23 V24 V25 V26 V27 V28 V29 V30 V31
> 1   1   2   1   1   1   1   1   1   1   1
> 2   1   1   1   3   3   3   1   1   1   1
> 3   1   1   1   1   1   3   1   1   1   1
> 4  -9  -9   1   1  -9  -9   1   1   1   1
> 5   1   1   3   3   1   3   1   1   1   1
> 6   1   1   1   3   3   3   1   1   1   1
> >
>
> Here, there should be 30 columns and not 31.
>
> Cheers
> Thibaut
>
>
> ________________________________________
> From: adegenet-forum-bounces at lists.r-forge.r-project.org<mailto:adegenet-forum-bounces at lists.r-forge.r-project.org> [adegenet-forum-bounces at lists.r-forge.r-project.org<mailto:adegenet-forum-bounces at lists.r-forge.r-project.org>] on behalf of sun-ye at scib.ac.cn<mailto:sun-ye at scib.ac.cn> [sun-ye at scib.ac.cn<mailto:sun-ye at scib.ac.cn>]
> Sent: 30 December 2013 03:09
> To: adegenet-forum at lists.r-forge.r-project.org<mailto:adegenet-forum at lists.r-forge.r-project.org>
> Subject: [adegenet-forum] unable to import a diploid dataset using      read.strucutre
>
> Dear
>
>       I am unable to import a diploid dataset using read.strucutre.  I always got an error:
>
> Converting data from a STRUCTURE .stru file to a genind object...
> df2genind(X = X, pop = pop, missing = missing, ploidy = 2) :
>   2 alleles cannot be coded by a total of 3 characters
>
> I paste data (104 individual, 14 loci), Can you help fix this?
> RADid_0000113 RADid_0000114 RADid_0000250 RADid_0000388 RADid_0000798 RADid_0001205 RADid_0001522 RADid_0001584 RADid_0001771 RADid_0002962 RADid_0003463 RADid_0003558 RADid_0004239 RADid_0004366
> QCS10 1 0 2 2 -9 -9 -9 -9 -9 -9 2 2 2 2 1 1 -9 -9 1 2 1 2 1 1 1 1 1 1 1 1
> QCS13 1 0 2 2 -9 -9 2 2 -9 -9 -9 -9 2 2 -9 -9 1 1 2 2 1 1 1 3 3 3 1 1 1 1
> QCS16 1 0 2 2 -9 -9 -9 -9 1 1 2 2 2 2 -9 -9 1 1 2 2 1 1 1 1 1 3 1 1 1 1
> QCS19 1 0 -9 -9 2 8 2 2 1 1 2 2 2 2 1 1 1 1 2 2 -9 -9 1 1 -9 -9 1 1 1 1
> QCS22 1 0 -9 -9 2 2 2 2 1 1 2 2 -9 -9 -9 -9 1 1 2 2 1 1 3 3 1 3 1 1 1 1
> QCS4 1 0 2 2 1 1 2 2 -9 -9 2 2 1 2 1 1 -9 -9 -9 -9 1 1 1 3 3 3 1 1 1 1
> QCS7 1 0 2 2 2 2 2 2 1 1 2 2 -9 -9 1 1 1 1 2 2 1 1 1 1 2 3 1 1 1 1
> QCSI 1 0 1 1 -9 -9 2 2 1 1 2 2 2 2 1 1 -9 -9 2 2 1 1 3 3 3 3 1 9 -9 -9
> EM13 2 0 2 2 -9 -9 2 11 -9 -9 2 2 2 2 1 1 1 1 2 2 1 1 1 1 1 3 1 1 1 1
> EM16 2 0 1 1 2 2 -9 -9 1 1 2 2 2 2 1 1 1 1 1 2 1 1 1 1 1 1 1 1 -9 -9
> EM19 2 0 -9 -9 2 2 2 6 1 1 2 2 2 2 -9 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S28 13 0 1 1 2 2 2 2 1 10 3 3 1 1 2 2 1 1 1 1 3 3 2 2 3 3 1 2 1 1
> GS2 13 0 1 1 -9 -9 -9 -9 1 1 2 3 1 1 2 2 1 4 1 1 3 3 2 2 3 3 3 3 -9 -9
> GS3 13 0 1 1 -9 -9 -9 -9 1 1 2 3 1 1 1 2 -9 -9 1 1 3 3 -9 -9 3 3 -9 -9 1 4
> GS9 13 0 1 1 2 2 2 2 1 1 2 2 1 1 2 2 4 4 1 1 3 3 2 2 1 3 1 2 1 1
>
>
>       Thank you,
>
>       Ye
>
>
>
>



--
Dr. Ye SUN
Key Laboratory of Plant Resources Conservation and Sustainable Utilization
South China Botanical Garden, Chinese Academy of Sciences
Xingke Road 723,Tianhe District, Guangzhou 510650, PR China






--
Dr. Ye SUN
Key Laboratory of Plant Resources Conservation and Sustainable Utilization
South China Botanical Garden, Chinese Academy of Sciences
Xingke Road 723,Tianhe District, Guangzhou 510650, PR China





More information about the adegenet-forum mailing list