diffsvg.pl.plot_cluster_curves#
- diffsvg.pl.plot_cluster_curves(adata, cluster_key='dsvg_cluster_average', curves=None, clusters=None, standardize=None, curves_key='dsvg_curves', profiles_key='dsvg_profiles', ncols=3, figsize=(4, 3.2), show_legend=True, dpi=300, save_path=None)#
One curve plot per cluster, with the fitted curve of each gene overlaid in its own colour.
- Parameters:
- adata
Annotated data matrix that
diffsvg.tl.cluster_curveswrote into.- cluster_key default:
'dsvg_cluster_average' The clustering, i.e.
key_addedofdiffsvg.tl.cluster_curves.- curves default:
None Which curves to draw:
"combined": one curve per gene, the mean of the two condition curves. Forby="profile", and for labels that did not come fromdiffsvg.tl.cluster_curves, thediffsvg.tl.fit_profilesfit if there is one."conditions": two panels per cluster, one per condition, in a shared y-range and with the same gene colours."difference": the difference curvef1 - f0.A condition label, e.g.
"SHH": that condition’s curve only, one panel per cluster.
Defaults to the curves the clustering compared:
"difference"forby="interaction", otherwise"combined".- clusters default:
None Clusters to draw, by default all of them.
- standardize default:
None Per gene:
"none"(expression as fitted),"center"(mean removed, so levels do not separate the curves; the clustering does not see levels either) or"zscore"(also unit variance). With two panels the mean and variance are taken over both, so the gap between the conditions stays visible. Defaults to"zscore"if the clustering scaled the genes, otherwise"center".- curves_key default:
'dsvg_curves' Prefixes passed to
diffsvg.tl.fit_model/diffsvg.tl.fit_profiles.- profiles_key default:
'dsvg_profiles' Prefixes passed to
diffsvg.tl.fit_model/diffsvg.tl.fit_profiles.- ncols default:
3 Panels per row. With
curves="conditions"a row always holds one cluster, so this is ignored.- figsize default:
(4, 3.2) (width, height)of a single panel in inches.- show_legend default:
True Name the genes in a legend, per cluster. Colours repeat only between clusters, not within one.
- dpi default:
300 Resolution used when saving to
save_path.- save_path default:
None If given, save the figure here (
bbox_inches="tight").
- Returns:
An array of
matplotlib.axes.Axes, row by row: one panel per cluster, or two withcurves="conditions". Each gene is a line labelled with its name.
Examples
>>> dvg.tl.cluster_curves(adata, by="interaction", n_clusters=4) >>> dvg.pl.plot_cluster_curves(adata, "dsvg_cluster_interaction", curves="conditions")