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
I still don't know what's the problem.
Note the capitalization. You'll need to use "Chr5" when constructing your GRanges.
It's working.
Thanks a lot.