Skip to contents

Get enrichment matrix for marker genes

Usage

get_rna_marker_matrix(
  atac_mc,
  markers = NULL,
  force_cell_type = TRUE,
  rm_zeros = TRUE,
  epsilon = 0.00001,
  ...
)

Arguments

atac_mc

a McPeaks/McTracks object with RNA expression (using add_mc_rna)

markers

a list of marker genes. If NULL - the function uses get_rna_markers with default parameters which can be overridden using the ellipsis ....

force_cell_type

do not split cell types when ordering the metacells. Default: TRUE

rm_zeros

remove genes with no RNA expression in any metacell. Default: TRUE

epsilon

regularization factor added to the log normalized expression

...

Arguments passed on to get_rna_markers

n_genes

maximal number of genes to return. Default: 100

minimal_max_log_fraction

take only genes with at least one value (in log fraction units - normalized egc) above this threshold

minimal_relative_log_fraction

take only genes with at least one value with relative log fraction (mc_fp) above this this value

fold_change_reg

regularization factor for the fold change calculation (fold_change would be changed to fold_change = fold_change + fold_change_reg)

genes

list of genes to match. Default (NULL): all genes

Value

A matrix with log2 normalized counts of gene expression for each marker gene (rows) and metacell (columns).

The columns are columns are clustered using hclust with "ward" linkage, on the euclidean distance of the pearson correlation matrix between the columns. Then, the gene with the highest number of metacells with fold change (abs) above 1 (gene1) is selected together with the gene most anti-correlated to it (gene2), and the hclust is ordered using the difference (gene1 - gene2).

If force_cell_type is TRUE and atac_mc@metadata has a field named "cell_type", the columns are only ordered only within each cell type.

Examples

if (FALSE) {
marker_mat <- get_rna_marker_matrix(atac_mc)
marker_mat <- get_rna_marker_matrix(atac_mc, n_genes = 100)
}