Question: Popgenome R package
0
gravatar for yp
12 months ago by
yp0
yp0 wrote:

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 • 720 views
ADD COMMENTlink modified 12 months ago • written 12 months ago by yp0
0
gravatar for goodez
12 months ago by
goodez460
United States
goodez460 wrote:

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

Here is the docs for PopGenome if it helps: PopGenome

ADD COMMENTlink modified 12 months ago • written 12 months ago by goodez460
0
gravatar for yp
12 months ago by
yp0
yp0 wrote:

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

ADD COMMENTlink written 12 months ago by yp0

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/")

ADD REPLYlink written 12 months ago by goodez460

it is printing 0.

list.files("popgenome/") character(0)

ADD REPLYlink written 12 months ago by yp0

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".

ADD REPLYlink written 12 months ago by goodez460

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

ADD REPLYlink written 12 months ago by yp0

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.

ADD REPLYlink modified 12 months ago • written 12 months ago by goodez460

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()
ADD REPLYlink written 12 months ago by goodez460

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

ADD REPLYlink written 12 months ago by yp0
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1016 users visited in the last hour