Skip to content

Commit

Permalink
change expression filtering (>= instead of >)
Browse files Browse the repository at this point in the history
  • Loading branch information
browaeysrobin committed Jan 22, 2024
1 parent d97312a commit 12e4278
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/expression_processing.R
Original file line number Diff line number Diff line change
Expand Up @@ -607,9 +607,9 @@ get_frac_exprs = function(sce, sample_id, celltype_id, group_id, batches = NA, m
print(paste0("Genes expressed in at least ",n_min, " samples will considered as expressed in the cell type: ",celltype_oi))
}

frq_df = frq_df %>% dplyr::inner_join(grouping_df) %>% dplyr::mutate(expressed_sample = fraction_sample > fraction_cutoff)
frq_df = frq_df %>% dplyr::inner_join(grouping_df) %>% dplyr::mutate(expressed_sample = fraction_sample >= fraction_cutoff)

expressed_df = frq_df %>% inner_join(n_smallest_group_tbl) %>% inner_join(abundance_data) %>% dplyr::group_by(gene, celltype) %>% dplyr::summarise(n_expressed = sum(expressed_sample)) %>% dplyr::mutate(expressed = n_expressed > n_min) %>% distinct(celltype, gene, expressed)
expressed_df = frq_df %>% inner_join(n_smallest_group_tbl) %>% inner_join(abundance_data) %>% dplyr::group_by(gene, celltype) %>% dplyr::summarise(n_expressed = sum(expressed_sample)) %>% dplyr::mutate(expressed = n_expressed >= n_min) %>% distinct(celltype, gene, expressed)
for(i in seq(length(unique(expressed_df$celltype)))){
celltype_oi = unique(expressed_df$celltype)[i]
n_genes = expressed_df %>% filter(celltype == celltype_oi) %>% filter(expressed == TRUE) %>% pull(gene) %>% unique() %>% length()
Expand Down
14 changes: 14 additions & 0 deletions vignettes/basic_analysis_steps_MISC.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,20 @@ combined_plot

__Note__ Use `make_DEgene_dotplot_pseudobulk_batch` if you want to indicate the batch of each sample to the plot

What if there is a specific ligand you are interested in?

```{r}
group_oi = "M"
receiver_oi = "L_T_TIM3._CD38._HLADR."
ligands_oi = c("IFNG","IL15")
prioritized_tbl_ligands_oi = get_top_n_lr_pairs(multinichenet_output$prioritization_tables, 10000, groups_oi = group_oi, receivers_oi = receiver_oi) %>% filter(ligand %in% ligands_oi) # ligands should still be in the output tables of course
```

```{r, fig.width=20, fig.height=10}
combined_plot = make_ligand_activity_target_plot(group_oi, receiver_oi, prioritized_tbl_ligands_oi, multinichenet_output$prioritization_tables, multinichenet_output$ligand_activities_targets_DEgenes, contrast_tbl, multinichenet_output$grouping_tbl, multinichenet_output$celltype_info, ligand_target_matrix, plot_legend = FALSE)
combined_plot
```

## Visualization of expression-correlated target genes of ligand-receptor pairs

Before, we had calculated the correlation in expression between ligand-receptor pairs and DE genes. Now we will filter out correlated ligand-receptor --> target links that both show high expression correlation (spearman or activity > 0.50 in this example) and have some prior knowledge to support their link.
Expand Down

0 comments on commit 12e4278

Please sign in to comment.