broadinstitute / infercnv

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

Step 18 - *** caught segfault *** #476

Open bk2272 opened 1 year ago

bk2272 commented 1 year ago

Hello,

Thank you for providing this package. I am running: R version 4.1.1 (2021-08-10) Platform: x86_64-pc-linux-gnu (64-bit) infercnv 1.13.1

I have about 80k cells that I am running through the package now ... aside from node stack errors when trying to plot_cnv (which I intend to deal with afterwards), I am running into this error at step 18 (see below). I appreciate your help!

    STEP 18: Run Bayesian Network Model on HMM predicted CNVs

INFO [2022-11-05 16:34:54] Creating the following Directory:  output_dir_221104/BayesNetOutput.HMMi6.leiden.hmm_mode-subclusters
INFO [2022-11-05 16:34:54] Initializing new MCM InferCNV Object.
INFO [2022-11-05 16:34:54] validating infercnv_obj
INFO [2022-11-05 16:35:33] Total CNV's:  330987
INFO [2022-11-05 16:35:33] Loading BUGS Model.
INFO [2022-11-05 22:22:25] Running Sampling Using Parallel with  16 Cores

 *** caught segfault ***
address (nil), cause 'unknown'

Traceback:
 1: rjags::jags.model(modelFile(MCMC_inferCNV_obj), data = data,     inits = inits, n.chains = ifelse(getArgs(MCMC_inferCNV_obj)$HMM_type ==         "i3", 3, 6), n.adapt = 500, quiet = getArgs(MCMC_inferCNV_obj)$quietly)
 2: run_gibb_sampling(gene_exp, obj)
 3: FUN(X[[i]], ...)
 4: lapply(X = S, FUN = FUN, ...)
 5: doTryCatch(return(expr), name, parentenv, handler)
 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
 7: tryCatchList(expr, classes, parentenv, handlers)
 8: tryCatch(expr, error = function(e) {    call <- conditionCall(e)    if (!is.null(call)) {        if (identical(call[[1L]], quote(doTryCatch)))             call <- sys.call(-4L)        dcall <- deparse(call)[1L]        prefix <- paste("Error in", dcall, ": ")        LONG <- 75L        sm <- strsplit(conditionMessage(e), "\n")[[1L]]        w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")        if (is.na(w))             w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],                 type = "b")        if (w > LONG)             prefix <- paste0(prefix, "\n  ")    }    else prefix <- "Error : "    msg <- paste0(prefix, conditionMessage(e), "\n")    .Internal(seterrmessage(msg[1L]))    if (!silent && isTRUE(getOption("show.error.messages"))) {        cat(msg, file = outFile)        .Internal(printDeferredWarnings())    }    invisible(structure(msg, class = "try-error", condition = e))})
 9: try(lapply(X = S, FUN = FUN, ...), silent = TRUE)
10: sendMaster(try(lapply(X = S, FUN = FUN, ...), silent = TRUE))
11: FUN(X[[i]], ...)
12: lapply(seq_len(cores), inner.do)
13: parallel::mclapply(seq_along(obj@cell_gene), FUN = par_func,     mc.cores = mc.cores)
14: withParallel(obj)
15: withParallel(obj)
16: runMCMC(MCMC_inferCNV_obj, diagnostics)
17: runMCMC(MCMC_inferCNV_obj, diagnostics)
18: infercnv::inferCNVBayesNet(infercnv_obj = infercnv_obj, HMM_states = hmm.infercnv_obj@expr.data,     file_dir = out_dir, no_plot = no_plot, postMcmcMethod = "removeCNV",     out_dir = file.path(out_dir, sprintf("BayesNetOutput.%s",         hmm_resume_file_token)), resume_file_token = hmm_resume_file_token,     quietly = TRUE, CORES = num_threads, plotingProbs = plot_probabilities,     diagnostics = diagnostics, HMM_type = HMM_type, k_obs_groups = k_obs_groups,     cluster_by_groups = cluster_by_groups, reassignCNVs = reassignCNVs)
19: infercnv::run(infercnv_obj, cutoff = 0.1, out_dir = "output_dir_221104",     cluster_by_groups = F, denoise = T, HMM = T, HMM_type = "i6",     tumor_subcluster_partition_method = "leiden", analysis_mode = "subclusters",     num_threads = 16, output_format = "pdf", no_plot = TRUE)
An irrecoverable exception occurred. R is aborting now ...
GeorgescuC commented 1 year ago

Hi @bk2272 ,

The segfault appears to occur while running rjags/JAGS, which is not really possible to debug from R. Looking at the rest of the log, I however notice an extremely high amount of CNVs identified which might lead to memory issues with JAGS Total CNV's: 330987. CNVs should generally be predicted per cluster/group of cells, so having more CNVs than cells is usually not expected. What are the options you are using?

Regards, Christophe.

archana433 commented 8 months ago

Hi, I am also getting same error. I have 49866 cells. I am using HPC to run infercnv. module load rjags/4 module load JAGS/4.3.1

infercnv_obj_new = infercnv::run(infercnv_obj, cutoff=0.1, # cutoff=1 works well for Smart-seq2, and cutoff=0.1 works well for 10x Genomics out_dir="/infercnv", cluster_by_groups=TRUE, denoise=TRUE, tumor_subcluster_pval=0.05, HMM=TRUE,num_threads = 24,leiden_resolution=0.01,BayesMaxPNormal=0.2, output_format=NA, no_plot = T)

Thank you!

NFO [2024-01-24 20:49:58] Creating the following Directory: /infercnv/BayesNetOutput.HMMi6.leiden.hmm_mode-subclusters INFO [2024-01-24 20:49:58] Initializing new MCM InferCNV Object. INFO [2024-01-24 20:49:58] validating infercnv_obj INFO [2024-01-24 20:50:03] Total CNV's: 43422 INFO [2024-01-24 20:50:03] Loading BUGS Model. INFO [2024-01-24 20:58:57] Running Sampling Using Parallel with 24 Cores

caught bus error address 0x2b0f695150d0, cause 'non-existent physical address'

caught segfault

caught segfault

caught segfault

caught segfault address (nil), cause 'unknown'

caught segfault

caught bus error address (nil), cause 'unknown' address (nil), cause 'unknown' address (nil), cause 'unknown'

caught segfault address (nil), cause 'unknown' address 0x2b0f6949882c, cause 'non-existent physical address' address (nil), cause 'unknown'

caught bus error address 0x2b0b9fe47296, cause 'non-existent physical address'

caught bus error address 0x2b0f694fa550, cause 'non-existent physical address'

Traceback: 1: selectChildren(ac[!fin], -1) 2: parallel::mclapply(seq_along(obj@cell_gene), FUN = par_func, mc.cores = mc.cores) 3: withParallel(obj) 4: withParallel(obj) 5: runMCMC(MCMC_inferCNV_obj, diagnostics) 6: runMCMC(MCMC_inferCNV_obj, diagnostics) 7: infercnv::inferCNVBayesNet(infercnv_obj = infercnv_obj, HMM_states = hmm.infercnv_obj@expr.data, file_dir = out_dir, no_plot = no_plot, postMcmcMethod = "removeCNV", out_dir = file.path(out_dir, sprintf("BayesNetOutput.%s", hmm_resume_file_token)), resume_file_token = hmm_resume_file_token, quietly = TRUE, CORES = num_threads, plotingProbs = plot_probabilities, diagnostics = diagnostics, HMM_type = HMM_type, k_obs_groups = k_obs_groups, cluster_by_groups = cluster_by_groups, reassignCNVs = reassignCNVs) 8: infercnv::run(infercnv_obj, cutoff = 0.1, out_dir = "/infercnv", cluster_by_groups = TRUE, denoise = TRUE, tumor_subcluster_pval = 0.05, HMM = TRUE, num_threads = 24, leiden_resolution = 0.01, BayesMaxPNormal = 0.2, output_format = NA, no_plot = T)

Possible actions: 1: abort (with core dump, if enabled) 2: normal R exit 3: exit R without saving workspace 4: exit R saving workspace

Traceback:

Traceback:

Traceback: 1: 1: 1: update.jags(model, n.iter, ...)update.jags(model, n.iter, ...) update.jags(model, n.iter, ...) 2:

2: jags.samples(model, variable.names, n.iter, thin, type = "trace", jags.samples(model, variable.names, n.iter, thin, type = "trace", 2: ...)jags.samples(model, variable.names, n.iter, thin, type = "trace", ...) ...)

3: 3: 3: rjags::coda.samples(model, parameters, n.iter = 1000, progress.bar = ifelse(getArgs(MCMC_inferCNV_obj)$quietly, rjags::coda.samples(model, parameters, n.iter = 1000, progress.bar = ifelse(getArgs(MCMC_inferCNV_obj)$quietly, "none", "text")) "none", "text")) rjags::coda.samples(model, parameters, n.iter = 1000, progress.bar = ifelse(getArgs(MCMC_inferCNV_obj)$quietly, 4: 4: run_gibb_sampling(gene_exp, obj)run_gibb_sampling(gene_exp, obj) 5: "none", "text"))

FUN(X[[i]], ...) 5: 4: FUN(X[[i]], ...)

6: 6: lapply(X = S, FUN = FUN, ...)lapply(X = S, FUN = FUN, ...)

run_gibb_sampling(gene_exp, obj) 7: 7: doTryCatch(return(expr), name, parentenv, handler)doTryCatch(return(expr), name, parentenv, handler)