Skip to content

Commit 9943370

Browse files
committed
Fixed issue LR-T correlation for n < 5 for all cell types + add verbose
1 parent 87585ae commit 9943370

10 files changed

Lines changed: 43 additions & 14 deletions

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: multinichenetr
22
Type: Package
33
Title: Cell-Cell Communication analysis for scRNAseq data with complex multi-sample multi-group designs
4-
Version: 1.0.0
4+
Version: 1.0.1
55
Author: person("Robin", "Browaeys", email = "robin.browaeys@ugent.be",
66
role = c("aut", "cre"))
77
Maintainer: Robin Browaeys <robin.browaeys@ugent.be>
@@ -59,4 +59,4 @@ Suggests:
5959
tidyverse
6060
Remotes:
6161
github::saeyslab/nichenetr
62-
RoxygenNote: 7.1.1
62+
RoxygenNote: 7.2.3

R/lr_target_correlation.R

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,13 @@ lr_target_prior_cor_inference = function(receivers_oi, abundance_expression_info
204204
# ligand_target_df = ligand_target_df %>% dplyr::mutate(scaled_prior_score = 0.5*(scaled_ligand + scaled_target))
205205

206206
# Step4: Combine the ligand-target prior information scores and combine with the correlation based ones!
207-
cor_prior_df = lr_target_cor %>% dplyr::inner_join(ligand_target_df, by = c("ligand", "target")) %>% dplyr::mutate(id_target = paste(id, target, sep = "_")) %>% dplyr::ungroup()
207+
if(nrow(lr_target_cor) > 0){
208+
cor_prior_df = lr_target_cor %>% dplyr::inner_join(ligand_target_df, by = c("ligand", "target")) %>% dplyr::mutate(id_target = paste(id, target, sep = "_")) %>% dplyr::ungroup()
209+
} else {
210+
cor_prior_df = NULL
211+
print("For no celltypes, sufficient samples (>= 5) were available for a correlation analysis. lr_target_prior_cor, the output of this function, will be NULL. As a result, not all types of downstream visualizations can be created.")
212+
}
213+
208214

209215
# combine prior and correlation information
210216
# cor_prior_df = cor_prior_df %>% mutate(scaled_cor_score = 0.5*(scaled_pearson + scaled_target_pearson ))

R/pipeline.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,9 @@ multi_nichenet_analysis_separate = function(sce_receiver,
659659

660660

661661
# Add information on prior knowledge and expression correlation between LR and target expression ------------------------------------------------------------------------------------------------------------
662+
if(verbose == TRUE){
663+
print("Calculate correlation between LR pairs and target genes")
664+
}
662665
lr_target_prior_cor = lr_target_prior_cor_inference(prioritization_tables$group_prioritization_tbl$receiver %>% unique(), abundance_expression_info, celltype_de_receiver, grouping_tbl, prioritization_tables, ligand_target_matrix, logFC_threshold = logFC_threshold, p_val_threshold = p_val_threshold, p_val_adj = p_val_adj, top_n_LR = top_n_LR)
663666

664667

@@ -1149,6 +1152,9 @@ multi_nichenet_analysis_combined = function(sce,
11491152
}
11501153

11511154
# Add information on prior knowledge and expression correlation between LR and target expression ------------------------------------------------------------------------------------------------------------
1155+
if(verbose == TRUE){
1156+
print("Calculate correlation between LR pairs and target genes")
1157+
}
11521158
lr_target_prior_cor = lr_target_prior_cor_inference(prioritization_tables$group_prioritization_tbl$receiver %>% unique(), abundance_expression_info, celltype_de, grouping_tbl, prioritization_tables, ligand_target_matrix, logFC_threshold = logFC_threshold, p_val_threshold = p_val_threshold, p_val_adj = p_val_adj, top_n_LR = top_n_LR)
11531159

11541160
multinichenet_output = list(

README.Rmd

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ rmarkdown::render("README.Rmd",output_format = "md_document")
1717
[![Coverage Status](https://codecov.io/gh/browaeysrobin/multinichenetr/branch/master/graph/badge.svg?token=0X627I4TM7)](https://codecov.io/gh/browaeysrobin/multinichenetr)
1818
<!-- badges: end -->
1919

20-
**multinichenetr: the R package containing multiple functionalities to computationally study cell-cell communication from single-cell transcriptomics data with complex multi-sample, multi-condition designs.** The goal of this toolbox is to study differences in intercellular communication between groups of samples of interest (eg patients of different disease states).
20+
**multinichenetr: the R package for differential cell-cell communication analysis from single-cell transcriptomics data with complex multi-sample, multi-condition designs.** The goal of this toolbox is to study differences in intercellular communication between groups of samples of interest (eg patients of different disease states).
2121

2222
You can read all about MultiNicheNet in the following preprint: https://www.biorxiv.org/content/10.1101/2023.06.13.544751v1
2323

@@ -93,6 +93,11 @@ When applying MultiNicheNet on datasets with many samples and cell types, it is
9393
* [Running MultiNicheNet with qsub](vignettes/2-multinichenet_prism_final_MSA.Rmd)
9494
* [Interpreting MultiNicheNet results locally](vignettes/3-multinichenet_interpretation_MSA_final.Rmd)
9595

96+
## Frequently recurring questions and issues
97+
98+
* Even though it is stated in the vignettes, many reported issues arise because names of celltypes, groups/conditions, and/or samples are not syntactically valid. Before reporting your issue, make sure you satisfy this condition and other conditions described in the vignettes.
99+
* We strongly recommend having at least 4 samples in each of the groups/conditions you want to compare. With less samples, the benefits of performing a pseudobulk-based DE analysis are less clear and non-multi-sample tools for differential cell-cell communication might be better alternatives.
100+
96101
## References
97102

98103
Browaeys, R. et al. MultiNicheNet: a flexible framework for differential cell-cell communication analysis from multi-sample multi-condition single-cell transcriptomics data. (preprint)

README.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ status](https://github.com/browaeysrobin/multinichenetr/workflows/R-CMD-check-bi
1313
Status](https://codecov.io/gh/browaeysrobin/multinichenetr/branch/master/graph/badge.svg?token=0X627I4TM7)](https://codecov.io/gh/browaeysrobin/multinichenetr)
1414
<!-- badges: end -->
1515

16-
**multinichenetr: the R package containing multiple functionalities to
17-
computationally study cell-cell communication from single-cell
18-
transcriptomics data with complex multi-sample, multi-condition
19-
designs.** The goal of this toolbox is to study differences in
20-
intercellular communication between groups of samples of interest (eg
21-
patients of different disease states).
16+
**multinichenetr: the R package for differential cell-cell communication
17+
analysis from single-cell transcriptomics data with complex
18+
multi-sample, multi-condition designs.** The goal of this toolbox is to
19+
study differences in intercellular communication between groups of
20+
samples of interest (eg patients of different disease states).
2221

2322
You can read all about MultiNicheNet in the following preprint:
2423
<https://www.biorxiv.org/content/10.1101/2023.06.13.544751v1>
@@ -185,6 +184,19 @@ plots; and 2) interpreting the results and generating visualizations.
185184
- [Interpreting MultiNicheNet results
186185
locally](vignettes/3-multinichenet_interpretation_MSA_final.Rmd)
187186

187+
## Frequently recurring questions and issues
188+
189+
- Even though it is stated in the vignettes, many reported issues
190+
arise because names of celltypes, groups/conditions, and/or samples
191+
are not syntactically valid. Before reporting your issue, make sure
192+
you satisfy this condition and other conditions described in the
193+
vignettes.
194+
- We strongly recommend having at least 4 samples in each of the
195+
groups/conditions you want to compare. With less samples, the
196+
benefits of performing a pseudobulk-based DE analysis are less clear
197+
and non-multi-sample tools for differential cell-cell communication
198+
might be better alternatives.
199+
188200
## References
189201

190202
Browaeys, R. et al. MultiNicheNet: a flexible framework for differential

man/get_ligand_activities_targets_DEgenes.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/multi_nichenet_analysis_combined.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/multi_nichenet_analysis_separate.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/perform_muscat_de_analysis.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/Rplots.pdf

-15.8 KB
Binary file not shown.

0 commit comments

Comments
 (0)