[adegenet-forum] Importing of STRUCTURE file

Jombart, Thibaut t.jombart at imperial.ac.uk
Sun Nov 14 18:11:36 CET 2010


Dear Girma,

I forward this answer to the adegenet forum, as it is a common mistake.

The problem comes from the use of "system.file" in your command lines. This function is used for reading files installed with R or R packages, but should not be used otherwise. Just remove this instruction, and then it should work:
a <- read.structure("C:/Girma/test.str", row.marknames=1, onerowperind=FALSE, n.ind=6, n.loc=13, col.lab=1, col.pop=2, ask=TRUE)

Best regards

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: Girma Bedada [Girma.Bedada at vbsg.slu.se]
Sent: 14 November 2010 16:39
To: Jombart, Thibaut
Subject: Importing of STRUCTURE file

Dear Dr. Jombart,

We would like to use ’adegenet’ for our data, which we are going to publish soon. But I couldn’t import data set used for STRUCTURE using the approaches described in the manual and tutorial. So please can I get you help on that?

The following are my test data and the import approaches I used:

Data (saved as  “test.str” or “test.stru”)

sample pop        s1            s2            s3            s4            s5            s6            s7            s8            s9            s10         s11         s12         s13
FS01       N             01           03           05           07           12           13           22           33           45           56           66           77           88
FS01       N             01           03           05           07           12           13           22           33           45           56           66           77           88
FS10       N             01           03           05           07           11           13           22           33           44           55           67           77           88
FS10       N             01           03           05           07           11           13           22           33           44           55           67           77           88
FS11       N             01           03           05           07           11           13           22           33           44           55           67           77           88
FS11       N             01           03           05           07           11           13           22           33           44           55           67           77           88
FS12       S              01           03           05           07           11           13           22           33           44           55           67           77           88
FS12       S              01           03           05           07           11           13           22           33           44           55           67           77           88
FS14       S              01           03           05           07           11           13           22           33           44           55           66           77           88
FS14       S              01           03           05           07           11           13           22           33           44           55           66           77           88
FS17       V             01           03           05           08           11           14           23           34           44           55           67           77           88
FS17       V             01           03           05           08           11           14           23           34           44           55           67           77           88

Import syntax used:
> a<- read.structure(system.file("C:/Girma/test.str", package="adegenet"), row.marknames=1, onerowperind=FALSE, n.ind=6, n.loc=13, col.lab=1, col.pop=2, ask=TRUE)
Error in if (!toupper(.readExt(file)) %in% c("STR", "STRU")) stop("File extension .stru expected") :
  argument is of length zero

> a<- read.structure(system.file("C:/Girma/test.stru", package="adegenet"), row.marknames=1, onerowperind=FALSE, n.ind=6, n.loc=13, col.lab=1, col.pop=2, ask=TRUE)
Error in if (!toupper(.readExt(file)) %in% c("STR", "STRU")) stop("File extension .stru expected") :
  argument is of length zero

> a<- import2genind(system.file("C:/Girma/test.stru", package="adegenet"), row.marknames=1, onerowperind=FALSE, n.ind=6, n.loc=13, col.lab=1, col.pop=2, ask=TRUE)
Error in if (ext == "GTX") return(read.genetix(file, missing = missing,  :
  argument is of length zero

Thank you for your time and help!

With best regards,

Girma



More information about the adegenet-forum mailing list