[Bioc-devel] strand<- method for 'GPos' doesn't work

Hervé Pagès hpages at fredhutch.org
Thu Jul 20 11:23:53 CEST 2017


Hi Robert,

This should work in GenomicRanges 1.29.10.

Note that working on this revealed some minor shortcomings
of the GPos internal representation so I decided to change it.
The new one relies on IPos, a new class in IRanges 2.11.10.
IPos is analog to GPos but for "integer positions" instead of
"genomic positions". See ?IPos for the details.

The new GPos objects behave exactly like the old ones except
for 2 things:
   - the strand() setter now works
   - ranges() now returns an IPos instead of an IRanges
     object

Update any old GPos object 'x' with

   x <- updateObject(x, verbose=TRUE)

Let me know if you run into any issue with this.

Cheers,
H.


On 07/18/2017 03:00 PM, Robert Castelo wrote:
> great, thanks Hervé!
>
> robert.
>
> On 18/07/2017 20:57, Hervé Pagès wrote:
>> Hi Robert,
>>
>> I'm working on this.
>>
>> Best,
>> H.
>>
>> On 07/14/2017 02:31 AM, Robert Castelo wrote:
>>> hi,
>>>
>>> the strand replacement method for 'GPos' objects does not seem to work:
>>>
>>> library(GenomicRanges)
>>> example(GPos)
>>> strand(gpos1) <- "-"
>>> Error in methods::slot(object, name) :
>>>    no slot of name "call" for this object of class "GPos"
>>> traceback()
>>> 10: methods::slot(object, name)
>>> 9: getElement(x, "call")
>>> 8: getCall.default(object)
>>> 7: getCall(object)
>>> 6: update.default(x, strand = value, check = FALSE)
>>> 5: update(x, strand = value, check = FALSE)
>>> 4: update(x, strand = value, check = FALSE)
>>> 3: .local(x, ..., value)
>>> 2: `strand<-`(`*tmp*`, value = "-")
>>> 1: `strand<-`(`*tmp*`, value = "-")
>>>
>>> this kind of operation works perfectly on 'GRanges' objects, so i guess
>>> it should also work also with 'GPos' objects:
>>>
>>> example(GRanges)
>>> gr1
>>> GRanges object with 1 range and 0 metadata columns:
>>>        seqnames    ranges strand
>>>           <Rle> <IRanges>  <Rle>
>>>    [1]     chr2 [56, 125]      *
>>>    -------
>>>    seqinfo: 1 sequence from an unspecified genome; no seqlength
>>> strand(gr1) <- "-"
>>> gr1
>>> GRanges object with 1 range and 0 metadata columns:
>>>        seqnames    ranges strand
>>>           <Rle> <IRanges>  <Rle>
>>>    [1]     chr2 [56, 125]      -
>>>    -------
>>>    seqinfo: 1 sequence from an unspecified genome; no seqlengths
>>>
>>>
>>> below my session info. thanks!
>>>
>>> robert.
>>> ps: sessionInfo()
>>> sessionInfo()
>>> R version 3.4.0 (2017-04-21)
>>> Platform: x86_64-pc-linux-gnu (64-bit)
>>> Running under: CentOS Linux 7 (Core)
>>>
>>> Matrix products: default
>>> BLAS: /opt/R/R-3.4.0/lib64/R/lib/libRblas.so
>>> LAPACK: /opt/R/R-3.4.0/lib64/R/lib/libRlapack.so
>>>
>>> locale:
>>>   [1] LC_CTYPE=en_US.UTF8       LC_NUMERIC=C
>>>   [3] LC_TIME=en_US.UTF8        LC_COLLATE=en_US.UTF8
>>>   [5] LC_MONETARY=en_US.UTF8    LC_MESSAGES=en_US.UTF8
>>>   [7] LC_PAPER=en_US.UTF8       LC_NAME=C
>>>   [9] LC_ADDRESS=C              LC_TELEPHONE=C
>>> [11] LC_MEASUREMENT=en_US.UTF8 LC_IDENTIFICATION=C
>>>
>>> attached base packages:
>>> [1] parallel  stats4    stats     graphics  grDevices utils datasets
>>> [8] methods   base
>>>
>>> other attached packages:
>>> [1] GenomicRanges_1.28.3 GenomeInfoDb_1.12.2  IRanges_2.10.2
>>> [4] S4Vectors_0.14.3     BiocGenerics_0.22.0  colorout_1.1-2
>>>
>>> loaded via a namespace (and not attached):
>>> [1] zlibbioc_1.22.0         compiler_3.4.0          tools_3.4.0
>>> [4] XVector_0.16.0          GenomeInfoDbData_0.99.0 RCurl_1.95-4.8
>>> [7] bitops_1.0-6
>>>
>>> _______________________________________________
>>> Bioc-devel at r-project.org mailing list
>>> https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_bioc-2Ddevel&d=DwICAg&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=bDabOgHqmutD8tE7VRQOn6ItcvsQOsLTpqQK4P7TwSo&s=WX_xk1if47kTfxxMZBFJwJtSReb1iLnoFpyPE9M-Diw&e=
>>>
>>>
>>
>

-- 
Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpages at fredhutch.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319



More information about the Bioc-devel mailing list