swiftcnv.plot_cnv_by_sample#
- plot_cnv_by_sample(adata, cell_type_key='cell_type', group_key='sample', cnv_key='cnv_mat_arms', split_by='malignant_classif', continuous_var='malignant_score', highlight_arms=None, cluster_cells=True, figsize=(20, 12), cmap='RdBu_r', score_cmap='Reds', sample_name=None, vmin=None, vmax=None, vcenter=0, threads=2, save_pdf=None)#
Plot the classification results alongside the CNV heatmap for each sample with cell type annotations.
- Parameters:
adata (anndata.AnnData) – Input AnnData object.
cell_type_key (str, default 'cell_type') – Key of the obs layer where cell annotations are stored.
group_key (str, default 'sample') – Key of the obs layer used to group and generate each individual heatmap.
cnv_key (str, default 'cnv_mat_arms') – Key of
adata.obsmwith the matrix to plot.split_by (str, default 'malignant_classif') – Key of the obs layer used to divide each heatmap.
continuous_var (str, default 'malignant_score') – Key of the obs layer saving continuous scores that will be displayed as right colorbars in the heatmap.
highlight_arms (dict, default None) – Dictionary with the sample names as keys and the hotspot chromosome arms to highlight as values.
cluster_cells (bool, default True) – Whether to cluster cells or not.
figsize (tuple, default (20, 12)) – Tuple defining the width and height of the matplotlib figure.
cmap (str or Colormap, default 'RdBu_r') – Colormap used for the main CNV heatmap.
score_cmap (str or Colormap, default 'Reds') – Colormap used to plot continuous variables.
sample_name (str or list, default None) – Name of the sample(s) to plot. If None, all the samples will be displayed.
vmin (float, optional) – Minimum data value that corresponds to the colormap’s lower limit.
vmax (float, optional) – Maximum data value that corresponds to the colormap’s upper limit.
vcenter (float, default 0) – The center value for the continuous colormap.
threads (int, default 2) – Number of threads to use when clustering cells.
save_pdf (str, optional) – Output filename to save the plot as a PDF.
- Returns:
Returns None after displaying the plot or saving to
save_pdf.- Return type:
None