plot a heatmap of number of cells per metacell and metadata factor (e.g. patient, condition, sample etc.)

mcell_mc_plot_by_factor(
  mc_id,
  meta_field,
  mat_id = mc_id,
  fig_fn = NULL,
  meta_field_annotate_by = NULL,
  meta_field_min_count = 0,
  norm_by_factor = T,
  hclust_mcs = F,
  ord_mcs = NULL,
  filter_values = NULL,
  hclust_values = T,
  custom_made_fields = NULL
)

Arguments

mc_id

id of metacell object ina scdb

meta_field

metdata column name used to break down cells on metacells

mat_id

matrix object to us (default is the mc_id - assuming they use the same ID), if some cells in the mc object are missing from the matrix, the function will generate an error

fig_fn

file name for the figure. Color bars are generated in separate files with names starting with fig_fn. If null figures will be created under <mc_id>.mc_comp_by_<meta_field> directory, with name composed of the plotting parameters.

meta_field_annotate_by

metadata column names describing the meta_field (should be a one-to-one match between each meta_field_value and the values in these columns). Expecting a yaml parameter named mcp_metadata_annot_colors which is a list mapping meta_field_annotate_by values to list of value-color mapping.

meta_field_min_count

Minimal number of cells per meta_field value

norm_by_factor

Normalize cell counts by factor (default) or by metacell

hclust_mcs

If true, re-order metacells by clustering the heatmap. Otherwise, use original metacells ordering (default)

filter_values

vector of meta_field values to display

hclust_values

Hierarchical cluster of value in value-mc matrix

custom_made_fields

project specific metadata fields, that the code handles specifically.