Open ccruizm opened 7 months ago
Hi, I think it should work in that case.
@lucreziaPatruno can you provide some basic steps?
Hi @ccruizm, thanks for your interest in CONGAS+. In order to use only the ATAC modality you can follow the steps presented in the tutorial for building the ATAC count tibble, and then in order to create the CONGAS+ object you can use this code:
x = init(
rna = NULL,
atac = atac,
segmentation = segments,
rna_normalisation_factors = NULL,
atac_normalisation_factors = norm_atac,
atac_likelihood = 'NB',
description = '')
Next, you can follow the tutorial for fitting a model, setting the lambda
parameter of fit_congas
to 0:
fit_filt <- Rcongas:::(filt,
K = k,
lambdas = 0,
learning_rate = lr,
steps = steps,
model_parameters = hyperparams_filt,
model_selection = model,
latent_variables = "G",
CUDA = FALSE,
temperature = temperature,
same_mixing = TRUE,
threshold = 0.001)
Hope this helps, please let me know if you have further questions.
BW Lucrezia
Thanks @lucreziaPatruno for the code!
I am running into some issues:
segments_selector_congas
I get the following error:
▣ / [~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~] 100% [ETA 0s] ▶ 00:00:19
── (R)CONGAS+ hyperparameters auto-config ──────────────────────────────────────────────────────────────────────────────────────────────────────────────
── ATAC modality ──
→ Negative Binomial likelihood, estimating Gamma shape and rate
── Estimating segment factors
→ 1: chrY:10400000:57227415 theta_shape = 2.11866186334306, theta_rate = 0.0837168665702484
── (R)CONGAS+ Variational Inference ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────
── Fit with k = 1 and lambda = 0.5.
── Fit with k = 2 and lambda = 0.5.
── Fit with k = 3 and lambda = 0.5.
[easypar] 3/3 computations returned errors and will be removed.
── (R)CONGAS+ fits completed in 39ms. ──
Error in f()
:
! Argument 1 must be a data frame or a named atomic vector.
Traceback:
Then I skipped this one and ran `fit_congas` using the code you provided (`auto_config_run` did not give any error), but got an error:
✖ Warning ATAC 0-counts cells. 5795 cells have no data in any of 45 segments, top 5 with missing data are:
✖ Cell atac_T19-91014_CTCACCACATGGTAAA-1 with 5 0-segments (11%)
✖ Cell atac_T19-91014_GAACCGCCAATGACTC-1 with 5 0-segments (11%)
✖ Cell atac_T19-91014_GACCTTCCATACAACC-1 with 5 0-segments (11%)
✖ Cell atac_T19-91014_ACCATCCAGTACCCAT-1 with 4 0-segments (9%)
✖ Cell atac_T19-91014_ACCGGGTTCATCGCTC-1 with 4 0-segments (9%)
── (R)CONGAS+ Variational Inference ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────
── Fit with k = 1 and lambda = 0.
── Fit with k = 2 and lambda = 0.
── Fit with k = 3 and lambda = 0.
── Fit with k = 4 and lambda = 0.
[easypar] 4/4 computations returned errors and will be removed.
── (R)CONGAS+ fits completed in 48ms. ──
Error in pull()
:
! Can't extract columns that don't exist.
✖ Column BIC
doesn't exist.
Traceback:
<fn>
(), stop_subscript_oob(i = i,
. subscript_type = subscript_type, names = names, subscript_action = subscript_action,
. subscript_arg = subscript_arg, call = call), stop_subscript(class = "vctrs_error_subscript_oob",
. i = i, subscript_type = subscript_type, ..., call = call),
. abort(class = c(class, "vctrs_error_subscript"), i = i, ...,
. call = call)), parent = c(0L, 1L, 2L, 3L, 4L, 5L, 6L,
. 7L, 6L, 9L, 10L, 4L, 12L, 13L, 13L, 15L, 16L, 17L, 18L, 19L,
. 13L, 13L, 13L, 23L, 24L, 0L, 26L, 26L, 0L, 0L, 30L, 31L, 32L,
. 33L, 34L, 32L, 36L, 36L, 38L, 39L, 40L, 41L, 38L, 0L, 44L, 45L,
. 46L), visible = c(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
. TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
. TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
. FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
. FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE), namespace = c("IRkernel",
. NA, "IRkernel", NA, "base", "base", "base", "base", "base", "base",
. "base", "evaluate", "evaluate", "evaluate", "evaluate", "base",
. "base", "base", "base", "base", "base", "base", "evaluate", "base",
. "base", "Rcongas", "base", NA, "dplyr", "dplyr", "tidyselect",
. "tidyselect", "tidyselect", "rlang", "base", "vctrs", "vctrs",
. "vctrs", "base", "base", "base", "base", "vctrs", "vctrs", "vctrs",
. "vctrs", "rlang"), scope = c("::", NA, "local", NA, "::", "local",
. "local", "local", "local", "local", "local", "::", ":::", "local",
. "local", "::", "::", "local", "local", "local", "::", "::", ":::",
. "::", "::", ":::", "::", NA, "::", ":::", "::", ":::", ":::",
. "::", "::", "::", ":::", ":::", "::", "local", "local", "local",
. "::", "local", ":::", ":::", "::"), error_frame = c(FALSE, FALSE,
. FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
. FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
. FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
. TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
. FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE
. )), row.names = c(NA, -47L), version = 2L, class = c("rlang_trace",
. "rlib_trace", "tbl", "data.frame")), parent = NULL, i = "BIC",
. subscript_type = "character", names = c("hyperparameter_K",
. "K", "K_rna", "K_atac", "lambda"), subscript_action = NULL,
. subscript_arg = "!!enquo(var)", rlang = list(inherit = TRUE),
. call = pull(., !!model_selection), subscript_scalar = TRUE), class = c("vctrs_error_subscript_oob",
. "vctrs_error_subscript", "rlang_error", "error", "condition")))
Where should I add the missing column?
Thanks for the help!
Hi @ccruizm,
Unfortunately, it is very hard for us to debug internal errors with the reticulate interface we have right now. Can you by any chance provide a minimal reproducing example for the error? I'll try to work on it ASAP.
Regarding your question: no we don't automatically classify aneuploid vs diploid, but generally unless it is very small the diploid cluster is quite obvious.
Cheers, S
Hi @ccruizm, It's also possible that something went wrong in the reticulate setup and CONGAS+ inference doesn't start, hence why you get that error. Can you please try to load congas through reticulate like this:
library(reticulate)
cg = reticulate::import("congas")
and please let me know whether you have any issue or if you are able to load it without any error.
BW Lucrezia
Good day!
I have read the documentation in https://caravagnalab.github.io/rcongas/index.html, and it provides valuable information on how to run Rcongas on multimodal data, but it is not clear to me whether it can work only using the scATAC modality. If so, what adjustments would I need to make to run it correctly?
Also, after running the pipeline, do the results also include the classification of a cell to be either diploid or aneuploid?
Thanks in advance!