Valerie
On 12/08/14 13:32, Michael Lawrence wrote:
The reason why 'y' and 'z' are different is the same reason why
readVcfAsVRanges exists. It was meant to be a convenience so that users
could get the minimal information needed into the VCF. But maybe that
was just being too helpful, and the user ends up confused. So I agree
with Julian that we should just drop VRangesScanVcfParam and have
readVcfAsVRanges just be an alternative syntax to as(readVcf(),
"VRanges").
Michael
On Mon, Dec 8, 2014 at 10:48 AM, Valerie Obenchain
<vobencha at fredhutch.org <mailto:vobencha at fredhutch.org>> wrote:
Michael, how would you feel about dropping VRangesScanVcfParam? I'm
open to changing the defaults in ScanVcfParam; the current 'read all
fields' default is probably not the best approach.
Valerie
On 12/04/2014 02:47 AM, Julian Gehring wrote:
Hi,
Can we harmonize the default parameters for =ScanVcfParam= and
=VRangesScanVcfParam=? It even seems that we could drop
=VRangesScanVcfParam= since it is mainly a wrapper for
=ScanVcfParam=.
Currently, the defaults for importing fields from a VCF are:
ScanVcfParam: fixed = character(), info = character(), geno =
character()
VRangesScanVcfParam: fixed = "ALT", info = NA, geno = "AD"
When using
readVcfAsVRanges(vcf_path, genome_name)
with default parameters, that yields a VRanges object only the
'AD'
metadata column. If 'AD' is not present in the VCF file (which is
perfectly fine because it is not essential), it throws a warning.
My main motivation behind all of this is that I would expect
x = readVcf(vcf_path, genome_name)
y = as(x, "VRanges")
and
z = readVcfAsVRanges(vcf_path, genome_name)
to give an equal object. I added some code below to make the
case more
concrete:
library(VariantAnnotation)
vcf_path = system.file("extdata", "ex2.vcf",
package="VariantAnnotation")
## read VRanges (implicit conversion)
z = readVcfAsVRanges(vcf_path, "ncbi37")
## read VCF, convert to VRanges (explicitly)
x = readVcf(vcf_path, "ncbi37")
y = as(x, "VRanges")
## harmonize it
vr_param = VRangesScanVcfParam(fixed = character(), info =
character(), geno = character())
z2 = readVcfAsVRanges(vcf_path, "ncbi37", param = vr_param)
all.equal(unname(y), unname(z2))
Best
Julian