[adegenet-forum] adegenet not recognizing file extensions

Jombart, Thibaut t.jombart at imperial.ac.uk
Tue Sep 29 21:10:42 CEST 2015


Hi again,

I think a quadruple check is in order ;)

The extension of the file you sent is wrong. It is a .str.tsv file (?) while the correct extension should read .str. Seeing your command line, I suspect windows is hiding extensions by default on your computer, and so you are assuming there is a file called

C:/Users/Ella Bowles/Desktop/batch_1_8c9.str

where there is none - your file must be, in fact

C:/Users/Ella Bowles/Desktop/batch_1_8c9.str.tsv


After correcting the extension it all works for me:


> library(adegenet)
Loading required package: ade4
   /// adegenet 2.0.1 is loaded ////////////

   > overview: '?adegenet'
   > tutorials/doc/questions: 'adegenetWeb()'
   > bug reports/feature resquests: adegenetIssues()


> x=read.structure("batch_1_8c9.str",  n.ind = 186, n.loc = 4099, onerowperind = FALSE, col.lab = 1, col.pop = 2, col.others = NULL, row.marknames = 2, NA.char = "0", ask = TRUE)

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

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

> x
/// GENIND OBJECT /////////

 // 186 individuals; 4,099 loci; 8,198 alleles; size: 7.7 Mb

 // Basic content
   @tab:  186 x 8198 matrix of allele counts
   @loc.n.all: number of alleles per locus (range: 2-2)
   @loc.fac: locus factor for the 8198 columns of @tab
   @all.names: list of allele names for each locus
   @ploidy: ploidy of each individual  (range: 2-2)
   @type:  codom
   @call: read.structure(file = "batch_1_8c9.str", n.ind = 186, n.loc = 4099,
    onerowperind = FALSE, col.lab = 1, col.pop = 2, col.others = NULL,
    row.marknames = 2, NA.char = "0", ask = TRUE)

 // Optional content
   @pop: population of each individual (group size range: 12-20)


And yes, in case you wonder, window$ is an evil system and probably hates all of us.

Cheers
Thibaut


________________________________
From: bowlese at gmail.com [bowlese at gmail.com] on behalf of Ella Bowles [ebowles at ucalgary.ca]
Sent: 29 September 2015 18:01
To: Jombart, Thibaut
Subject: Re: [adegenet-forum] adegenet not recognizing file extensions

Hi Thibaut,

I checked, double and triple checked, and it is correct. Can you read it in?

I don't think this should be an issue, but the only thing that seems potentially amiss is that after I use the read.structure line R always asks for which other optional columns should be read. I just press enter here, so no other columns are read. Just seems weird that I would be getting a warning that looks like it should be for a filepath. Also, I'm running R v 3.2.2.

Will be good to know if you can read in the file.

Cheers

Thanks

On Tue, Sep 29, 2015 at 4:01 AM, Jombart, Thibaut <t.jombart at imperial.ac.uk<mailto:t.jombart at imperial.ac.uk>> wrote:
Hi Ella,

It looks like the path to your file is incorrect  - can you double-check?

Cheers
Thibaut

________________________________
From: bowlese at gmail.com<mailto:bowlese at gmail.com> [bowlese at gmail.com<mailto:bowlese at gmail.com>] on behalf of Ella Bowles [ebowles at ucalgary.ca<mailto:ebowles at ucalgary.ca>]
Sent: 28 September 2015 18:56
To: Jombart, Thibaut
Subject: Re: [adegenet-forum] adegenet not recognizing file extensions

Hi Thibaut,

I'm now using the line (all in one line)
data <- read.structure("C:/Users/Ella Bowles/Desktop/batch_1_8c9.str", n.ind = 186, n.loc = 4099, onerowperind = FALSE, col.lab = 1, col.pop = 2, col.others = NULL, row.marknames = 2, NA.char = "0", ask = TRUE)

for the attached dataset

and I'm still getting the error
Which other optional columns should be read (press 'return' when done)? 1:

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

Error in file(file, "r") : cannot open the connection
In addition: Warning message:
In file(file, "r") :
  cannot open file 'C:/Users/Ella Bowles/Desktop/batch_1_8c9.str': No such file or directory

Can you see what may be wrong?

​Thank you for your time,
Ella​


On Fri, Sep 25, 2015 at 7:16 PM, Ella Bowles <ebowles at ucalgary.ca<mailto:ebowles at ucalgary.ca>> wrote:
Hi Thibaut,

I'm now using the line (all in one line)
data <- read.structure("C:/Users/Ella Bowles/Desktop/batch_1_8c9.str", n.ind = 186, n.loc = 4099, onerowperind = FALSE, col.lab = 1, col.pop = 2, col.others = NULL, row.marknames = 2, NA.char = "0", ask = TRUE)

for the attached dataset

and I'm still getting the error
Which other optional columns should be read (press 'return' when done)? 1:

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

Error in file(file, "r") : cannot open the connection
In addition: Warning message:
In file(file, "r") :
  cannot open file 'C:/Users/Ella Bowles/Desktop/batch_1_8c9.str': No such file or directory

Can you see what may be wrong?

With thanks,
Ella


On Fri, Sep 25, 2015 at 11:54 AM, Ella Bowles <ebowles at ucalgary.ca<mailto:ebowles at ucalgary.ca>> wrote:
thank you!

On Fri, Sep 25, 2015 at 9:10 AM, Jombart, Thibaut <t.jombart at imperial.ac.uk<mailto:t.jombart at imperial.ac.uk>> wrote:
Hi there,

please check the forum archives, this has been answered several times. I think I even mention it in the tutorial. You need to remove 'system.file' and just indicate the path to your file.

Cheers
Thibaut


==============================
Dr Thibaut Jombart
MRC Centre for Outbreak Analysis and Modelling
Department of Infectious Disease Epidemiology
Imperial College - School of Public Health
Norfolk Place, London W2 1PG, UK
Tel. : 0044 (0)20 7594 3658
http://sites.google.com/site/thibautjombart/
http://sites.google.com/site/therepiproject/
http://adegenet.r-forge.r-project.org/
Twitter: @thibautjombart


________________________________
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 Ella Bowles [ebowles at ucalgary.ca<mailto:ebowles at ucalgary.ca>]
Sent: 24 September 2015 20:07
To: adegenet-forum at lists.r-forge.r-project.org<mailto:adegenet-forum at lists.r-forge.r-project.org>
Subject: [adegenet-forum] adegenet not recognizing file extensions

Hello,

I'm trying to read files into adegenet and convert to genind objects, but am getting an error. After I have correctly specified/set the directory that the files are in I have used the line

data <- read.genetix(system.file("8c9.gtx", package = "adegenet"))

for many different permutations of filetype. These include read.genepop for genepop files, read.structure for structure filies. I keep getting the error

 Converting data from GENETIX to a genind object...
Error in if (toupper(.readExt(file)) != "GTX") stop("File extension .gtx expected") :
  argument is of length zero

The thing that I can see as the possible issue is that my files originally had different extensions (from the populations program of stacks). They were previously ".genepop" and ".strucuture", and I changed them manually to the ".gen" and ".stru" suffixes. Can you see a way around this?

With thanks,
Ella

--
Ella Bowles
PhD Candidate
Biological Sciences
University of Calgary

e-mail: ebowles at ucalgary.ca<mailto:ebowles at ucalgary.ca>, bowlese at gmail.com<mailto:bowlese at gmail.com>
website: http://ellabowlesphd.wordpress.com/



--
Ella Bowles
PhD Candidate
Biological Sciences
University of Calgary

e-mail: ebowles at ucalgary.ca<mailto:ebowles at ucalgary.ca>, bowlese at gmail.com<mailto:bowlese at gmail.com>
website: http://ellabowlesphd.wordpress.com/



--
Ella Bowles
PhD Candidate
Biological Sciences
University of Calgary

e-mail: ebowles at ucalgary.ca<mailto:ebowles at ucalgary.ca>, bowlese at gmail.com<mailto:bowlese at gmail.com>
website: http://ellabowlesphd.wordpress.com/



--
Ella Bowles
PhD Candidate
Biological Sciences
University of Calgary

e-mail: ebowles at ucalgary.ca<mailto:ebowles at ucalgary.ca>, bowlese at gmail.com<mailto:bowlese at gmail.com>
website: http://ellabowlesphd.wordpress.com/

_______________________________________________
adegenet-forum mailing list
adegenet-forum at lists.r-forge.r-project.org<mailto:adegenet-forum at lists.r-forge.r-project.org>
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum



--
Ella Bowles
PhD Candidate
Biological Sciences
University of Calgary

e-mail: ebowles at ucalgary.ca<mailto:ebowles at ucalgary.ca>, bowlese at gmail.com<mailto:bowlese at gmail.com>
website: http://ellabowlesphd.wordpress.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20150929/4a780f61/attachment-0001.html>


More information about the adegenet-forum mailing list