[BioC] subsetting IntegerList by list names

Hervé Pagès hpages at fhcrc.org
Fri Nov 18 01:29:56 CET 2011


Hi Manuela,

Well, thanks for uncovering that one! Looks like this bug has been
around for a while and I wonder how it could have been sitting and
hiding in the dark for so long...

Anyway, I've just applied a fix to IRanges in release (1.12.2)
and devel (1.13.7). I also extended the unit tests so this will never
ever happen again ;-)

The new versions of IRanges should become available in the next 24-36
hours via biocLite().

Thanks again and please be sure to let us know if you find other
problems.

Cheers,
H.


On 11-11-16 03:47 AM, Manuela Hummel wrote:
> Hi,
>
> I realized that subsetting an IntegerList object (and probably other IRanges list objects) by the list names plus replacing list element values behaves unexpectedly (at least for me) when the list is not sorted by its element's names.
>
> Here a short example:
>
>> IL<- IntegerList(chr2=5, chr1=10)
>
>> IL
> CompressedIntegerList of length 2
> [["chr2"]] 5
> [["chr1"]] 10
>
> Now I want to subset based on the list names:
>
>> chrs<- c("chr1", "chr2")
>
>> IL[chrs]
> CompressedIntegerList of length 2
> [["chr1"]] 10
> [["chr2"]] 5
>
> This gives me the elements in the expected order.
>
> However, if I now want to replace the values of both elements, using the subsetting as before, the order of the list and the new element values is "mixed":
>
>> IL[chrs]<- list(100, 50)
>
>> IL
> CompressedNumericList of length 2
> [["chr2"]] 100
> [["chr1"]] 50
>
> I would have expected the value 100 for element "chr1" and 50 for element "chr2".
>
> In this way at least it works with usual lists:
>
>> L<- list(chr2=5, chr1=10)
>> L
> $chr2
> [1] 5
>
> $chr1
> [1] 10
>
>> L[chrs]<- list(100, 50)
>> L
> $chr2
> [1] 50
>
> $chr1
> [1] 100
>
>
> Thanks a lot for your comments
> Manuela
>
>
>
>> sessionInfo()
>
> R version 2.14.0 (2011-10-31)
> Platform: i386-pc-mingw32/i386 (32-bit)
>
> locale:
> [1] LC_COLLATE=Spanish_Spain.1252  LC_CTYPE=Spanish_Spain.1252
> [3] LC_MONETARY=Spanish_Spain.1252 LC_NUMERIC=C
> [5] LC_TIME=Spanish_Spain.1252
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] IRanges_1.12.1
>
> loaded via a namespace (and not attached):
> [1] tools_2.14.0
>
>
>
>
> Manuela Hummel
> Core Facilities - Microarrays Unit
> Center for Genomic Regulation (CRG)
> Dr. Aiguader 88, 4th floor, Office 439.01
> 08003 Barcelona
> Phone: +34 93 316 0373
> e-mail: manuela.hummel at crg.eu
>
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor


-- 
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 fhcrc.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319



More information about the Bioconductor mailing list