This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Popgenome R package

Hello,

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.

GENOME.class<-readHapMap("popgenome/test_631.hmp",populations=FALSE,outgroup=FALSE,gffpath="test_631.gff")

Error in readHapMap("popgenome/test_631.hmp", populations = FALSE, outgroup = FALSE, : unused argument (gffpath = "test_631.gff")

Do I need to use to tabix index file for hapmap and gff file?

Thanks, yp

snp popgenome hapmap

2 answers

I checked the documentation and there is no gffpath argument. Instead use hap_gffpath

Here is the docs for PopGenome if it helps: PopGenome

Thanks for your reply.

I changed it to hap_gffpath, but it didn't work.

GENOME.class <- readHapMap("popgenome/",hap_gffpath="popgenome/",populations=FALSE,outgroup=FALSE)

Error in if (file == "") file <- stdin() else { : missing value where TRUE/FALSE needed

Could you please share an example hapmap file and codes?

Thanks, yp

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

here <- find.package("PopGenome")
setwd(paste0(here, "/data")))
# You are now set to the directory containing PopGenome test data
list.files()

Thanks!

I tried two ways to load files into the Popgenome. But none of them is working for me.

  1. VCF - I created VCF and GFF files for each chromosome and stored in a separate folder.

GENOME.class <- readData("chr_vcf/", format="VCF", gffpath="gff/chr_gff/",FAST = FALSE,include.unknown = TRUE)

It is aborting the R session.

  1. Hapmap file format

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

Log in to answer this question.