Skip to content
Prev 7637 / 21307 Next

[Bioc-devel] VRanges-class positive strandness and locateVariants() strandawareness

Michael,

regarding our email exchange three weeks ago, I found a couple of places 
in VariantAnnotation that IMO need to be updated to avoid enforcing 
strand on VRanges.

these places occur when constructing and validating VRanges objects, 
concretely at:

1. file R/methods-VRanges-class.R at the VRanges class constructor:

VRanges <-
   function(seqnames = Rle(), ranges = IRanges(),
            ref = character(), alt = NA_character_,
            totalDepth = NA_integer_, refDepth = NA_integer_,
            altDepth = NA_integer_, ..., sampleNames = NA_character_,
            softFilterMatrix = FilterMatrix(matrix(nrow = length(gr), 
ncol = 0L),
              FilterRules()),
            hardFilters = FilterRules())
{
   gr <- GRanges(seqnames, ranges,
                 strand = .rleRecycleVector("*", length(ranges)), ...)
[...]

that precludes setting the strand at construction time:

library(VariantAnnotation)
VRanges(seqnames="chr1", ranges=IRanges(1, 5), ref="T", alt="C", strand="-")
Error in GRanges(seqnames, ranges, strand = .rleRecycleVector("*", 
length(ranges)),  :
   formal argument "strand" matched by multiple actual arguments


2. R/AllClasses.R at the VRanges class validity function .valid.VRanges():

.valid.VRanges.strand <- function(object) {
   if (any(object at strand == "-"))
     paste("'strand' must always be '+' or '*'")
}

[...]

.valid.VRanges <- function(object)
{
   c(.valid.VRanges.ref(object),
     .valid.VRanges.alt(object),
     .valid.VRanges.strand(object),
     .valid.VRanges.depth(object))
}

that prompts an error when variants annotated on the negative strand are 
detected:

library(VariantAnnotation)
example(VRanges)
strand(vr) <- "-"
c(vr)
Error in validObject(.Object) :
   invalid class ?VRanges? object: 'strand' must always be '+' or '*'


cheers,

robert.
On 05/22/2015 09:49 PM, Michael Lawrence wrote: