RleList
1
1
Entering edit mode
@massimo-petretich-6303
Last seen 6.6 years ago
Dear All, I am a hard time converting a list of Rle to a RleList. The very same code was working fine with R 2.15.2 and IRanges 1.17.1. > BAM<-readAligned(dirPath=directory, pattern=paste("srtRmdup_",tag, > ".bam",sep=""), type="BAM") > lc <- BAM[ !is.na(chromosome(BAM))] > cvg <- coverage(lc, extend=eval(parse(text=paste(fragmentSize,"L", > sep="")))-width(lc)) > y<-mclapply(cvg[sapply(cvg, length)>3*window], smoothRle, > window=window, resolution=resolution, mc.cores=cores) > head(y,2) $chr1 numeric-Rle of length 197195000 with 191252 runs Lengths: 2990000 1000 ... 10000 Values : 0 35.7142857142857 ... 1068.71428571429$chr2 numeric-Rle of length 181748000 with 178193 runs Lengths: 2990000 1000 ... 11000 Values : 0 15.3809523809524 ... 1286.85714285714 > y<-RleList(y) Error in .Call2("Rle_constructor", values, lengths, check, 0L, PACKAGE = "IRanges") : integer overflow while summing elements in 'lengths' # It gives the same error if I convert an RleList to list and then back to RleList: > cvg RleList of length 35 $chr1 integer-Rle of length 197195057 with 2181706 runs Lengths: 3000467 2 27 221 ... 98 21 400 250 Values : 0 1 2 3 ... 2 1 0 1$chr2 integer-Rle of length 181748164 with 2182776 runs Lengths: 3000128 250 549 99 ... 51 9 48 54 Values : 0 1 0 1 ... 4 3 2 1 $chr3 integer-Rle of length 159599909 with 1760167 runs Lengths: 2999875 250 6 123 ... 22 136 114 136 Values : 0 1 0 1 ... 0 1 2 1$chr4 integer-Rle of length 155630246 with 1888170 runs Lengths: 3000290 250 229 250 ... 5 92 111 47 Values : 0 1 0 1 ... 2 3 2 1 $chr5 integer-Rle of length 152537402 with 1759560 runs Lengths: 2999987 250 490 196 ... 9 133 14 8 Values : 0 1 0 1 ... 4 3 2 1 ... <30 more elements> > cvgLst <- as.list(cvg) > cvg <- RleList(cvgLst) Error in .Call2("Rle_constructor", values, lengths, check, 0L, PACKAGE = "IRanges") : integer overflow while summing elements in 'lengths' # The problem isn't likely the data itself or the syntax, > cvg<-RleList(cvgLst[1:10]) > cvg RleList of length 10$chr1 integer-Rle of length 197195057 with 2181706 runs Lengths: 3000467 2 27 221 ... 98 21 400 250 Values : 0 1 2 3 ... 2 1 0 1 $chr2 integer-Rle of length 181748164 with 2182776 runs Lengths: 3000128 250 549 99 ... 51 9 48 54 Values : 0 1 0 1 ... 4 3 2 1$chr3 integer-Rle of length 159599909 with 1760167 runs Lengths: 2999875 250 6 123 ... 22 136 114 136 Values : 0 1 0 1 ... 0 1 2 1 $chr4 integer-Rle of length 155630246 with 1888170 runs Lengths: 3000290 250 229 250 ... 5 92 111 47 Values : 0 1 0 1 ... 2 3 2 1$chr5 integer-Rle of length 152537402 with 1759560 runs Lengths: 2999987 250 490 196 ... 9 133 14 8 Values : 0 1 0 1 ... 4 3 2 1 ... <5 more elements> > sessionInfo() R version 3.0.2 (2013-09-25) 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] parallel stats graphics grDevices utils datasets methods [8] base other attached packages: [1] MALDIquant_1.8 rtracklayer_1.22.0 ShortRead_1.20.0 [4] Rsamtools_1.14.2 lattice_0.20-24 Biostrings_2.30.1 [7] GenomicRanges_1.14.4 XVector_0.2.0 IRanges_1.20.6 [10] BiocGenerics_0.8.0 loaded via a namespace (and not attached): [1] Biobase_2.22.0 bitops_1.0-6 BSgenome_1.30.0 [4] grid_3.0.2 hwriter_1.3 latticeExtra_0.6-26 [7] RColorBrewer_1.0-5 RCurl_1.95-4.1 stats4_3.0.2 [10] tools_3.0.2 XML_3.98-1.1 zlibbioc_1.8.0 Perhaps I am unaware of some changes introduced in the latest version of IRanges that make this operation not possible, I hope somebody has some suggestions to give me. Thanks and best regards, Massimo
convert IRanges convert IRanges • 1.5k views
0
Entering edit mode
@michael-lawrence-3846
Last seen 10 weeks ago
United States
You need RleList(x, compress=FALSE) for cases when sum(elementLengths(x)) exceeds 2^32. The default value of that argument was changed to TRUE last release cycle. Michael On Tue, Dec 24, 2013 at 2:59 AM, Massimo Petretich <petretic@embl.de> wrote: > Dear All, > > I am a hard time converting a list of Rle to a RleList. > The very same code was working fine with R 2.15.2 and IRanges 1.17.1. > > > > BAM<-readAligned(dirPath=directory, pattern=paste("srtRmdup_",tag, >> ".bam",sep=""), type="BAM") >> > > lc <- BAM[ !is.na(chromosome(BAM))] >> > > cvg <- coverage(lc, extend=eval(parse(text=paste(fragmentSize,"L", >> sep="")))-width(lc)) >> > > y<-mclapply(cvg[sapply(cvg, length)>3*window], smoothRle, window=window, >> resolution=resolution, mc.cores=cores) >> > > head(y,2) >> > $chr1 > numeric-Rle of length 197195000 with 191252 runs > Lengths: 2990000 1000 ... 10000 > Values : 0 35.7142857142857 ... 1068.71428571429 > >$chr2 > numeric-Rle of length 181748000 with 178193 runs > Lengths: 2990000 1000 ... 11000 > Values : 0 15.3809523809524 ... 1286.85714285714 > > y<-RleList(y) >> > Error in .Call2("Rle_constructor", values, lengths, check, 0L, PACKAGE = > "IRanges") : > integer overflow while summing elements in 'lengths' > > > > # It gives the same error if I convert an RleList to list and then back to > RleList: > > > cvg >> > RleList of length 35 > $chr1 > integer-Rle of length 197195057 with 2181706 runs > Lengths: 3000467 2 27 221 ... 98 21 400 > 250 > Values : 0 1 2 3 ... 2 1 0 > 1 > >$chr2 > integer-Rle of length 181748164 with 2182776 runs > Lengths: 3000128 250 549 99 ... 51 9 48 > 54 > Values : 0 1 0 1 ... 4 3 2 > 1 > > $chr3 > integer-Rle of length 159599909 with 1760167 runs > Lengths: 2999875 250 6 123 ... 22 136 114 > 136 > Values : 0 1 0 1 ... 0 1 2 > 1 > >$chr4 > integer-Rle of length 155630246 with 1888170 runs > Lengths: 3000290 250 229 250 ... 5 92 111 > 47 > Values : 0 1 0 1 ... 2 3 2 > 1 > > $chr5 > integer-Rle of length 152537402 with 1759560 runs > Lengths: 2999987 250 490 196 ... 9 133 14 > 8 > Values : 0 1 0 1 ... 4 3 2 > 1 > ... > <30 more elements> > > > cvgLst <- as.list(cvg) >> > > cvg <- RleList(cvgLst) >> > Error in .Call2("Rle_constructor", values, lengths, check, 0L, PACKAGE = > "IRanges") : > integer overflow while summing elements in 'lengths' > > > # The problem isn't likely the data itself or the syntax, > >> cvg<-RleList(cvgLst[1:10]) >> > > cvg >> > RleList of length 10 >$chr1 > integer-Rle of length 197195057 with 2181706 runs > Lengths: 3000467 2 27 221 ... 98 21 400 > 250 > Values : 0 1 2 3 ... 2 1 0 > 1 > > $chr2 > integer-Rle of length 181748164 with 2182776 runs > Lengths: 3000128 250 549 99 ... 51 9 48 > 54 > Values : 0 1 0 1 ... 4 3 2 > 1 > >$chr3 > integer-Rle of length 159599909 with 1760167 runs > Lengths: 2999875 250 6 123 ... 22 136 114 > 136 > Values : 0 1 0 1 ... 0 1 2 > 1 > > $chr4 > integer-Rle of length 155630246 with 1888170 runs > Lengths: 3000290 250 229 250 ... 5 92 111 > 47 > Values : 0 1 0 1 ... 2 3 2 > 1 > >$chr5 > integer-Rle of length 152537402 with 1759560 runs > Lengths: 2999987 250 490 196 ... 9 133 14 > 8 > Values : 0 1 0 1 ... 4 3 2 > 1 > ... > <5 more elements> > > > sessionInfo() >> > R version 3.0.2 (2013-09-25) > 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] parallel stats graphics grDevices utils datasets methods > [8] base > > other attached packages: > [1] MALDIquant_1.8 rtracklayer_1.22.0 ShortRead_1.20.0 > [4] Rsamtools_1.14.2 lattice_0.20-24 Biostrings_2.30.1 > [7] GenomicRanges_1.14.4 XVector_0.2.0 IRanges_1.20.6 > [10] BiocGenerics_0.8.0 > > loaded via a namespace (and not attached): > [1] Biobase_2.22.0 bitops_1.0-6 BSgenome_1.30.0 > [4] grid_3.0.2 hwriter_1.3 latticeExtra_0.6-26 > [7] RColorBrewer_1.0-5 RCurl_1.95-4.1 stats4_3.0.2 > [10] tools_3.0.2 XML_3.98-1.1 zlibbioc_1.8.0 > > > > > Perhaps I am unaware of some changes introduced in the latest version of > IRanges > that make this operation not possible, > I hope somebody has some suggestions to give me. > > Thanks and best regards, > Massimo > > _______________________________________________ > Bioconductor mailing list > Bioconductor@r-project.org > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane. > science.biology.informatics.conductor > [[alternative HTML version deleted]]