Can strand be set to minus in VRanges objects?
1
0
Entering edit mode
david.mas • 0
@davidmas-16362
Last seen 4.5 years ago
IRB Barcelona

Hi, I noticed that the VRanges class doesn’t allow to set the strand to minus in some cases. For example when creating an object or when changing the start/end. (examples below)

I saw this from 5 years ago that seems to suggest that a mutation in the negative strand canot be used in VRanges. Is there a reason to restrict variants to only ’*’?

suppressPackageStartupMessages(library(VariantAnnotation))

vr = VRanges(seqnames = "chr1",
             ranges = IRanges::IRanges(start = c(186716278,186716284),
                                       width = c(1)),
             ref = c("A","G"),
             alt = c("T","T"),
             strand = "-")
#> Error in GRanges(seqnames, ranges, strand = .rleRecycleVector("*", length(ranges)), : el argumento formal "strand" concuerda con múltiples argumentos especificados

We can workaround the creation of the object like this:

vr = VRanges(seqnames = "chr1",
    ranges = IRanges::IRanges(start = c(186716278,186716284),
    width = c(1)),
  ref = c("A","G"),
  alt = c("T","T"))
strand(vr) = "-"

vr
#> VRanges object with 2 ranges and 0 metadata columns:
#>       seqnames    ranges strand         ref              alt
#>          <Rle> <IRanges>  <Rle> <character> <characterOrRle>
#>   [1]     chr1 186716278      -           A                T
#>   [2]     chr1 186716284      -           G                T
#>           totalDepth       refDepth       altDepth   sampleNames
#>       <integerOrRle> <integerOrRle> <integerOrRle> <factorOrRle>
#>   [1]           <NA>           <NA>           <NA>          <NA>
#>   [2]           <NA>           <NA>           <NA>          <NA>
#>       softFilterMatrix
#>               <matrix>
#>   [1]                 
#>   [2]                 
#>   -------
#>   seqinfo: 1 sequence from an unspecified genome; no seqlengths
#>   hardFilters: NULL

However, when we try to work with it, we got the error back.

start(vr) = start(vr) - 10
#> Error in validObject(object): invalid class "VRanges" object: 'strand' must always be '+' or '*'

Created on 2020-01-13 by the reprex package (v0.3.0)

VariantAnnotation • 813 views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 1 day ago
United States

It's documented in the help page for VRanges that the strand is constrained to be positive, which seems reasonable? I mean, if there's a mutation on the negative strand, there's a corresponding mutation on the positive strand, right? And the reference is (IIRC) based on the positive strand, so the reference allele will be in reference to the positive strand, so what's the use case for saying a mutation is 'on the negative strand'? That seems like extra gymnastics would be required to say what the mutation is, for no apparent gain?

ADD COMMENT

Login before adding your answer.

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