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

Error when running plot_c2c_overview for LIANA + tensor-cell2cell #78

Closed GoBucket closed 1 year ago

GoBucket commented 1 year ago

Hi, When I try to run plot_c2c_overview(sce, group_col="stim")

I get the following error:

Error indplyr::select(): ! Can't subset columns that don't exist. x Columncontextdoesn't exist. Runrlang::last_error()to see where the error occurred.

I have ran glimpse(factors) which showed: List of 4 $ contexts : tibble [2 x 9] (S3: tbl_df/tbl/data.frame) ..$ context : Factor w/ 2 levels "24H","48H": 1 2 ..$ Factor.1: num [1:2] 0.662 0.75 ..$ Factor.2: num [1:2] 0.774 0.633 ..$ Factor.3: num [1:2] 0.657 0.754 ..$ Factor.4: num [1:2] 0.702 0.712 ..$ Factor.5: num [1:2] 0.685 0.729 ..$ Factor.6: num [1:2] 0.882 0.471 ..$ Factor.7: num [1:2] 0.71 0.704 ..$ Factor.8: num [1:2] 0.44 0.898 ..- attr(*, "pandas.index")=Index(['24H', '48H'], dtype='object') $ interactions: tibble [2,893 x 9] (S3: tbl_df/tbl/data.frame) ..$ lr : Factor w/ 2893 levels "A2M^LRP1","ACE^BDKRB2",..: 1 2 3 4 5 6 7 8 9 10 ... ..$ Factor.1: num [1:2893] 2.07e-05 8.69e-21 5.91e-02 2.37e-02 3.38e-03 ... ..$ Factor.2: num [1:2893] 0.01851 0.00308 0.03423 0.06876 0.02213 ... ..$ Factor.3: num [1:2893] 1.11e-28 1.02e-05 1.73e-02 1.93e-02 1.34e-02 ... ..$ Factor.4: num [1:2893] 4.57e-12 5.20e-03 3.16e-02 2.73e-02 1.37e-02 ... ..$ Factor.5: num [1:2893] 0.0884 0.00566 0.02742 0.02388 0.00333 ... ..$ Factor.6: num [1:2893] 1.87e-02 1.32e-04 5.52e-02 3.09e-02 2.59e-19 ... ..$ Factor.7: num [1:2893] 1.26e-02 5.98e-34 4.43e-02 3.63e-02 1.00e-02 ... ..$ Factor.8: num [1:2893] 1.05e-02 9.74e-23 2.64e-02 5.23e-02 2.16e-03 ... ..- attr(*, "pandas.index")=Index(['A2M^LRP1', 'ACE^BDKRB2', 'ACTR2^ADRB2', 'ACTR2^LDLR', 'ADAM10^AXL', 'ADAM10^CADM1', 'ADAM10^CD44', 'ADAM10^GPNMB', 'ADAM10^MET', 'ADAM10^NOTCH1', ... 'WNT9A^FZD7_LRP6', 'WNT9A^FZD8_LRP5', 'WNT9A^FZD8_LRP6', 'WNT9A^FZD9_LRP5', 'WNT9A^FZD9_LRP6', 'XCL1^ADGRV1', 'XCL1^XCR1', 'YBX1^NOTCH1', 'ZP3^EGFR', 'ZP3^MERTK'], dtype='object', length=2893) $ senders : tibble [7 x 9] (S3: tbl_df/tbl/data.frame) ..$ celltype: Factor w/ 7 levels "Dopaminergic neurons",..: 1 2 3 4 5 6 7 ..$ Factor.1: num [1:7] 0.428 0.427 0.231 0.284 0.338 ... ..$ Factor.2: num [1:7] 0.432 0.421 0.261 0.328 0.3 ... ..$ Factor.3: num [1:7] 0.02812 0.03798 0.00116 0.00233 0.99739 ... ..$ Factor.4: num [1:7] 0.4 0.374 0.347 0.345 0.401 ... ..$ Factor.5: num [1:7] 0.0232 0.0338 0.0577 0.9805 0.1827 ... ..$ Factor.6: num [1:7] 0.43 0.434 0.212 0.315 0.304 ... ..$ Factor.7: num [1:7] 0.2529 0.1286 0.9315 0.0634 0.0681 ... ..$ Factor.8: num [1:7] 0.48 0.401 0.304 0.256 0.203 ... ..- attr(*, "pandas.index")=Index(['Dopaminergic neurons', 'Immune system cells', 'Microglial cells', 'Neural Progenitor cells', 'Oligodendrocytes', 'Radial glial cells', 'Unknown'], dtype='object') $ receivers : tibble [7 x 9] (S3: tbl_df/tbl/data.frame) ..$ celltype: Factor w/ 7 levels "Dopaminergic neurons",..: 1 2 3 4 5 6 7 ..$ Factor.1: num [1:7] 0.2916 0.6959 0.4426 0.1017 0.0309 ... ..$ Factor.2: num [1:7] 0.5042 0.1627 0.0145 0.058 0.1654 ... ..$ Factor.3: num [1:7] 0.399 0.316 0.403 0.392 0.387 ... ..$ Factor.4: num [1:7] 0.0218 0.0783 0.0472 0.0317 0.9928 ... ..$ Factor.5: num [1:7] 0.386 0.347 0.413 0.384 0.375 ... ..$ Factor.6: num [1:7] 0.25473 0.00679 0.63078 0.6129 0.38802 ... ..$ Factor.7: num [1:7] 0.4 0.365 0.434 0.354 0.325 ... ..$ Factor.8: num [1:7] 0.268 0.17 0.206 0.768 0.399 ... ..- attr(*, "pandas.index")=Index(['Dopaminergic neurons', 'Immune system cells', 'Microglial cells', 'Neural Progenitor cells', 'Oligodendrocytes', 'Radial glial cells', 'Unknown'], dtype='object')

Any help is much appreciated thank you!

dbdimitrov commented 1 year ago

Hi,

You need to provide a group_col that is present within your sce object. In the example, stim is the one that corresponds to the condition (i.e. whether the samples are stimulated or not).

Hope this helps.

GoBucket commented 1 year ago

Hi,

In my dataset, stim is present in the object. I have checked via colData(sce)

GoBucket commented 1 year ago

I have found the fix. Turns out I had to sce$context <- paste(sce$stim, sep="|") and then sample_col = "context", for liana_bysample

What I did before was sample_col = "stim",

Thank you for your help and prompt replies.