bodkan / admixr

An R package for reproducible and automated ADMIXTOOLS analyses
https://bodkan.net/admixr
Other
28 stars 9 forks source link

Error: Not all three ind/snp/geno files present #84

Closed kawu001 closed 2 years ago

kawu001 commented 3 years ago

Hi Martin,

I tried running AdmixR in R after installing admixtools in R and as well as on ubuntu. I converted into eigenstrat using "vcf2eignestrat.py" I got the 3 files (.ind, .snp and .geno).

I created the .Renviron and I linked the path from my ubuntu (admixtools).

Finally, I tried loading the data using this command,

set data prefix

data_prefix <- "./MontisAdmixR" data_prefix

read in data

snps <- eigenstrat(data_prefix)

I got this error... "Error: Not all three ind/snp/geno files present"

Kindly check out the files and probably proffer a solution.

Thank you,

Bashir MontisAdmixR.zip

bodkan commented 3 years ago

Hi, first of all, are you sure that your path to the EIGENSTRAT trio is correct? I.e. that your prefix corresponds to the correct path to the data?

For instance, I see this:

gondolin:~ 
 $ ls ~/Downloads/MontisAdmixR
snps.geno  snps.ind  snps.snp

So the files are in ~/Downloads/MontisAdmixR.

Then I can do this in R:

> prefix <- "~/Downloads/MontisAdmixR/snps"
> data <- eigenstrat(prefix)
> data
EIGENSTRAT object
=================
components:
  ind file: /Users/martin_petr/Downloads/MontisAdmixR/snps.ind
  snp file: /Users/martin_petr/Downloads/MontisAdmixR/snps.snp
  geno file: /Users/martin_petr/Downloads/MontisAdmixR/snps.geno
> 

Based on what you wrote, my assumption is that you forgot to add the part of the path that is shared by all three files (snps) to the prefix.

I don't see any problem with the files. Or at least nothing that would prevent admixr from loading them. I don't know what vcf2eigenstrat.py is so I can't vouch for the actual contents of the files (i.e. I have not attempted to run any analysis on them).

kawu001 commented 3 years ago

I copied the files to downloads, and used this codes. I got same error: Not all three ind/snp/geno files present. I also tried using the example data, but I got another error.

snp_data <- eigenstrat(download_data()) Error in utils::download.file("https://bioinf.eva.mpg.de/admixr/snps.tar.gz", : 'wget' call had nonzero exit status

  1. Could it be that my AdmixTools path is not correct?
  2. Am I missing any additional package that I'm supposed to install?
bodkan commented 3 years ago

If the package tells you that the files are not present, this means that your path is simply not correct. This is literally what the eigenstrat() function does, as you can verify it in the code of the package. I ran the code on your data and it works. There's no magic, it simply checks for the presence of those files at your path.

Please do the following:

  1. Open your terminal, then type in ls <path to the directory where you think is your data> and paste here the entire output that you get. Are the three files there?
  2. Open R in the same terminal session. Type in
    library(admixr)
    data <- eigenstrat("here put the exact path to those files, excluding the .ind/.snp/.geno suffix")

Please paste here exactly what you typed in R, including the path.


  1. Could it be that my AdmixTools path is not correct?
  2. Am I missing any additional package that I'm supposed to install?Am I missing any additional package that I'm supposed to install?

Both of these might be true. However, this has nothing to do with the error you're getting. Let's focus on solving your issue first.

bodkan commented 3 years ago

Did you have any success?

One more piece of information that I can provide: in your initial message you write that you specified the prefix as

data_prefix <- "./MontisAdmixR"

However, given the structure of the zipped EIGENSTRAT data that you provided (which has a common prefix snps.{geno,snp,ind} it should be rather

data_prefix <- "./MontisAdmixR/snps"

?

This is, in fact, what I did in my reply.

kawu001 commented 3 years ago

Not yet! I get the directory right, however, it's still same error. My Admixtools is installed on my school's linux server, while R is installed on windows. So I think linking both AdmixTools and AdmixR is the problem. Right now, I'm trying to install ubuntu on my windows so that I can install R and AdmixTools on it.

bodkan commented 2 years ago

Closing due to inactivity. Happy to reopen again if necessary.