[Bioc-devel] VariantAnnotation: Harmonize default readVcf params

Julian Gehring julian.gehring at embl.de
Thu Dec 4 11:47:44 CET 2014


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



More information about the Bioc-devel mailing list