atlas.pl.plot_trends#
- atlas.pl.plot_trends(mudata, ptf, gene, time_key='pseudotime', fate_probability_key='fate_probabilities', branches=None, sharex=False, n_splines=8, n_points=200, order=1, save=None)#
Plot branch-specific dynamics of transcription factor expression and gene activity.
This function fits branch-specific Generalized Additive Models (GAMs) using
pygam.pygam.LinearGAMand visualizes smooth trends along pseudotime for a transcription factor (TF) and a target gene. Each lineage (branch) is modeled independently using fate probabilities as weights.For each branch, the function displays the fitted GAM curve together with its confidence interval.
- Parameters:
mudata (
MuData) – MuData object containing gene expression and gene activity modalities.ptf (
str) – Name of the transcription factor inmudata["rna"].var_names.gene (
str) – Name of the gene inmudata["activity"].var_names.time_key (
str(default:'pseudotime')) – Key inmudata.obscontaining pseudotime values.fate_probability_key (
str(default:'fate_probabilities')) – Key inmudata.obsmcontaining fate probabilities for each branch.branches (
list|str|None(default:None)) – Subset of branches to plot. IfNone, all available branches are shown.sharex (
bool(default:False)) – Whether to share the x-axis (pseudotime) between the two subplots.n_splines (
int(default:8)) – Number of spline basis functions used in the GAM.n_points (
int(default:200)) – Number of points used to evaluate the fitted curves.order (
int(default:1)) – Currently unused parameter reserved for future extensions.save (
str|None(default:None)) – If provided, saves the figure tofigures/trends_<save>.pngin the current working directory.
- Return type:
- Returns:
None The function generates a matplotlib figure and optionally saves it.