Skip to contents

For a collection of matrices, we exclude features that are considered background based on prior knowledge of marker genes

Usage

filt_gex_bybckgrnd(pb_dat_list, prior_mrks)

Arguments

pb_dat_list

List of SummarizedExperiment generated from MOFAcellulaR::filt_profiles()

prior_mrks

A named list providing marker genes per cell type. Names should be identical as in pb_dat_list

Value

A named list of SummarizedExperiments per cell type provided with filtered normalized log transformed data in their logcounts assay

Details

Performs filtering of highly variable genes (after data transformation). This is based on marker genes. The assumption is that background gene expression can be traced by expression of cell type marker genes in cell types which shouldn't express the gene. Marker genes will be only kept in the matrix if they are expressed in the expected cell type

Examples

inputs_dir <- base::system.file("extdata", package = "MOFAcellulaR")
load(file.path(inputs_dir, "testpbcounts.rda"))
load(file.path(inputs_dir, "testcoldata.rda"))

pb_obj <- create_init_exp(counts = testpbcounts,
                          coldata = testcoldata)

ct_list <- filt_profiles(pb_dat = pb_obj,
                         cts = c("Fib","CM"),
                         ncells = 5,
                         counts_col = "cell_counts",
                         ct_col = "cell_type")

ct_list <- filt_gex_byexpr(pb_dat_list = ct_list,
                           min.count = 5,
                           min.prop = 0.25)
#> Warning: All samples appear to belong to the same group.
#> Warning: All samples appear to belong to the same group.

ct_list <- tmm_trns(pb_dat_list = ct_list,
                    scale_factor = 1000000)

ct_list <- filt_gex_byhvg(pb_dat_list = ct_list,
                          prior_hvg = NULL,
                          var.threshold = 0)

prior_hvg_test <- list("CM" = c("TTN"),
                       "Fib" = c("POSTN"))

ct_list <- filt_gex_bybckgrnd(pb_dat_list = ct_list,
                              prior_mrks = prior_hvg_test)