[adegenet-forum] problems importing structure data

Jombart, Thibaut t.jombart at imperial.ac.uk
Tue Jun 14 18:44:54 CEST 2011


Dear John,

Sorry for this problem. The issue comes from the fact that read.structure has been designed for diploid data. I never came across structure files such as your until now, I should probably add a word about this in the doc. What do the numbers in your file represent? I assume they identify alleles.

A simple workaround is reading the file in R using read.table and then converting into a genind the dataframe using df2genind:
####
dat <- read.table("test_data.stru", head=FALSE,row.names=1)
dat
x <- df2genind(dat, ploidy=1) # conversion to genind
x
truenames(x) # see internal coding
genind2df(x) # check that conversion is OK
####

All the best

Thibaut

--
######################################
Dr Thibaut JOMBART
MRC Centre for Outbreak Analysis and Modelling
Department of Infectious Disease Epidemiology
Imperial College - Faculty of Medicine
St Mary’s Campus
Norfolk Place
London W2 1PG
United Kingdom
Tel. : 0044 (0)20 7594 3658
t.jombart at imperial.ac.uk
http://sites.google.com/site/thibautjombart/
http://adegenet.r-forge.r-project.org/
________________________________
From: adegenet-forum-bounces at r-forge.wu-wien.ac.at [adegenet-forum-bounces at r-forge.wu-wien.ac.at] on behalf of Gibbons, John G. [john.g.gibbons at Vanderbilt.Edu]
Sent: 14 June 2011 17:31
To: 'adegenet-forum at lists.r-forge.r-project.org'
Subject: [adegenet-forum] problems importing structure data

Hello,
I have been having some problems loading my structure data to a geneid object using the “read.structure” command. I’ve read through the forum archive and tried everything but am still getting the same error.

Here is the example of my test dataset:

Afum001 3 4 1 2 1 1 3 1 3 1
Afum002 1 3 2 1 1 2 1 1 2 2
Afum003 2 3 1 2 1 1 2 2 2 2
Afum004 1 3 1 2 1 2 1 2 2 2
Afum005 1 1 1 1 1 1 1 2 1 2
Afum006 1 3 2 1 1 1 2 2 1 2
Afum007 1 1 1 2 2 1 1 2 2 2
Afum008 2 1 1 2 2 1 1 1 2 2
Afum009 1 1 1 2 1 1 4 2 2 2
Afum011 1 3 1 1 1 2 4 2 2 1

I then issue the following command:

a <- read.structure("test_data.stru", row.marknames=0, onerowperind=TRUE, n.ind=10, n.loc=10, col.lab=1, col.pop=0, ask=TRUE)

I then get the following promt

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

When I press return here (as I do not have any other optional columns to be read) I get the following error:

Converting data from a STRUCTURE .stru file to a genind object...

Error in read.structure("test_data.stru ",  :
                                only 0's may be mixed with negative subscripts

I have been struggling with this for a few days now and cannot figure out what the problem is. Any thoughts or advice would be greatly appreciated.

Thanks,

John

----
John G Gibbons
Department of Biological Sciences
VU Station B, Box 35-1634
Vanderbilt University
Nashville TN, 37212
The Rokas Lab
Email: John.G.Gibbons at Vanderbilt.Edu<mailto:John.G.Gibbons at Vanderbilt.Edu>
Tel: (615) 936-3893
http://sitemason.vanderbilt.edu/people/jggibbons

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20110614/e513a91a/attachment.htm>


More information about the adegenet-forum mailing list