saezlab / liana

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

heat_freq error #133

Open baj12 opened 10 months ago

baj12 commented 10 months ago

Hi,

great package!

I am running into an error with heat_freq():

heat_freq(liana_trunc)
Error: number of observations in bottom annotation should be as same as ncol of the matrix.

> liana_trunc
# A tibble: 7 × 16
  source target ligand.complex receptor.complex aggregate_rank mean_rank natmi.edge_specificity natmi.rank connectome.weight_sc connectome.rank logfc.logfc_comb logfc.rank
  <chr>  <chr>  <chr>          <chr>                     <dbl>     <dbl>                  <dbl>      <dbl>                <dbl>           <dbl>            <dbl>      <dbl>
1 14     7      F10            F3                     0.000277      13.5                 0.0349          7                 1.60               1             2.00          2
2 14     8      F10            F3                     0.000614      14.7                 0.0340          8                 1.58               2             1.88          5
3 14     15     F10            F3                     0.00148       16.3                 0.0327          9                 1.55               3             1.66         10
4 14     0      F10            F3                     0.00148       15.7                 0.0303         10                 1.50               4             1.93          4
5 14     4      F10            F3                     0.00214       16.1                 0.0287         11                 1.47               5             1.95          3
6 14     6      F10            F3                     0.00301       17.5                 0.0281         12                 1.46               6             1.77          7
7 17     7      F10            F3                     0.00718       20.9                 0.0254         15                 1.20              11             1.51         15
# ℹ 4 more variables: sca.LRscore <dbl>, sca.rank <dbl>, cellphonedb.pvalue <dbl>, cellphonedb.rank <dbl>

> liana_trunc %>% liana:::.get_freq()
   0 15 4 6 7 8
14 1  1 1 1 1 1
17 0  0 0 0 1 0

Not sure I understand the source code correctly, but it seems that cell_anno is used for rows and columns, and I am wondering if this is intentional....

Please let me know if you need further information to reproduce.

dbdimitrov commented 10 months ago

Hi @baj12,

Is liana_trunc with the same data as in the tutorial? Or is it your own data?

Would help if I knew if this was a data- or versioning-related issue.

Not sure I understand the source code correctly, but it seems that cell_anno is used for rows and columns, and I am wondering if this is intentional....

re cell-anno, indeed I make it so that the row and col annotations are mirrored

baj12 commented 10 months ago

sorry for not being clear enough and I hope the following will clarify it.

The data is my own and a bit too big to share here. The sources and target column don't share any items, which might be the root cause of the problem. I believe in these cases it is difficult to use the same name for row/column. Also, the number of rows/columns is not the same in my case. The test data is working correctly.