我正在从biovizBase软件包加载内置表意文字:
data("hg19Ideogram", package = "biovizBase")
用str
检查时,实际物体是正常的:
> hg19Ideogram %>% str
Formal class 'GRanges' [package "GenomicRanges"] with 6 slots
..@ seqnames :Formal class 'Rle' [package "IRanges"] with 4 slots
.. .. ..@ values : Factor w/ 93 levels "chr1","chr1_gl000191_random",..: 1 2 3 4 5 6 7 8 9 10 ...
.. .. ..@ lengths : int [1:93] 1 1 1 1 1 1 1 1 1 1 ...
.. .. ..@ elementMetadata: NULL
.. .. ..@ metadata : list()
..@ ranges :Formal class 'IRanges' [package "IRanges"] with 6 slots
.. .. ..@ start : int [1:93] 1 1 1 1 1 1 1 1 1 1 ...
.. .. ..@ width : int [1:93] 249250621 106433 547496 243199373 198022430 191154276 590426 189789 191469 180915260 ...
.. .. ..@ NAMES : NULL
.. .. ..@ elementType : chr "integer"
.. .. ..@ elementMetadata: NULL
.. .. ..@ metadata : list()
..@ strand :Formal class 'Rle' [package "IRanges"] with 4 slots
.. .. ..@ values : Factor w/ 3 levels "+","-","*": 3
.. .. ..@ lengths : int 93
.. .. ..@ elementMetadata: NULL
.. .. ..@ metadata : list()
..@ elementMetadata:Formal class 'DataFrame' [package "IRanges"] with 6 slots
.. .. ..@ rownames : NULL
.. .. ..@ nrows : int 93
.. .. ..@ listData : Named list()
.. .. ..@ elementType : chr "ANY"
.. .. ..@ elementMetadata: NULL
.. .. ..@ metadata : list()
..@ seqinfo :Formal class 'Seqinfo' [package "GenomicRanges"] with 4 slots
.. .. ..@ seqnames : chr [1:93] "chr1" "chr1_gl000191_random" "chr1_gl000192_random" "chr2" ...
.. .. ..@ seqlengths : int [1:93] 249250621 106433 547496 243199373 198022430 191154276 590426 189789 191469 180915260 ...
.. .. ..@ is_circular: logi [1:93] NA NA NA NA NA NA ...
.. .. ..@ genome : chr [1:93] "hg19" "hg19" "hg19" "hg19" ...
..@ metadata : list()
但是打印它会导致错误:
> hg19Ideogram
GRanges object with 93 ranges and 0 metadata columns:
Error: C stack usage 7969604 is too close to the limit
打印任何子对象都不会产生任何错误(包括IRanges
(,因此似乎错误与对GRanges
的打印调用有关。
此外,尝试将其与ggbio一起使用会导致相同的错误:
> ggplot() +
+ layout_circle(hg19Ideogram)
Error: C stack usage 7969268 is too close to the limit
关于此错误还有许多其他问题:
- 错误:C 堆栈使用率太接近限制
- 错误:C 堆栈使用率24324761太接近限制
- dendrapply 错误:C 堆栈使用率太接近限制
- Erorr:C 堆栈使用率太接近 R 中的限制
这些都没有提供适合我的解决方案。
堆叠
> Cstack_info()
size current direction eval_depth
7969177 16048 1 2
版本
一个人建议更新软件来解决问题。我更新到最新版本的R,RStudio和ggbio(以及相关软件包(,但它没有改变任何东西。
> sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04 LTS
Matrix products: default
BLAS: /usr/lib/openblas-base/libblas.so.3
LAPACK: /usr/lib/libopenblasp-r0.2.18.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8
[6] LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats4 parallel stats graphics grDevices utils datasets methods base
other attached packages:
[1] GenomicRanges_1.28.4 GenomeInfoDb_1.12.2 IRanges_2.10.2 S4Vectors_0.14.3 biovizBase_1.24.0 ggbio_1.24.1
[7] BiocGenerics_0.22.0 dplyr_0.7.1 purrr_0.2.2.2 readr_1.1.1 tidyr_0.6.3 tibble_1.3.3
[13] ggplot2_2.2.1 tidyverse_1.1.1 psych_1.7.5 pacman_0.4.6
loaded via a namespace (and not attached):
[1] colorspace_1.3-2 htmlTable_1.9 XVector_0.16.0 base64enc_0.1-3
[5] dichromat_2.0-0 bit64_0.9-7 interactiveDisplayBase_1.14.0 AnnotationDbi_1.38.1
[9] lubridate_1.6.0 xml2_1.1.1 splines_3.4.1 mnormt_1.5-5
[13] knitr_1.16 Formula_1.2-1 jsonlite_1.5 Rsamtools_1.28.0
[17] broom_0.4.2 cluster_2.0.3 graph_1.54.0 shiny_1.0.3
[21] compiler_3.4.1 httr_1.2.1 backports_1.1.0 assertthat_0.2.0
[25] Matrix_1.2-3 lazyeval_0.2.0 acepack_1.4.1 htmltools_0.3.6
[29] tools_3.4.1 bindrcpp_0.2 gtable_0.2.0 glue_1.1.1
[33] GenomeInfoDbData_0.99.0 reshape2_1.4.2 Rcpp_0.12.11 Biobase_2.36.2
[37] cellranger_1.1.0 Biostrings_2.44.1 nlme_3.1-124 rtracklayer_1.36.4
[41] stringr_1.2.0 rvest_0.3.2 mime_0.5 ensembldb_2.0.3
[45] XML_3.98-1.9 AnnotationHub_2.8.2 zlibbioc_1.22.0 scales_0.4.1
[49] BSgenome_1.44.0 VariantAnnotation_1.22.3 BiocInstaller_1.26.0 hms_0.3
[53] ProtGenerics_1.8.0 SummarizedExperiment_1.6.3 RBGL_1.52.0 AnnotationFilter_1.0.0
[57] RColorBrewer_1.1-2 yaml_2.1.14 curl_2.7 memoise_1.1.0
[61] gridExtra_2.2.1 biomaRt_2.32.1 rpart_4.1-10 reshape_0.8.6
[65] latticeExtra_0.6-28 stringi_1.1.5 RSQLite_2.0 checkmate_1.8.2
[69] GenomicFeatures_1.28.4 BiocParallel_1.10.1 rlang_0.1.1 pkgconfig_2.0.1
[73] matrixStats_0.52.2 bitops_1.0-6 lattice_0.20-33 bindr_0.1
[77] GenomicAlignments_1.12.1 htmlwidgets_0.8 bit_1.1-12 GGally_1.3.1
[81] plyr_1.8.4 magrittr_1.5 R6_2.2.2 Hmisc_4.0-3
[85] DelayedArray_0.2.7 DBI_0.7 haven_1.0.0 foreign_0.8-66
[89] survival_2.41-3 RCurl_1.95-4.8 nnet_7.3-12 modelr_0.1.0
[93] OrganismDbi_1.18.0 grid_3.4.1 readxl_1.0.0 data.table_1.10.4
[97] blob_1.1.0 forcats_0.2.0 digest_0.6.12 xtable_1.8-2
[101] httpuv_1.3.5 munsell_0.4.3
ulimit
有人建议使用ulimit
。这有效,但不清楚如何从 RStudio 中完成此操作。
mint@hp ~ $ ulimit -s
8192
mint@hp ~ $ ulimit -s unlimited
mint@hp ~ $ R --slave -e 'Cstack_info()["size"]'
size
NA
这不是因为计算机没有足够的可用内存 (16GB(。
拉普装甲
有人建议使用RAppArmor从 R 内部增加限制。但是,该函数不再存在。但从极限来看,似乎没有任何问题。
> rlimit_as();
$hardlim
[1] 1.844674e+19
$softlim
[1] 1.844674e+19
来自 RStudio 内部的 ulimit
在评论中,Yuval Ben-Arie 建议尝试从 RStudio 内部进行ulimit
。我使用 RStudio 的终端和使用 R 中的system
来运行系统命令都尝试了这个。既不影响实际的 R 会话,也不会影响重新启动 R 后。
我用完了可以尝试的东西。
原来是由于一些过时的软件包。我没有注意到它们没有更新,因为 RStudio 的"更新包功能"忽略了一个没有写入权限的包(因此根本不通知您它们已经过时(。因此,事实证明这是由于一个微妙的权限问题。看到这个答案。
每个进程的堆栈内存不仅受可用内存的限制,还受操作系统的限制(默认情况下不超过几个 MiB(。
我不明白ulimit -s unlimited是否做到了。 "不清楚如何在没有 RStudio 的情况下完成此操作"是什么意思?