SeqMutPlot.residue_mutation_impact

SeqMutPlot.residue_mutation_impact(df_scan, entry=None, *, pos, ax=None, figsize=(6, 5), color=None)[source]

Plot the substitution impact for a single residue across all substitutions.

A bar chart of the per-substitution change at one position — the model prediction shift delta_pred when present, otherwise delta_cpp — showing which target residues move the outcome most at that site.

Parameters:
  • df_scan (pd.DataFrame) – Mutational landscape produced by SeqMut.scan().

  • entry (str, optional) – Protein entry to plot. If None, the first entry in df_scan is used.

  • pos (int) – 1-based residue position to plot.

  • ax (Axes, optional) – Pre-defined Axes object to plot on. If None, a new one is created.

  • figsize (tuple, default=(6, 5)) – Figure dimensions (width, height) in inches (used when ax is None).

  • color (str, optional) – Bar color. If None, the TMD color is used.

Returns:

  • fig (Figure) – Figure object containing the plot.

  • ax (Axes) – Axes object of the residue mutation-impact plot.

Notes

  • Returned as a (fig, ax) pair (see SeqMutPlot for the shared return contract).

Examples

:meth:SeqMutPlot.residue_mutation_impact shows the ΔCPP of every substitution at a single residue.

import matplotlib.pyplot as plt
import aaanalysis as aa
aa.options["verbose"] = False

df_seq = aa.load_dataset(name="DOM_GSEC", n=10)
labels = df_seq["label"].to_list()
sf = aa.SequenceFeature()
df_parts = sf.get_df_parts(df_seq=df_seq)
split_kws = sf.get_split_kws()
cpp = aa.CPP(df_parts=df_parts, split_kws=split_kws, verbose=False)
df_feat = cpp.run(labels=labels, n_filter=25)
aa.plot_settings()
df_scan = aa.SeqMut().scan(df_seq=df_seq, df_feat=df_feat, region="tmd")
row = df_scan.iloc[0]
aa.SeqMutPlot().residue_mutation_impact(df_scan=df_scan, entry=row["entry"], pos=int(row["pos"]))
plt.tight_layout()
plt.show()
CPP using the Python kernel fallback — the compiled Cython extension is not available in this install. Output is bit-exact with the Cython path but ~2x slower. Reinstall via pip install --force-reinstall aaanalysis to fetch a prebuilt wheel.
../_images/seqmut_plot_residue_mutation_impact_1_output_1_1.png