Problem when transforming Platypus vcf to VRanges
1
0
Entering edit mode
david.mas • 0
@davidmas-16362
Last seen 4.5 years ago
IRB Barcelona

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'
variantannotation vcf readvcf vranges • 2.0k views
ADD COMMENT
3
Entering edit mode
@michael-lawrence-3846
Last seen 3.1 years ago
United States

Thanks, Should be fixed in 1.26.1 (also in devel).

ADD COMMENT
0
Entering edit mode

Sorry but still couldn't transform the VCF

> dat = readVcf("C:/Users/dmas/Documents/R/win-library/3.5/VariantAnnotation/extdata/chr22.vcf")
> class(dat)
[1] "CollapsedVCF"
attr(,"package")
[1] "VariantAnnotation"
> as(dat,"VRanges")
Error in end(ranges)[!is.na(meta$END)] <- meta$END[!is.na(meta$END)] : 
  invalid subscript type 'S4'
> packageVersion("VariantAnnotation")
[1] ‘1.27.1’

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.

ADD REPLY
0
Entering edit mode

You need to wait for the fix to appear in 1.27.2.

ADD REPLY
0
Entering edit mode

Oh okay, thanks!

EDIT: Just got the updated version (1.27.2) from bioconductor devel, problem solved! Thanks!!

ADD REPLY

Login before adding your answer.

Traffic: 525 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