[Bioc-devel] S4 classes extending GRangesList

Leonard Goldstein goldstein.leonard at gene.com
Tue Sep 29 19:35:15 CEST 2015


Hi Hervé,

This still looks broken in the current bioc-devel. Just wanted to
follow up in case it got missed. Thanks again.

Leonard



On Thu, Jun 11, 2015 at 11:59 AM, Leonard Goldstein <goldstel at gene.com> wrote:
> Thanks Hervé.
>
> Best wishes,
>
> Leonard
>
>
> On Thu, Jun 11, 2015 at 10:58 AM, Hervé Pagès <hpages at fredhutch.org> wrote:
>> Hi Leonard,
>>
>> It's a bug in the "c" method for "CompressedList" object. I'll fix
>> that. Thanks for the report.
>>
>> H.
>>
>>
>> On 06/11/2015 10:48 AM, Leonard Goldstein wrote:
>>>
>>> Hi all,
>>>
>>> I noticed that when combining instances of a class that inherits from
>>> GRangesList, the result does not preserve the class (it is returned as
>>> a GRangesList instead). The class is preserved in other situations
>>> (e.g. when a class extends GRanges). See below for an example. Is
>>> there a reason why the class cannot be preserved in the first case?
>>> Thanks in advance for your help.
>>>
>>> Leonard
>>>
>>>
>>>> ## define a new class 'A' inheriting from GRanges
>>>> setClass(Class = "A", contains = "GRanges")
>>>>
>>>> ## combining two instances of class 'A' returns an object of class 'A'
>>>> gr <- GRanges("1", IRanges(1, 100))
>>>> a <- new("A", gr)
>>>> a
>>>
>>> A object with 1 range and 0 metadata columns:
>>>        seqnames    ranges strand
>>>           <Rle> <IRanges>  <Rle>
>>>    [1]        1  [1, 100]      *
>>>    -------
>>>    seqinfo: 1 sequence from an unspecified genome; no seqlengths
>>>>
>>>> c(a, a)
>>>
>>> A object with 2 ranges and 0 metadata columns:
>>>        seqnames    ranges strand
>>>           <Rle> <IRanges>  <Rle>
>>>    [1]        1  [1, 100]      *
>>>    [2]        1  [1, 100]      *
>>>    -------
>>>    seqinfo: 1 sequence from an unspecified genome; no seqlengths
>>>>
>>>>
>>>> ## define a new class 'b' inheriting from GRangesList
>>>> setClass(Class = "B", contains = "GRangesList")
>>>>
>>>> ## combining two instances of class 'B' returns a GRangesList
>>>> grl <- split(gr, 1)
>>>> b <- new("B", grl)
>>>> b
>>>
>>> B object of length 1:
>>> $1
>>> GRanges object with 1 range and 0 metadata columns:
>>>        seqnames    ranges strand
>>>           <Rle> <IRanges>  <Rle>
>>>    [1]        1  [1, 100]      *
>>>
>>> -------
>>> seqinfo: 1 sequence from an unspecified genome; no seqlengths
>>>>
>>>> c(b, b)
>>>
>>> GRangesList object of length 2:
>>> $1
>>> GRanges object with 1 range and 0 metadata columns:
>>>        seqnames    ranges strand
>>>           <Rle> <IRanges>  <Rle>
>>>    [1]        1  [1, 100]      *
>>>
>>> $1
>>> GRanges object with 1 range and 0 metadata columns:
>>>        seqnames   ranges strand
>>>    [1]        1 [1, 100]      *
>>>
>>> -------
>>> seqinfo: 1 sequence from an unspecified genome; no seqlengths
>>>>
>>>>
>>>> sessionInfo()
>>>
>>> R Under development (unstable) (2014-11-04 r66932)
>>> Platform: x86_64-unknown-linux-gnu (64-bit)
>>>
>>> locale:
>>>   [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
>>>   [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
>>>   [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
>>>   [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
>>>   [9] LC_ADDRESS=C               LC_TELEPHONE=C
>>> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>>>
>>> attached base packages:
>>> [1] stats4    parallel  stats     graphics  grDevices utils     datasets
>>> [8] methods   base
>>>
>>> other attached packages:
>>> [1] GenomicRanges_1.21.15 GenomeInfoDb_1.5.7    IRanges_2.3.11
>>> [4] S4Vectors_0.7.4       BiocGenerics_0.15.2
>>>
>>> loaded via a namespace (and not attached):
>>> [1] XVector_0.9.1
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Bioc-devel at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>>>
>>
>> --
>> 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