Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plotOntologyHeatmapCollapsed function got an error #45

Closed
Angel-Wei opened this issue Apr 12, 2023 · 9 comments
Closed

plotOntologyHeatmapCollapsed function got an error #45

Angel-Wei opened this issue Apr 12, 2023 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@Angel-Wei
Copy link

Angel-Wei commented Apr 12, 2023

Hi, I ran into an error when I called cao$plotOntologyHeatmapCollapsed function. I got an error

Error in `chr_as_locations()`:
! Can't rename columns that don't exist.Column `qvalues` doesn't exist.

Before I come to this step, everything ran well and functions cao$estimateDEPerCellType and cao$estimateOntology (I used 'GSEA')also worked. Here's some output info I got from rlang::last_error():

> pdf(paste0(rep.name, '/', rep.name,"_plotOntologyHeatmapCollapsed_up_in_MUT.pdf"), height=15, width=10)
> print(cao$plotOntologyHeatmapCollapsed(
+   name="GSEA", genes="up", n=50, clust.method="ward.D", size.range=c(1, 4)) + ggtitle("Up in MUT"))
Error in (function (cond)  : 
  error in evaluating the argument 'x' in selecting a method for function 'print': Can't rename columns that don't exist.
✖ Column `qvalues` doesn't exist.
> rlang::last_error()
<error/vctrs_error_subscript_oob>
Error in `chr_as_locations()`:
! Can't rename columns that don't exist.
✖ Column `qvalues` doesn't exist.
---
Backtrace:
  1. cao$plotOntologyHeatmapCollapsed(...)
  6. dplyr:::rename.data.frame(., geneID = core_enrichment, qvalue = qvalues)
  7. tidyselect::eval_rename(expr(c(...)), .data)
  8. tidyselect:::rename_impl(...)
  9. tidyselect:::eval_select_impl(...)
 18. tidyselect:::vars_select_eval(...)
 19. tidyselect:::walk_data_tree(expr, data_mask, context_mask, error_call)
 20. tidyselect:::eval_c(expr, data_mask, context_mask)
 21. tidyselect:::reduce_sels(node, data_mask, context_mask, init = init)
 22. tidyselect:::walk_data_tree(new, data_mask, context_mask)
 23. tidyselect:::as_indices_sel_impl(...)
 24. tidyselect:::as_indices_impl(x, vars, call = call, strict = strict)
 25. tidyselect:::chr_as_locations(x, vars, call = call)
Run `rlang::last_trace()` to see the full context.

I wonder is there anything I can do to fix this problem to generate GSEA results? Thank you so much for the help in advance!

Originally posted by @Angel-Wei in #21 (comment)

@Angel-Wei Angel-Wei changed the title cao$plotOntologyHeatmapCollapsed` function got an error plotOntologyHeatmapCollapsed function got an error Apr 12, 2023
@rrydbirk
Copy link
Collaborator

Hi @Angel-Wei

Thanks for your interest in Cacoa. We're aware of this error, it should be fixed in the dev version. You can install this using devtools::install_github("kharchenkolab/cacoa", ref="dev"). If you saved your Cacoa object, you need to update it after installing, e.g., cao %<>% Cacoa$new().

Could you let me know if this solves your problem?

BR

Rasmus

@rrydbirk rrydbirk self-assigned this Apr 24, 2023
@rrydbirk rrydbirk added the bug Something isn't working label Apr 24, 2023
@Angel-Wei
Copy link
Author

Angel-Wei commented Apr 24, 2023

Hi Rasmus,

Sorry for the late reply. I actually tried to install the dev version. However, it gave me error and warning messages like this:
Cacoa1
Cacoa2

I wonder is there any way to address this issue?

@rrydbirk
Copy link
Collaborator

Hi @Angel-Wei
We've made some changes to sccore, as stated in the error message v. 1.0.3 is required. Could you do a manual install.packages("sccore") followed by cacoa dev install? That should do the trick.

BR

Rasmus

@Angel-Wei
Copy link
Author

Oh hi Rasmus! I think the install.packages("sccore") did not work in my case, which just installed the same version as I had. However, I found that the latest version can be installed via devtools:
Screenshot 2023-04-27 at 2 45 21 PM
Now my problem is solved and I can install the latest version of cacoa and plot the heatmap of GSEA. Thank you so much for the help!

@rrydbirk
Copy link
Collaborator

rrydbirk commented May 1, 2023

Hi @Angel-Wei
Thanks for the feedback, glad it worked for you!

@evanbiederstedt, am I missing something here, why is sccore v. 1.0.3 not installing per default?

/Rasmus

@Angel-Wei
Copy link
Author

Angel-Wei commented Jun 20, 2023

Hi Rasmus,

Just an update of this function error. I realized that it worked after I re-install the latest Cacoa and use
cao %<>% Cacoa$new() (R 4.2.0 and cacoa 0.4.0) on a previously saved old Cacoa object (created and saved under R 4.1.3 and cacoa 0.4.0).
However, if I re-run Cacoa pipeline using the latest version (R 4.2.0 and cacoa 0.4.0), for the new cao object, I still encountered errors like this:

Screenshot 2023-06-21 at 2 14 27 PM

> traceback()
17: stop(fallback)
16: signal_abort(cnd)
15: cnd_signal(cnd)
14: value[[3L]](cond)
13: tryCatchOne(expr, names, parentenv, handlers[[1L]])
12: tryCatchList(expr, classes, parentenv, handlers)
11: tryCatch(with_entraced_errors(expr), vctrs_error_subscript = function(cnd) {
        cnd$subscript_action <- subscript_action(type)
        cnd$subscript_elt <- "column"
        cnd_signal(cnd)
    })
10: with_subscript_errors(vars_select_eval(vars, expr, strict = strict, 
        data = x, name_spec = name_spec, uniquely_named = uniquely_named, 
        allow_rename = allow_rename, type = type, error_call = error_call), 
        type = type)
9: eval_select_impl(x, names, {
       {
           sel
       }
   }, strict = strict, name_spec = name_spec, type = "rename", error_call = error_call)
8: rename_impl(data, names(data), as_quosure(expr, env), strict = strict, 
       name_spec = name_spec, error_call = error_call)
7: tidyselect::eval_rename(expr(c(...)), .data)
6: rename.data.frame(., geneID = core_enrichment, qvalue = qvalues)
5: rename(., geneID = core_enrichment, qvalue = qvalues)
4: ont.res %<>% rename(geneID = core_enrichment, qvalue = qvalues)
3: private$getOntologyPvalueResults(name = name, genes = genes, 
       subtype = subtype, cell.subgroups = cell.subgroups, p.adj = p.adj, 
       q.value = q.value, min.genes = min.genes, readjust.p = readjust.p, 
       p.adjust.method = p.adjust.method)
2: private$getOntologyHeatmapInfo(name = name, genes = genes, subtype = subtype, 
       p.adj = p.adj, q.value = q.value, min.genes = min.genes, 
       selection = selection, cluster = cluster, cell.subgroups = cell.subgroups, 
       only.family.children = only.family.children, clust.naming = clust.naming, 
       description.regex = description.regex, description.exclude.regex = description.exclude.regex, 
       readjust.p = readjust.p, p.adjust.method = p.adjust.method)
1: cao$plotOntologyHeatmapCollapsed(name = "GSEA", genes = "up", 
       n = 50, clust.method = "ward.D", size.range = c(1, 4))

Not sure about reasons and it could still work in the first case. But like to see any feedback if there is any! Thank you so much for the information provided!

@rrydbirk
Copy link
Collaborator

Hi @Angel-Wei

This was fixed some time ago here.

Could you check cao$.__enclos_env__$private$getOntologyPvalueResults and see if it's correct there in the function definition? It should be

    if (type == "GSEA") {
        if ((nrow(ont.res) == 0) && !("core_enrichment" %in% 
            colnames(ont.res))) {
            ont.res$core_enrichment <- character()
        }
        ont.res %<>% rename(geneID = core_enrichment)

I just checked our copy constructor, private functions should be updated as well with cao %<>% Cacoa$new().

@Angel-Wei
Copy link
Author

Hi Rasmus, so I checked cao$.__enclos_env__$private$getOntologyPvalueResults in case 2 I mentioned above (R 4.2.0, Cacoa 0.4.0). It shows ont.res %<>% rename(geneID = core_enrichment, qvalue = qvalues), which is the line 3022 deleted in pull request #42. It stayed the same even if I update private functions with cao %<>% Cacoa$new()
Not sure about the reasons, but I guess I'll stick to the first case I mentioned above to use the function. Thank you so much for your patience in this!

@rrydbirk
Copy link
Collaborator

No worries, as long as it's working, all is good :-) Thanks for using our software!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants