saezlab / liana

LIANA: a LIgand-receptor ANalysis frAmework
https://saezlab.github.io/liana/
GNU General Public License v3.0
169 stars 30 forks source link

scconnect method doesn't work #88

Closed PoGibas closed 1 year ago

PoGibas commented 1 year ago

Method scconnect doesn't not work (even with a test data) - returns error message:

Expression from the `RNA` assay will be used
Running LIANA with `seurat_annotations` as labels!
LIANA: LR summary stats calculated!
Now Running: Scconnect
Error: ℹ In index: 1.
ℹ With name: Consensus.
Caused by error in `union()`:
! trying to get slot "add_columns" from an object of a basic class ("NULL") with no slots
<error/purrr_error_indexed>
Error in `map2()`:
ℹ In index: 1.
ℹ With name: Consensus.
Caused by error in `union()`:
! trying to get slot "add_columns" from an object of a basic class ("NULL") with no slots
---
Backtrace:
  1. liana::liana_wrap(test_data, method = "scconnect")
 23. liana::get_scconnect(...)
 24. liana::liana_call(lr_res = lr_res, method = "scconnect", ...)
 25. liana:::liana_scores(...)
 26. generics::union(score_object@add_columns, supp_columns)
Warning message:
In exec(output, ...) :
  3465 genes and/or 0 cells were removed as they had no counts!

This method seems to be in the provided method list. For example liana:::.select_method("scconnect") returns results, just like liana:::.select_method("cytotalk"), but liana:::.select_method("foo") would give expected error.

Code to reproduce scconnect error:

test_data <- readRDS(file.path(liana_path , "testdata", "input", "testdata.rds"))
# Doesn't work
liana::liana_wrap(test_data, method = "scconnect")
# Works
liana::liana_wrap(test_data, method = "cytotalk")
dbdimitrov commented 1 year ago

scconnect is not part of LIANA, I noticed that I must have merged or unintentionally left some variables that refer to it. I will remove those in a follow-up update :)

PoGibas commented 1 year ago

@dbdimitrov Thank you for your answer! It makes sense now. Just to confirm - the official list of methods is available only through the documentation of ?liana_wrap and it is c("natmi", "connectome", "logfc", "sca", "cellphonedb")? Can you please explain then to which selections do methods: "CellChat", "SingleCellSignalR", "Crosstalk Scores" link to (other ones are easy to connect by name)?

I also have one additional question: is it possible to submit a vector of resources to liana::liana_wrap? For example, the command liana::liana_wrap(test_data, resource = "all") is very likely to fail as one of the resources is MouseConsensus (therefore all resources will fail). Would a command like this make sense liana::liana_wrap(test_data, resource = grep("Mouse", show_resources(), invert = TRUE, value = TRUE))? Or would you recommend just running all wanted resources in a loop? Also, was then Consensus created using MouseConsensus as well?

dbdimitrov commented 1 year ago

I would say the official list is available through show_methods though, I strongly recommend using the internal ones to liana (i.e. those without call_* in their names). So, indeed the vector that you shared via liana_wrap is how I would use LIANA. Any of the other ones e.g. call_cellchat, call_sca (SingleCellSignalR), etc, are just calls to external packages that need to be installed. This functionality is largely deprecated (I used them in LIANA's manuscript, but for ease of use and to make sure that all parameters, etc are consistent, I re-implemented certain methods).

Yes, indeed I think this should work. Good catch about all, I have now changed select_resource to only return the human resources if all is selected.

But indeed, this should work, as liana will do the loops(maps) for you:

liana_path <- system.file(package = "liana")
seurat_object <-
    readRDS(file.path(liana_path , "testdata", "input", "testdata.rds"))

liana_res <- liana::liana_wrap(seurat_object, resource = grep("Mouse", show_resources(), invert = TRUE, value = TRUE), method=c("sca", "natmi"))

MouseConsensus is just an orthology conversion of Consensus.

PoGibas commented 1 year ago

Thank you! it is all clear now. Can you just confirm if such a programmatic approach will return all possible/usable methods?

liana_wrap(test_data, method = grep("^call_", show_methods(), invert = TRUE, value = TRUE))

dbdimitrov commented 1 year ago

Hi @PoGibas,

Yep, this would do it. :)