broadinstitute / infercnv

Inferring CNV from Single-Cell RNA-Seq
Other
557 stars 164 forks source link

Error in mcfork() : #543

Closed jmzhang1911 closed 1 year ago

jmzhang1911 commented 1 year ago

Hello, thank you very much for developing such a useful tool. However, when I integrated multiple samples for analysis, I encountered the following problem in step 18. Is there any way to solve it? I have 250GB of memory and a 15-core CPU.

    STEP 18: Run Bayesian Network Model on HMM predicted CNVs

INFO [2023-05-20 20:48:19] Initializing new MCM InferCNV Object.
INFO [2023-05-20 20:48:19] validating infercnv_obj
INFO [2023-05-20 20:48:30] Total CNV's:  55860
INFO [2023-05-20 20:48:30] Loading BUGS Model.

Error in mcfork() :
  unable to fork, possible reason: Cannot allocate memory
Calls: <Anonymous> ... withParallel -> <Anonymous> -> lapply -> FUN -> mcfork
Execution halted
Error while shutting down parallel: unable to terminate some child processes
$ vim run_infercnv.R
 1 library(infercnv)
  2
  3 infercnv_obj <- readRDS('test.rds')
  4
  5 infercnv_obj = infercnv::run(infercnv_obj,
  6                              cutoff=0.1,
  7                              out_dir="infercnv_obj_N1_N5_SM",
  8                              cluster_by_groups=TRUE,
  9                              final_scale_limits=c(0.7,1.3),
 10                              outlier_lower_bound=0.7,
 11                              outlier_upper_bound=1.3,
 12                              output_format = "pdf",
 13                              denoise=TRUE,
 14                              HMM=TRUE,
 15                              num_threads=15)
 16
 17 saveRDS(infercnv_obj, file = 'infercnv_results/test_results.rds')

$ vim run_infercnv.pbs
 #!/bin/bash
  2 #PBS -N infercnv
  3 #PBS -l nodes=1:ppn=16
  4 #PBS -l mem=250000mb
  5 #PBS -o infercnv_output.log  # 输出日志文件路径
  6 #PBS -e infercnv_error.log  # 错误日志文件路径
  7
  8 source activate ~/miniconda3/envs/stRNA/
  9 cd "/home/results"
 10 Rscript run_infercnv.R

$ qsub run_infercnv.pbs
> sessionInfo()
R version 4.2.2 (2022-10-31)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /home/zhang/miniconda3/envs/stRNA/lib/libopenblasp-r0.3.21.so

locale:
 [1] LC_CTYPE=zh_CN.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=zh_CN.UTF-8        LC_COLLATE=zh_CN.UTF-8
 [5] LC_MONETARY=zh_CN.UTF-8    LC_MESSAGES=zh_CN.UTF-8
 [7] LC_PAPER=zh_CN.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=zh_CN.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
 [1] forcats_0.5.2      stringr_1.5.0      dplyr_1.0.10       purrr_1.0.1
 [5] readr_2.1.3        tidyr_1.3.0        tibble_3.1.8       ggplot2_3.4.0
 [9] tidyverse_1.3.2    infercnv_1.14.2    SeuratObject_4.1.3 Seurat_4.3.0

loaded via a namespace (and not attached):
  [1] utf8_1.2.2                  spatstat.explore_3.0-6
  [3] reticulate_1.25             tidyselect_1.2.0
  [5] htmlwidgets_1.6.1           grid_4.2.2
  [7] Rtsne_0.16                  munsell_0.5.0
  [9] codetools_0.2-18            ica_1.0-3
 [11] future_1.30.0               miniUI_0.1.1.1
 [13] withr_2.5.0                 argparse_2.2.2
 [15] spatstat.random_3.1-3       colorspace_2.1-0
 [17] progressr_0.13.0            Biobase_2.58.0
 [19] stats4_4.2.2                SingleCellExperiment_1.20.1
 [21] ROCR_1.0-11                 tensor_1.5
 [23] listenv_0.9.0               MatrixGenerics_1.10.0
 [25] GenomeInfoDbData_1.2.9      polyclip_1.10-4
 [27] coda_0.19-4                 parallelly_1.34.0
 [29] vctrs_0.5.2                 generics_0.1.3
 [31] TH.data_1.1-2               lambda.r_1.2.4
 [33] timechange_0.2.0            fastcluster_1.2.3
 [35] R6_2.5.1                    doParallel_1.0.17
 [37] GenomeInfoDb_1.34.9         locfit_1.5-9.7
 [39] bitops_1.0-7                spatstat.utils_3.0-1
 [41] DelayedArray_0.24.0         assertthat_0.2.1
 [43] promises_1.2.0.1            scales_1.2.1
 [45] multcomp_1.4-23             googlesheets4_1.0.1
 [47] gtable_0.3.1                globals_0.16.2
 [49] goftest_1.2-3               sandwich_3.0-2
 [51] rlang_1.0.6                 splines_4.2.2
 [53] lazyeval_0.2.2              gargle_1.2.1
 [55] rjags_4-14                  spatstat.geom_3.0-5
 [57] broom_1.0.3                 reshape2_1.4.4
 [59] abind_1.4-5                 modelr_0.1.10
 [61] backports_1.4.1             httpuv_1.6.8
 [63] tools_4.2.2                 ellipsis_0.3.2
 [65] gplots_3.1.3                RColorBrewer_1.1-3
 [67] BiocGenerics_0.44.0         phyclust_0.1-33
 [69] ggridges_0.5.4              Rcpp_1.0.10
 [71] plyr_1.8.8                  zlibbioc_1.44.0
 [73] RCurl_1.98-1.12             deldir_1.0-6
 [75] pbapply_1.7-0               cowplot_1.1.1
 [77] S4Vectors_0.36.2            zoo_1.8-11
 [79] SummarizedExperiment_1.28.0 haven_2.5.1
 [81] ggrepel_0.9.2               cluster_2.1.4
 [83] fs_1.6.0                    magrittr_2.0.3
 [85] data.table_1.14.6           futile.options_1.0.1
 [87] scattermore_0.8             reprex_2.0.2
 [89] lmtest_0.9-40               RANN_2.6.1
 [91] googledrive_2.0.0           mvtnorm_1.1-3
 [93] parallelDist_0.2.6          fitdistrplus_1.1-8
 [95] matrixStats_0.63.0          hms_1.1.2
 [97] patchwork_1.1.2             mime_0.12
 [99] xtable_1.8-4                readxl_1.4.1
[101] IRanges_2.32.0              gridExtra_2.3
[103] compiler_4.2.2              crayon_1.5.2
[105] KernSmooth_2.23-20          htmltools_0.5.4
[107] tzdb_0.3.0                  later_1.3.0
[109] libcoin_1.0-9               RcppParallel_5.1.6
[111] lubridate_1.9.1             DBI_1.1.3
[113] formatR_1.14                dbplyr_2.3.0
[115] MASS_7.3-58.2               Matrix_1.5-3
[117] cli_3.6.0                   parallel_4.2.2
[119] igraph_1.3.5                GenomicRanges_1.50.2
[121] pkgconfig_2.0.3             coin_1.4-2
[123] sp_1.6-0                    plotly_4.10.1
[125] spatstat.sparse_3.0-0       xml2_1.3.3
[127] foreach_1.5.2               XVector_0.38.0
[129] rvest_1.0.3                 digest_0.6.31
[131] sctransform_0.3.5           RcppAnnoy_0.0.20
[133] spatstat.data_3.0-0         cellranger_1.1.0
[135] leiden_0.4.3                uwot_0.1.14
[137] edgeR_3.40.2                shiny_1.7.4
[139] gtools_3.9.4                modeltools_0.2-23
[141] lifecycle_1.0.3             nlme_3.1-161
[143] jsonlite_1.8.4              futile.logger_1.4.3
[145] viridisLite_0.4.1           limma_3.54.2
[147] fansi_1.0.4                 pillar_1.8.1
[149] lattice_0.20-45             fastmap_1.1.0
[151] httr_1.4.4                  survival_3.5-0
[153] glue_1.6.2                  png_0.1-8
[155] iterators_1.0.14            stringi_1.7.12
[157] caTools_1.18.2              irlba_2.3.5.1
[159] future.apply_1.10.0         ape_5.7-1