mclapply可以使用CompressedRleList吗?

时间:2013-09-27 17:22:50

标签: r mclapply

可以mclapply使用CompressedRleList吗?

例如,我有一个雪茄矢量(a),并且cigarToRleList返回给定该矢量的CompressedRleList:

a = c("44M","44M","9S35M","44M","40M4S")
b = cigarToRleList(a)

如果我尝试在b上运行mclapply,我会收到此错误:

mclapply(b,function(x) class(x))
Error in as.list.default(X) : 
  no method for coercing this S4 class to a vector

将b强制转换为列表似乎没有帮助,因为此列表的长度为1:

mclapply(list(b),function(x) class(x))
[[1]]
[1] "CompressedRleList"
attr(,"package")
[1] "IRanges"

知道如何让mclapply使用CompressedRleList结构吗?

1 个答案:

答案 0 :(得分:2)

这是一个Bioconductor问题,因此应该发送到Bioconductor邮件列表。过去存在问题,因此提供sessionInfo()的输出;我相信目前的Bioc有效;它与

有关
> 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