fix_frq_df: fix_frq_df

View source: R/expression_processing.R

fix_frq_dfR Documentation

fix_frq_df

Description

fix_frq_df Fix muscat-feature/bug in fraction calculation: in case a there are no cells of a cell type in a sample, that expression fraction will be NA / NaN. Change these NA/NaN to 0.

Usage

fix_frq_df(sce, frq_celltype_samples)

Arguments

sce

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

frq_celltype_samples

Sample-average data frame output of 'get_muscat_exprs_frac'

Value

Fixed data frame with fraction of cells expressing a gene.

Examples

## Not run: 
library(dplyr)
sample_id = "tumor"
group_id = "pEMT"
celltype_id = "celltype"
frq_df = get_muscat_exprs_frac(sce, sample_id = sample_id, celltype_id =  celltype_id, group_id = group_id) %>% .$frq_celltype_samples
if(nrow(frq_df %>% dplyr::filter(is.na(fraction_sample))) > 0 | nrow(frq_df %>% dplyr::filter(is.nan(fraction_sample))) > 0) {
  frq_df = fix_frq_df(sce, frq_df)
  }

## End(Not run)


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