Question: VariantAnnotation: Error with ScanVcfParam
0
gravatar for Didi
20 months ago by
Didi10
Didi10 wrote:

Hi,

I tried to get from the VCF file the SNPs that are in chr5 between 3-6Mb using this script and I've got this error.

library(VariantAnnotation)
library(Rsamtools)
VARvcf <- readVcf("/media/Data/VAR_reads (Variants).vcf.gz")
idx <- indexTabix("/media/Data/VAR_reads (Variants).vcf.gz", "vcf")

tab <- TabixFile("/media/Data/VAR_reads (Variants).vcf.gz", idx)

param <- ScanVcfParam(which = GRanges("chr5", IRanges(3000000, 6000000)))
VARvcf_rng <- readVcf(tab, param=param)

Error: scanVcf: scanVcf: scanTabix: 'chr5' not present in tabix index
path: /media/Data/VAR_reads (Variants).vcf.gz

index: /media/Data/VAR_reads (Variants).vcf.gz.tbi

  path: /media/Data/VAR_reads (Variants).vcf.gz

Is there something wrong with the script?

Thanks a lot.

D.

ADD COMMENTlink modified 20 months ago • written 20 months ago by Didi10
Hi, 
I checked and everything seems ok.

headerTabix(tab)$seqnames
 [1] "Chr1"  "Chr2"  "Chr3"  "Chr4"  "Chr5"  "Chr6"  "Chr7"  "Chr8"  "Chr9"  "Chr10"
[11] "Chr11" "Chr12"

I still don't know what's the problem.

ADD REPLYlink modified 20 months ago • written 20 months ago by Didi10

Note the capitalization. You'll need to use "Chr5" when constructing your GRanges.

ADD REPLYlink written 20 months ago by Michael Lawrence10k

It's working. 

Thanks a lot.

 

ADD REPLYlink written 20 months ago by Didi10
Answer: VariantAnnotation: Error with ScanVcfParam
1
gravatar for Valerie Obenchain
20 months ago by
United States
Valerie Obenchain6.7k wrote:

The error says the tabix file doesn't have a chromosome named 'chr5'. Is this true? Have you checked the file to see how the chromosome names are represented? Depending on how the file was generated it might have just '5' with no 'chr' prefix or maybe there isn't any chromosome 5 data in there.

Valerie

ADD COMMENTlink written 20 months ago by Valerie Obenchain6.7k
1

And it's easy to check using 

headerTabix(filename)$seqnames

 

ADD REPLYlink written 20 months ago by Michael Lawrence10k
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 16.09
Traffic: 142 users visited in the last hour