Question: Problem when transforming Platypus vcf to VRanges
0
gravatar for david.mas
16 months ago by
david.mas0
IRB Barcelona
david.mas0 wrote:

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'
ADD COMMENTlink modified 16 months ago by Michael Lawrence11k • written 16 months ago by david.mas0
Answer: Problem when transforming Platypus vcf to VRanges
3
gravatar for Michael Lawrence
16 months ago by
United States
Michael Lawrence11k wrote:

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

ADD COMMENTlink written 16 months ago by Michael Lawrence11k

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 REPLYlink modified 16 months ago • written 16 months ago by david.mas0

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

ADD REPLYlink written 16 months ago by Michael Lawrence11k

Oh okay, thanks!

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

ADD REPLYlink modified 16 months ago • written 16 months ago by david.mas0
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: 213 users visited in the last hour