Skip to contents

create an 'hclust' object using the RNA marker matrix. When force_cell_type is TRUE and atac_mc@metadata has a field named "cell_type" the clustering is done

Usage

mc_hclust_rna(
  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

an 'hclust' object with the hierarchical clustering of the metacells. Note that the order of the metacells within the 'hclust' object is not necessarily the same as the order of the metacells in the input metacells object. Use the 'labels' slot in order to infer it (see examples).

Examples

if (FALSE) {
mat <- get_rna_marker_matrix(atac_mc)
hc <- mc_hclust_rna(atac_mc)
mat <- mat[, hc$labels[hc$order], drop = FALSE]
gene_ord <- order(apply(mat, 1, which.max))
mat <- mat[gene_ord, , drop = FALSE]
plot_rna_markers_mat(mat, atac_mc@metadata, atac_mc@metadata, col_names = F)
}