I think largely to get around this issue, some methods were written to
handle common cases where lapplying on a GRangesList might be most
intuitive.  For example, this should work quickly on your provided example:

   elementLengths(grl)

In other situations, you can lapply over the indices or names of the
GRangesList.  However, the subsetting can lead to overhead larger than
parallelization benefits.

-Cory

On Tue, Jan 11, 2011 at 6:52 AM, Stefano Calza
<stefano.calza@med.unibs.it>wrote:

> Hi,
>
> you cannot do that. lapply, sapply, ecc. methods for GRangesLists are
> specific, not standard ones.
>
> I've been using it but afaik requires some hacking (unless you coerce the
> object to a list, which took long time for me...and didn't like).
>
> maybe someone has better suggestion
>
> Stefano
>
> On Tue, Jan 11, 2011 at 03:34:46PM +0100, arne.mueller@novartis.com wrote:
> <arne.mueller>Dear All,
> <arne.mueller>
> <arne.mueller>Has anybody experience using the multicore package with
> GRangesLists from
> <arne.mueller>the GenomicRanges package? I can't get it working ..., here's
> an example:
> <arne.mueller>
> <arne.mueller>> a = GRanges(seqnames="A", ranges=IRanges(start=1:3,
> width=5))
> <arne.mueller>> b = GRanges(seqnames="A", ranges=IRanges(start=c(10,20,30),
> width=5))
> <arne.mueller>> grl = GRangesList(a, b)
> <arne.mueller>> sapply(grl, length)
> <arne.mueller>[1] 3 3
> <arne.mueller>> mclapply(grl, length, mc.cores=2)
> <arne.mueller>[[1]]
> <arne.mueller>[1] "Error in as.list.default(X) : \n  no method for coercing
> this S4
> <arne.mueller>class to a vector\n"
> <arne.mueller>
> <arne.mueller>[[2]]
> <arne.mueller>[1] "Error in as.list.default(X) : \n  no method for coercing
> this S4
> <arne.mueller>class to a vector\n"
> <arne.mueller>
> <arne.mueller>
> <arne.mueller>> sessionInfo()
> <arne.mueller>R version 2.13.0 Under development (unstable) (2010-12-20
> r53870)
> <arne.mueller>Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
> <arne.mueller>
> <arne.mueller>locale:
> <arne.mueller>[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
> <arne.mueller>
> <arne.mueller>attached base packages:
> <arne.mueller>[1] stats     graphics  grDevices utils     datasets  methods
>   base
> <arne.mueller>
> <arne.mueller>other attached packages:
> <arne.mueller>[1] multicore_0.1-3     GenomicRanges_1.3.7 IRanges_1.9.17
> <arne.mueller>
> <arne.mueller>loaded via a namespace (and not attached):
> <arne.mueller>[1] tools_2.13.0
> <arne.mueller>
> <arne.mueller>    thanks a lot for hints ..
> <arne.mueller>
> <arne.mueller>   arne
> <arne.mueller>  [[alternative HTML version deleted]]
> <arne.mueller>
> <arne.mueller>_______________________________________________
> <arne.mueller>Bioconductor mailing list
> <arne.mueller>Bioconductor@r-project.org
> <arne.mueller>https://stat.ethz.ch/mailman/listinfo/bioconductor
> <arne.mueller>Search the archives:
> http://news.gmane.org/gmane.science.biology.informatics.conductor
>
> --
> Stefano Calza, PhD
> Researcher/Assistent Professor - Biostatistician
>
> *Sezione di Statistica Medica e Biometria
>  Dipartimento di Scienze Biomediche e Biotecnologie
>  Università degli Studi di Brescia - Italy
>  Viale Europa, 11 25123 Brescia
>
>  email: stefano.calza@med.unibs.it
>        stefano.calza@biostatistics.it
>
>  pec: stefano.calza@pec.biostatistics.it
>
>  Phone: +390303717653
>  Fax: +390303717488
>
>
> _______________________________________________
> 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]]

