I got vcf files from Platypus variant caller. When I try to import them into R and the VariantAnnotation format VRanges
I get the error message:
test = readVcf(path)
as(object = test,Class = "VRanges")
Error in end(ranges)[!is.na(meta$END)] <- meta$END[!is.na(meta$END)] :
invalid subscript type 'S4'
When I run the code of the as
method line by line I see that in my case the END field in the meta variable is a <IntegerList>
meanwhile in the example vcf file of the package (chr22.vcf.gz
) is a <integer>
.
By comparing the example file and my vcf file I can see that the END INFO field specification is different. Instead of Number=1
it says Number=.
.
I am not an expert in VCF field specification but I know they can be a mess. So this might not be a VariantAnnotation
issue but the variant caller issue.
Anyway, What should I do to be able to import those vcf files into R? I would like to avoid modifying the raw vcf files.
How to reproduce it?
Get the example chr22.vcf.gz
file in the package. (use fl = system.file("extdata", "chr22.vcf.gz", package="VariantAnnotation")
to locate where it is). Uncompress and modify the line:
##INFO=<ID=END,Number=1,Type=Integer,Description="End position of the variant described in this record">
to this
##INFO=<ID=END,Number=.,Type=Integer,Description="End position of the variant described in this record">
Then run the code:
> from = readVcf("path/to/R/win-library/3.5/VariantAnnotation/extdata/chr22.vcf") #this is the modified file
> as(object = from,Class = "VRanges")
Error in end(ranges)[!is.na(meta$END)] <- meta$END[!is.na(meta$END)] :
invalid subscript type 'S4'
Sorry but still couldn't transform the VCF
It's the first time I try with a devel version of bioconductor and I had a hard time with the dependencies in my windows intallation so maybe I did something wrong when updating.
EDIT: Note that the
chr22.vcf
file is modifid to reproduce my issue.You need to wait for the fix to appear in 1.27.2.
Oh okay, thanks!
EDIT: Just got the updated version (1.27.2) from bioconductor devel, problem solved! Thanks!!