process_snapseed
hnoca.snapseed.process.process_snapseed(adata, marker_dict, ann_df, obs_key='leiden', prefix='snapseed', fill_na=True, base_colormap='tab10', get_colors=True, sample_key=None, min_abs_freq=5, min_rel_freq=0.001, rotation_step=0.05, saturation_adjust=0.2, brightness_adjust=0.1, min_hue_separation=0.05)
Map the cluster assignments of annotate_hierarchy() onto adata.obs, one column per level.
Categories follow the hierarchy depth-first; colors are derived from the parent's color, so that subtypes look like their parent across levels.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adata
|
AnnData
|
AnnData object. |
required |
marker_dict
|
dict
|
The marker hierarchy passed to |
required |
ann_df
|
DataFrame
|
The |
required |
obs_key
|
str
|
Column in |
'leiden'
|
prefix
|
str
|
Prefix for the new columns, named |
'snapseed'
|
fill_na
|
bool
|
Whether clusters without an annotation at a level keep that of the previous (coarser) level. |
True
|
base_colormap
|
str
|
Name of a matplotlib colormap for the top-level categories. |
'tab10'
|
get_colors
|
bool
|
Whether to write colors consistent across levels to |
True
|
sample_key
|
str | None
|
Column in |
None
|
min_abs_freq
|
int | None
|
Minimum number of cells of a category in a sample to retain it. |
5
|
min_rel_freq
|
float | None
|
Minimum fraction of a sample's annotated cells in a category to retain it. |
0.001
|
rotation_step
|
float
|
Step size for hue rotation when generating child colors. |
0.05
|
saturation_adjust
|
float
|
Adjustment factor for saturation (positive to increase, negative to decrease). |
0.2
|
brightness_adjust
|
float
|
Adjustment factor for brightness (positive to increase, negative to decrease). |
0.1
|
min_hue_separation
|
float
|
Minimum separation between hue values of child colors. |
0.05
|
Returns
Nothing; writes `adata.obs["<prefix>_level_<n>"]` and, with `get_colors`, their colors to `adata.uns`.