scirpy.pl.clonotype_imbalance
- scirpy.pl.clonotype_imbalance(adata, replicate_col, groupby, case_label, *, control_label=None, target_col='clone_id', additional_hue=None, top_n=10, fraction=None, inplace=True, plot_type='box', key_added='clonotype_imbalance', xlab='log2FoldChange', ylab='-log10(p-value)', title='Volcano plot', **kwargs)
Aims to find clonotypes that are the most enriched or depleted in a category.
Uses Fischer’s exact test to rank clonotypes. Depends on execution of clonotype_overlap. Adds two dataframes (pval and logFC for clonotypes; abundance of clonotypes per sample) to
uns
Warning
This is an experimental function that will likely change in the future.
- Parameters
- adata :
AnnData
AnnData object to work on.
- replicate_col :
str
Column with batch or sample labels.
- groupby :
str
The column containing categories that we want to compare and find imbalance between
- case_label :
str
The label in
groupby
column that we want to compare.- control_label :
str
|None
Optional
[str
] (default:None
) The label in
groupby
column that we use as a baseline for comparison. If not set (None by default), all labels that are not equal tocase_label
make up the baseline.- target_col :
str
(default:'clone_id'
) The clusters (clonotypes by default) that are imbalanced.
- additional_hue :
None
|str
|bool
Union
[None
,str
,bool
] (default:None
) An additional grouping factor. If the
case_label
was tumor for example, this could help make a distinction between imbalance in lung and colorectal tumors.- top_n :
int
(default:10
) The number of top clonotypes to be visualized.
- fraction :
None
|str
|bool
Union
[None
,str
,bool
] (default:None
) If
True
, compute fractions of abundances relative to thegroupby
column rather than reporting abosolute numbers. Alternatively, a column name can be provided according to that the values will be normalized or an iterable providing cell weights directly. Setting it toFalse
orNone
assigns equal weight to all cells.- plot_type : {‘volcano’, ‘box’, ‘bar’, ‘strip’}
Literal
[‘volcano’, ‘box’, ‘bar’, ‘strip’] (default:'box'
) Whether a volcano plot of statistics or a box/bar/strip plot of frequencies should be shown.
- inplace :
bool
(default:True
) Whether results should be added to
uns
or returned directly.- key_added :
str
(default:'clonotype_imbalance'
) If the tools has already been run, the results are added to
uns
under this key.- **kwargs
Additional arguments passed to the base plotting function.
- adata :
- Return type
- Returns
Axes object