Can mclapply work with a CompressedRleList?
For example, I have a vector of cigars (a), and the cigarToRleList returns CompressedRleList given that vector:
a = c("44M","44M","9S35M","44M","40M4S")
b = cigarToRleList(a)
If I try to run mclapply on b I get this error:
mclapply(b,function(x) class(x))
Error in as.list.default(X) :
no method for coercing this S4 class to a vector
Coercing b to a list doesn't seem to help as this list is of length 1:
mclapply(list(b),function(x) class(x))
[[1]]
[1] "CompressedRleList"
attr(,"package")
[1] "IRanges"
Any idea how to get mclapply work with the CompressedRleList structure?
This is a Bioconductor question and so should be addressed to the Bioconductor mailing list. There were issues in the past, so provide the output of sessionInfo()
; I believe with current Bioc this works; it does with
> library(GenomicRanges)
> library(parallel)
> a = c("44M","44M","9S35M","44M","40M4S")
> b = cigarToRleList(a)
> unlist(mclapply(b, class))
[1] "Rle" "Rle" "Rle" "Rle" "Rle"
> sessionInfo()
R version 3.0.2 RC (2013-09-23 r63972)
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] GenomicRanges_1.12.5 IRanges_1.18.3 BiocGenerics_0.6.0
loaded via a namespace (and not attached):
[1] stats4_3.0.2
library(GenomicRanges)
library(parallel)
> unlist(mclapply(b, class))
[1] "Rle" "Rle" "Rle" "Rle" "Rle"
> sessionInfo()
R version 3.0.2 RC (2013-09-23 r63972)
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] GenomicRanges_1.12.5 IRanges_1.18.3 BiocGenerics_0.6.0
loaded via a namespace (and not attached):
[1] stats4_3.0.2