Hello,

thanks, all for your reply. The doMC  works fine for me. Nevertheless, 
there seems to be some overhead since at the beginning and the end of the 
loop. The initial R-process doesn't fork immediately and when all child 
processes are finished the parent still processes for quite some time 
before it returns the result.

    regards,

    arne




Steve Lianoglou <mailinglist.honeypot@gmail.com> 
01/11/2011 04:49 PM

To
arne.mueller@novartis.com
cc
bioconductor@stat.math.ethz.ch
Subject
Re: [BioC] multicore and GRangesList






Hi,

On Tue, Jan 11, 2011 at 9:34 AM,  <arne.mueller@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


	[[alternative HTML version deleted]]

