[BioC] multicore and GRangesList

Steve Lianoglou mailinglist.honeypot at gmail.com
Tue Jan 11 16:48:33 CET 2011


Hi,

On Tue, Jan 11, 2011 at 9:34 AM,  <arne.mueller at novartis.com> wrote:
> Dear All,
>
> Has anybody experience using the multicore package with GRangesLists from
> the GenomicRanges package? I can't get it working ..., here's an example:
>
>> a = GRanges(seqnames="A", ranges=IRanges(start=1:3, width=5))
>> b = GRanges(seqnames="A", ranges=IRanges(start=c(10,20,30), width=5))
>> grl = GRangesList(a, b)
>> sapply(grl, length)
> [1] 3 3
>> mclapply(grl, length, mc.cores=2)
> [[1]]
> [1] "Error in as.list.default(X) : \n  no method for coercing this S4
> class to a vector\n"

This works with the foreach and doMC (which uses the multicore
package) combo, if you're interested:

R> library(GenomicRanges)
R> library(doMC)
R> a <- GRanges(seqnames="A", ranges=IRanges(start=1:3, width=5))
R> b <- GRanges(seqnames="A", ranges=IRanges(start=c(10,20,30), width=5))
R> grl = GRangesList(a, b)
R> registerDoMC(2)
R> foreach(g=grl, .packages='GenomicRanges') %dopar% length(g)
[[1]]
[1] 3

[[2]]
[1] 3

R> sessionInfo()
R version 2.12.1 (2010-12-16)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] doMC_1.2.1          multicore_0.1-3     foreach_1.3.0
[4] codetools_0.2-6     iterators_1.0.3     GenomicRanges_1.2.2
[7] IRanges_1.8.8

-steve

-- 
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact



More information about the Bioconductor mailing list