Coercing SimpleList to CompressedList objects
1
0
Entering edit mode
@leonard-goldstein-5925
Last seen 9.3 years ago
United States
Dear all, I ran into some trouble when trying to coerce SimpleList to CompressedList objects. It is possible to coerce CompressedList to SimpleList objects via the constructor function. For example: > lc <- IntegerList(1:10, compress = TRUE) > class(lc)[1] [1] "CompressedIntegerList" > class(IntegerList(lc, compress = FALSE))[1] [1] "SimpleIntegerList" However, the converse is not supported: > ls <- IntegerList(1:10, compress = FALSE) > class(ls)[1] [1] "SimpleIntegerList" > class(IntegerList(ls, compress = TRUE))[1] [1] "SimpleIntegerList" Would it be possible to implement coercion in both directions? Many thanks for your help, Leonard > sessionInfo() R version 3.0.1 (2013-05-16) Platform: x86_64-apple-darwin10.8.0 (64-bit) locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] parallel stats graphics grDevices utils datasets methods base other attached packages: [1] IRanges_1.19.15 BiocGenerics_0.7.2 loaded via a namespace (and not attached): [1] stats4_3.0.1 tools_3.0.1 > -- Leonard Goldstein, PhD Postdoctoral Research Fellow Department of Bioinformatics & Computational Biology Genentech, Inc.
• 754 views
ADD COMMENT
0
Entering edit mode
@martin-morgan-1513
Last seen 4 months ago
United States
Hi Leonard -- On 07/03/2013 05:58 PM, Leonard Goldstein wrote: > Dear all, > > I ran into some trouble when trying to coerce SimpleList to CompressedList objects. > > It is possible to coerce CompressedList to SimpleList objects via the constructor function. For example: > >> lc <- IntegerList(1:10, compress = TRUE) >> class(lc)[1] > [1] "CompressedIntegerList" >> class(IntegerList(lc, compress = FALSE))[1] > [1] "SimpleIntegerList" > > However, the converse is not supported: > >> ls <- IntegerList(1:10, compress = FALSE) >> class(ls)[1] > [1] "SimpleIntegerList" >> class(IntegerList(ls, compress = TRUE))[1] > [1] "SimpleIntegerList" > > Would it be possible to implement coercion in both directions? Maybe Herve or Michael will offer up a proper solution. A back-door is relist(unlist(ls), ls) Martin > > Many thanks for your help, > > Leonard > > >> sessionInfo() > R version 3.0.1 (2013-05-16) > Platform: x86_64-apple-darwin10.8.0 (64-bit) > > locale: > [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 > > attached base packages: > [1] parallel stats graphics grDevices utils datasets methods base > > other attached packages: > [1] IRanges_1.19.15 BiocGenerics_0.7.2 > > loaded via a namespace (and not attached): > [1] stats4_3.0.1 tools_3.0.1 >> > > -- > Leonard Goldstein, PhD > Postdoctoral Research Fellow > Department of Bioinformatics & Computational Biology > Genentech, Inc. > > _______________________________________________ > 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 > -- Computational Biology / Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109 Location: Arnold Building M1 B861 Phone: (206) 667-2793
ADD COMMENT
0
Entering edit mode
On Fri, Jul 5, 2013 at 5:23 PM, Martin Morgan <mtmorgan@fhcrc.org> wrote: > Hi Leonard -- > > > On 07/03/2013 05:58 PM, Leonard Goldstein wrote: > >> Dear all, >> >> I ran into some trouble when trying to coerce SimpleList to >> CompressedList objects. >> >> It is possible to coerce CompressedList to SimpleList objects via the >> constructor function. For example: >> >> lc <- IntegerList(1:10, compress = TRUE) >>> class(lc)[1] >>> >> [1] "CompressedIntegerList" >> >>> class(IntegerList(lc, compress = FALSE))[1] >>> >> [1] "SimpleIntegerList" >> >> However, the converse is not supported: >> >> ls <- IntegerList(1:10, compress = FALSE) >>> class(ls)[1] >>> >> [1] "SimpleIntegerList" >> >>> class(IntegerList(ls, compress = TRUE))[1] >>> >> [1] "SimpleIntegerList" >> >> Would it be possible to implement coercion in both directions? >> > > Maybe Herve or Michael will offer up a proper solution. A back-door is > > relist(unlist(ls), ls) > > I already gave him that and was hoping someone else could fix it.. ;) But I admit it's my fault, and just checked in a fix. Martin > > > >> Many thanks for your help, >> >> Leonard >> >> >> sessionInfo() >>> >> R version 3.0.1 (2013-05-16) >> Platform: x86_64-apple-darwin10.8.0 (64-bit) >> >> locale: >> [1] en_US.UTF-8/en_US.UTF-8/en_US.**UTF-8/C/en_US.UTF-8/en_US.UTF-**8 >> >> attached base packages: >> [1] parallel stats graphics grDevices utils datasets methods >> base >> >> other attached packages: >> [1] IRanges_1.19.15 BiocGenerics_0.7.2 >> >> loaded via a namespace (and not attached): >> [1] stats4_3.0.1 tools_3.0.1 >> >>> >>> >> -- >> Leonard Goldstein, PhD >> Postdoctoral Research Fellow >> Department of Bioinformatics & Computational Biology >> Genentech, Inc. >> >> ______________________________**_________________ >> Bioconductor mailing list >> Bioconductor@r-project.org >> https://stat.ethz.ch/mailman/**listinfo/bioconductor<https: stat.e="" thz.ch="" mailman="" listinfo="" bioconductor=""> >> Search the archives: http://news.gmane.org/gmane.** >> science.biology.informatics.**conductor<http: news.gmane.org="" gmane="" .science.biology.informatics.conductor=""> >> >> > > -- > Computational Biology / Fred Hutchinson Cancer Research Center > 1100 Fairview Ave. N. > PO Box 19024 Seattle, WA 98109 > > Location: Arnold Building M1 B861 > Phone: (206) 667-2793 > > > ______________________________**_________________ > Bioconductor mailing list > Bioconductor@r-project.org > https://stat.ethz.ch/mailman/**listinfo/bioconductor<https: stat.et="" hz.ch="" mailman="" listinfo="" bioconductor=""> > Search the archives: http://news.gmane.org/gmane.** > science.biology.informatics.**conductor<http: news.gmane.org="" gmane.="" science.biology.informatics.conductor=""> > [[alternative HTML version deleted]]
ADD REPLY

Login before adding your answer.

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