I would like to use Popgenome R package to calculate diversity stats. I have a SNP data in the HapMap format. I used following R code to upload hap map file, but getting an error. The GFF file is in the same folder.
Sorry I don't work with these types of files. You can try readData("test_631.hmp", format="HapMap") to see if your file is good for importing. Also from the documentation, I think you need 2 separate folders. 1 folder (the first argument) is for input "files of different individuals for one chromosome". The 2nd folder (second argument) is for the HapMap GFF.
No problem. Next time just add a comment to my answer though, rather than a separate answer.
Can you post the results of
list.files("popgenome/")
it is printing 0.
list.files("popgenome/") character(0)
I'm assuming you have a folder somewhere called "popgenome" which contains the relevant files?
You need to use
setwd(path/to/folder/above/popgenome)
. Don't set it to "popgenome", but set it to the folder which contains "popgenome".Yes, I have a popgenome folder, which has all the relevant files. I am setting the path to one level above.
Now, I moved HapMap and gff file to a separate folder- "hapmap/". list.file command is printing the file names
list.files("hapmap/") [1] "test_631.gff" "test_631.hmp"
Then, I use following code. But still not working.
GENOME.class <- readHapMap("hapmap/",hap_gffpath="hapmap/",populations=FALSE,outgroup=FALSE)
Error in if (file == "") file <- stdin() else { : missing value where TRUE/FALSE needed
Do you have an example hapmap file?
Thanks, yp
Sorry I don't work with these types of files. You can try
readData("test_631.hmp", format="HapMap")
to see if your file is good for importing. Also from the documentation, I think you need 2 separate folders. 1 folder (the first argument) is for input "files of different individuals for one chromosome". The 2nd folder (second argument) is for the HapMap GFF.Also, you can find example data by doing this in R
Thanks!
I tried two ways to load files into the Popgenome. But none of them is working for me.
GENOME.class <- readData("chr_vcf/", format="VCF", gffpath="gff/chr_gff/",FAST = FALSE,include.unknown = TRUE)
It is aborting the R session.
GENOME.class<-readData("hapmap/", format="HapMap",populations = FALSE,outgroup = FALSE,gffpath ="gff/",include.unknown = TRUE) | : | : | 100 % | Read 321000 items
Error in CCC$matrix : $ operator is invalid for atomic vectors