saeyslab / multinichenetr

MultiNicheNet: a flexible framework for differential cell-cell communication analysis from multi-sample multi-condition single-cell transcriptomics data
GNU General Public License v3.0
112 stars 14 forks source link

No results returned when running get_top_n_lr_pairs #22

Closed catsargent closed 1 year ago

catsargent commented 1 year ago

Hi,

Sorry, me again. I am not sure whether this is a bug or just that no results were found with my dataset. When I run the following: prioritized_tbl_oi_all = get_top_n_lr_pairs(multinichenet_output$prioritization_tables, 50, rank_per_group = FALSE)

I get an empty table:

Screenshot 2023-08-11 at 12 58 16

However, there are plenty of data in multinichenet_output$prioritization_tables:

> multinichenet_output$prioritization_tables
$group_prioritization_tbl
# A tibble: 295,482 × 60
   contrast group sender receiver ligand receptor lfc_ligand lfc_receptor ligand_receptor_lfc_…¹ p_val_ligand p_adj_ligand p_val_receptor
   <chr>    <chr> <chr>  <chr>    <chr>  <chr>         <dbl>        <dbl>                  <dbl>        <dbl>        <dbl>          <dbl>
 1 Minor.S… Mino… Acina… T.Cells  PF4    CXCR3          6.21         1.31                   3.76   0.00000971    0.000257        0.00738 
 2 Minor.S… Mino… Acina… T.Cells  PF4    CXCR3          6.21         1.31                   3.76   0.00000971    0.000257        0.00738 
 3 Submand… Subm… Oral.… Fibrobl… INHBB  ACVR1B         3.74         1.4                    2.57   0.0227        0.153           0.0037  
 4 Submand… Subm… Oral.… Fibrobl… INHBB  ACVR1B         3.74         1.4                    2.57   0.0227        0.153           0.0037  
 5 Parotid… Paro… VECs   Fibrobl… POSTN  ITGB3          2.66         2.37                   2.52   0.000684      0.0288          0.00101 
 6 Parotid… Paro… VECs   Fibrobl… POSTN  ITGB3          2.66         2.37                   2.52   0.000684      0.0288          0.00101 
 7 Parotid… Paro… VECs   Fibrobl… TGM2   ITGB3          3.6          2.37                   2.99   0.00000006    0.0000768       0.00101 
 8 Parotid… Paro… VECs   Fibrobl… TGM2   ITGB3          3.6          2.37                   2.99   0.00000006    0.0000768       0.00101 
 9 Submand… Subm… Acina… Mac.Mono FURIN  INSR           1.91         2.12                   2.02   0.000262      0.00884         0.000977
10 Submand… Subm… Acina… Mac.Mono FURIN  INSR           1.91         2.12                   2.02   0.000262      0.00884         0.000977
# ℹ 295,472 more rows
# ℹ abbreviated name: ¹​ligand_receptor_lfc_avg
# ℹ 48 more variables: p_adj_receptor <dbl>, activity <dbl>, direction_regulation <fct>, activity_scaled <dbl>, lr_interaction <chr>,
#   id <chr>, avg_ligand_group <dbl>, avg_receptor_group <dbl>, ligand_receptor_prod_group <dbl>, fraction_ligand_group <dbl>,
#   fraction_receptor_group <dbl>, ligand_receptor_fraction_prod_group <dbl>, rel_abundance_scaled_sender <dbl>,
#   rel_abundance_scaled_receiver <dbl>, sender_receiver_rel_abundance_avg <dbl>, lfc_pval_ligand <dbl>, p_val_ligand_adapted <dbl>,
#   scaled_lfc_ligand <dbl>, scaled_p_val_ligand <dbl>, scaled_lfc_pval_ligand <dbl>, scaled_p_val_ligand_adapted <dbl>, …
# ℹ Use `print(n = ...)` to see more rows

$sample_prioritization_tbl
# A tibble: 16,204,903 × 26
   sample                  sender receiver ligand receptor avg_ligand avg_receptor ligand_receptor_prod fraction_ligand fraction_receptor
   <chr>                   <chr>  <chr>    <chr>  <chr>         <dbl>        <dbl>                <dbl>           <dbl>             <dbl>
 1 X3545cb11.ec09.4475.80… Acina… T.Cells  ZG16B  CXCR4         10.7          4.75                 50.7               0                 0
 2 X3545cb11.ec09.4475.80… Ducta… T.Cells  ZG16B  CXCR4          9.97         4.75                 47.4               0                 0
 3 d2110830.d924.4d18.a19… Acina… ILCs     ZG16B  CXCR4         11.3          4.04                 45.5               0                 0
 4 d2110830.d924.4d18.a19… Ducta… ILCs     ZG16B  CXCR4         10.5          4.04                 42.4               0                 0
 5 fe0ae9cb.e1f3.4dfb.944… Dendr… Pericyt… S100A9 CD36           7.95         5.21                 41.4               0                 0
 6 X71f09799.9a58.4b1a.89… Acina… T.Cells  ZG16B  CXCR4         11.2          3.53                 39.7               0                 0
 7 fe0ae9cb.e1f3.4dfb.944… Dendr… Pericyt… S100A8 CD36           7.52         5.21                 39.2               0                 0
 8 ead6ff92.9050.4aec.8f8… Mac.M… Ionocyt… HLA.D… CD9            7.33         5.33                 39.1               0                 0
 9 d2110830.d924.4d18.a19… Acina… T.Cells  ZG16B  CXCR4         11.3          3.35                 37.6               0                 0
10 c6860865.01a6.4d26.b0f… Dendr… LECs     HLA.D… CD9            7.48         5.01                 37.5               0                 0
# ℹ 16,204,893 more rows
# ℹ 16 more variables: ligand_receptor_fraction_prod <dbl>, pb_ligand <dbl>, pb_receptor <dbl>, ligand_receptor_pb_prod <dbl>,
#   group <chr>, prioritization_score <dbl>, lr_interaction <chr>, id <chr>, scaled_LR_prod <dbl>, scaled_LR_frac <dbl>,
#   scaled_LR_pb_prod <dbl>, n_cells_receiver <dbl>, keep_receiver <dbl>, n_cells_sender <dbl>, keep_sender <dbl>,
#   keep_sender_receiver <fct>
# ℹ Use `print(n = ...)` to see more rows

$ligand_activities_target_de_tbl
# A tibble: 2,659,224 × 11
# Groups:   receiver, contrast [33]
   contrast             receiver ligand activity activity_scaled target ligand_target_weight logFC   p_val p_val_adj direction_regulation
   <chr>                <chr>    <chr>     <dbl>           <dbl> <chr>                 <dbl> <dbl>   <dbl>     <dbl> <fct>               
 1 Parotid.Gland-(Mino… Acinar.… A2M      0.0505           0.800 ABCA1               0.00814 2.42  1.48e-3   0.01    up                  
 2 Parotid.Gland-(Mino… Acinar.… A2M      0.0505           0.800 AHNAK               0.00726 1.72  3.12e-3   0.0164  up                  
 3 Parotid.Gland-(Mino… Acinar.… A2M      0.0505           0.800 AHR                 0.00761 3.07  1.11e-4   0.00209 up                  
 4 Parotid.Gland-(Mino… Acinar.… A2M      0.0505           0.800 ALOX5…              0.00727 2.32  9.09e-3   0.0339  up                  
 5 Parotid.Gland-(Mino… Acinar.… A2M      0.0505           0.800 ANGPT…              0.00747 2.9   3   e-4   0.00374 up                  
 6 Parotid.Gland-(Mino… Acinar.… A2M      0.0505           0.800 BCL2                0.0149  4.58  6.66e-4   0.00608 up                  
 7 Parotid.Gland-(Mino… Acinar.… A2M      0.0505           0.800 BCL2L…              0.00797 1.97  3.13e-3   0.0165  up                  
 8 Parotid.Gland-(Mino… Acinar.… A2M      0.0505           0.800 BCL3                0.00825 0.701 4.55e-2   0.107   up                  
 9 Parotid.Gland-(Mino… Acinar.… A2M      0.0505           0.800 BHLHE…              0.00945 2.13  5.05e-4   0.00518 up                  
10 Parotid.Gland-(Mino… Acinar.… A2M      0.0505           0.800 BIRC3               0.00988 2.05  1.69e-3   0.011   up                  
# ℹ 2,659,214 more rows
# ℹ Use `print(n = ...)` to see more rows

Even if I only ask for the top 1 result to be returned, the resulting table is empty. Can you please explain what the definition of top X results are? i.e. what is used to define a result making the top n list? Can you think why I may not have any results? I also tried changing rank_per_group = TRUE but that did not help. Any insight you could give would be appreciated. In case it is relevant, one of my groups has only 2 samples.

Thanks, Catherine

catsargent commented 1 year ago

I have been trying to look into this further to understand why no results are returned when running get_top_n_lr_pairs. It seems that the reason for this is because in the table prioritization_tbl_oi all of the values in the fraction_expressing_ligand_receptor column are 0.

Similarly, in the same table, the columns for fraction_receptor_group and fraction_ligand_group also contain only 0s. Do you know why this might be?

Thanks for your help.

browaeysrobin commented 1 year ago

get_top_n_lr_pairs filters LR pairs in such a way that they should be expressed in at least one sample in a certain group/condition. (definition of expressed: gene should be expressed in >=5% of cells of a cell type in a sample).

Since the underlying issue is here that no LR pairs are expressed (as mentioned in #23), I will close this one here since there is not issue in the get_top_n_lr_pairs function.