scirpy.pl.clonotype_imbalance

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', airr_mod='airr', **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 (Union[AnnData, MuData, DataHandler]) – AnnData or MuData object that contains AIRR information.

  • 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 (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 to case_label make up the baseline.

  • target_col (str (default: 'clone_id')) – The clusters (clonotypes by default) that are imbalanced.

  • additional_hue (Union[str, bool, None] (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 (Union[str, bool, None] (default: None)) – If True, compute fractions of abundances relative to the groupby 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 to False or None assigns equal weight to all cells.

  • plot_type (Literal['volcano', 'box', 'bar', 'strip'] (default: 'box')) – Whether a volcano plot of statistics or a box/bar/strip plot of frequencies should be shown.

  • key_added (str (default: 'clonotype_imbalance')) – If the tools has already been run, the results are added to uns under this key.

  • airr_mod (str (default: 'airr')) – Name of the modality with AIRR information is stored in the MuData object. if an AnnData object is passed to the function, this parameter is ignored.

  • **kwargs – Additional arguments passed to the base plotting function.

Return type:

Axes

Returns:

Axes object