[Bioc-devel] Combining Ordinary List of GRanges Optimisation

Dario Strbenac D.Strbenac at garvan.org.au
Mon Jan 7 03:00:13 CET 2013


Hello,

For a not so large list of GRanges:

> length(blockRanges)
[1] 4029
> class(blockRanges)
[1] "list"

Which don't have an unreasonable number of elements in them:

> summary(sapply(blockRanges, length))
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
      1     961   20710   55210   77680  759600

Combining them takes 15 minutes:

> system.time(allRanges <- do.call(c, blockRanges))
sessionInfo()
   user  system elapsed 
935.770  23.657 961.952

> head(blockRanges[[1]])
GRanges with 6 ranges and 1 metadata column:
      seqnames         ranges strand | conservation
         <Rle>      <IRanges>  <Rle> |    <numeric>
  [1]     chr1 [10918, 10918]      * |        0.064
  [2]     chr1 [10919, 10919]      * |        0.056
  [3]     chr1 [10920, 10920]      * |        0.064
  [4]     chr1 [10921, 10921]      * |        0.056
  [5]     chr1 [10922, 10922]      * |        0.064
  [6]     chr1 [10923, 10923]      * |        0.064
  ---
  seqlengths:
   chr1
     NA

Could this code be faster ?

> sessionInfo()
R version 2.15.2 (2012-10-26)
Platform: x86_64-pc-linux-gnu (64-bit)

other attached packages:
[1] GenomicRanges_1.10.5 IRanges_1.16.4       BiocGenerics_0.4.0

--------------------------------------
Dario Strbenac
PhD Student
University of Sydney
Camperdown NSW 2050
Australia



More information about the Bioc-devel mailing list