get_frac_exprs: get_frac_exprs

View source: R/expression_processing.R

get_frac_exprsR Documentation

get_frac_exprs

Description

get_frac_exprs Calculate the average fraction of expression of each gene per sample and per group.

Usage

get_frac_exprs(sce, sample_id, celltype_id, group_id, batches = NA, min_cells = 10, fraction_cutoff = 0.05, min_sample_prop = 0.5)

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

celltype_id

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

group_id

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

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.

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'.

fraction_cutoff

Cutoff indicating the minimum fraction of cells of a cell type in a specific sample that are necessary to consider a gene (e.g. ligand/receptor) as expressed in a sample.

min_sample_prop

Parameter to define the minimal required nr of samples in which a gene should be expressed in more than 'fraction_cutoff' of cells in that sample (per cell type). This nr of samples is calculated as the 'min_sample_prop' fraction of the nr of samples of the smallest group (after considering samples with n_cells >= 'min_cells'. Default: 'min_sample_prop = 0.50'. Examples: if there are 8 samples in the smallest group, there should be min_sample_prop*8 (= 4 in this example) samples with sufficient fraction of expressing cells.

Value

List containing data frames with the fraction of expression per sample and per group.

Examples

## Not run: 
library(dplyr)
sample_id = "tumor"
group_id = "pEMT"
celltype_id = "celltype"
frac_info = get_frac_exprs(sce = sce, sample_id = sample_id, celltype_id =  celltype_id, group_id = group_id)

## End(Not run)


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