get_DE_info: get_DE_info

get_DE_infoR Documentation

get_DE_info

Description

get_DE_info Perform differential expression analysis via Muscat - Pseudobulking approach. Also visualize the p-value distribution. Under the hood, the following function is used: 'perform_muscat_de_analysis'.

Usage

get_DE_info(sce, sample_id, group_id, celltype_id, batches, covariates, contrasts_oi, expressed_df, min_cells = 10, assay_oi_pb = "counts", fun_oi_pb = "sum", de_method_oi = "edgeR", findMarkers = FALSE, contrast_tbl = NULL)

Arguments

sce

SingleCellExperiment object of the scRNAseq data of interest. Contains both sender and receiver cell types.

sample_id

Name of the meta data column that indicates from which sample/patient a cell comes from

group_id

Name of the meta data column that indicates from which group/condition a cell comes from

celltype_id

Name of the column in the meta data of sce that indicates the cell type of a cell.

batches

NA if no batches should be corrected for. If there should be corrected for batches during DE analysis and pseudobulk expression calculation, this argument should be the name(s) of the columns in the meta data that indicate the batch(s). Should be categorical. Pseudobulk expression values will be corrected for the first element of this vector.

covariates

NA if no covariates should be corrected for. If there should be corrected for covariates uring DE analysis, this argument should be the name(s) of the columns in the meta data that indicate the covariate(s). Can both be categorical and continuous. Pseudobulk expression values will not be corrected for the first element of this vector.

contrasts_oi

String indicating the contrasts of interest (= which groups/conditions will be compared) for the differential expression and MultiNicheNet analysis. We will demonstrate here a few examples to indicate how to write this. Check the limma package manuals for more information about defining design matrices and contrasts for differential expression analysis.
If wanting to compare group A vs B: ‘contrasts_oi = c("’A-B'")'
If wanting to compare group A vs B & B vs A: ‘contrasts_oi = c("’A-B','B-A'")'
If wanting to compare group A vs B & A vs C & A vs D: ‘contrasts_oi = c("’A-B','A-C', 'A-D'")'
If wanting to compare group A vs B and C: ‘contrasts_oi = c("’A-(B+C)/2'")'
If wanting to compare group A vs B, C and D: ‘contrasts_oi = c("’A-(B+C+D)/3'")'
If wanting to compare group A vs B, C and D & B vs A,C,D: ‘contrasts_oi = c("’A-(B+C+D)/3', 'B-(A+C+D)/3'")'
Note that the groups A, B, ... should be present in the meta data column 'group_id'.

expressed_df

tibble with three columns: gene, celltype, expressed; this data frame indicates which genes can be considered as expressed in each cell type.

min_cells

Indicates the minimal number of cells that a sample should have to be considered in the DE analysis. Default: 10. See 'muscat::pbDS'.

assay_oi_pb

Indicates which information of the assay of interest should be used (counts, scaled data,...). Default: "counts". See 'muscat::aggregateData'.

fun_oi_pb

Indicates way of doing the pseudobulking. Default: "sum". See 'muscat::aggregateData'.

de_method_oi

Indicates the DE method that will be used after pseudobulking. Default: "edgeR". See 'muscat::pbDS'.

findMarkers

Indicate whether we should also calculate DE results with the classic scran::findMarkers approach. Default (recommended): FALSE. if TRUE: both pseudobulk-based and cell-level based DE results will be generated.

contrast_tbl

see explanation in multi_nichenet_analysis function – here: only required to give as input if findMarkers = TRUE.

Value

List with output of the differential expression analysis in 1) default format('muscat::pbDS()'), and 2) in a tidy table format ('muscat::resDS()') (both in the 'celltype_de' slot); Histogram plot of the p-values is also returned.

Examples

## Not run: 
library(dplyr)
sample_id = "tumor"
group_id = "pEMT"
celltype_id = "celltype"
batches = NA
covariates = NA
contrasts_oi = c("'High-Low','Low-High'")
frq_list = get_frac_exprs(sce = sce, sample_id = sample_id, celltype_id =  celltype_id, group_id = group_id)
DE_info = get_DE_info(
   sce = sce,
   sample_id = sample_id,
   celltype_id = celltype_id,
   group_id = group_id,
   batches = batches,
   covariates = covariates,
   contrasts = contrasts_oi,
   expressed_df = frq_list$expressed_df)

## End(Not run)


saeyslab/multinichenetr documentation built on Jan. 15, 2025, 7:55 p.m.