VariantAnnotation: Error with ScanVcfParam
1
0
Entering edit mode
Didi ▴ 10
@didi-10905
Last seen 2.7 years ago
Spain

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.

variantannotation vcf readvcf filtervcf scanvcfparam • 2.9k views
ADD COMMENT
0
Entering edit mode
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 REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

It's working. 

Thanks a lot.

 

ADD REPLY
1
Entering edit mode
@valerie-obenchain-4275
Last seen 2.9 years ago
United States

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 COMMENT
1
Entering edit mode

And it's easy to check using 

headerTabix(filename)$seqnames

 

ADD REPLY

Login before adding your answer.

Traffic: 538 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6