.n_peptides_per_sample

proteopy.pl.n_peptides_per_sample(adata, *, layer=None, zero_to_na=False, level=None, percentage=False, ascending=None, order_by=None, order=None, group_by=None, print_stats=False, figsize=(6.0, 4.0), color_scheme=None, title=None, ylabel=None, xlabel_rotation=90, order_by_label_rotation=0, show=True, ax=None, save=None)

Plot the number of detected peptides per sample.

For each sample (observation), counts the number of peptides with non-missing values. Requires peptide-level proteodata.

Parameters:
  • adata (AnnData) – AnnData object in proteodata format.

  • layer (str or None, optional) – Key in adata.layers; when set, uses that layer instead of .X.

  • zero_to_na (bool, optional) – If True, zeros in the matrix are treated as missing values.

  • percentage (bool, optional) – Display y-axis values as a percentage of total variables instead of raw counts.

  • ascending (bool or None, optional) – Sort observations by detected counts. True places lower counts to the left; False places higher counts to the left; None preserves the existing observation order.

  • order_by (str or None, optional) – Column in adata.obs used for grouping and colouring bars.

  • order (Sequence[str] or None, optional) – Controls ordering and subsetting on the x-axis. Without group_by or order_by it lists observation names. With order_by it specifies the group order. With group_by it specifies the group order for the bar chart.

  • group_by (str or None, optional) – Column in adata.obs used to summarise observations into groups. When provided, a mean +/- std bar chart is shown. Mutually exclusive with order_by.

  • print_stats (bool, optional) – Print summary statistics as a DataFrame.

  • figsize (tuple of float, optional) – Figure size (width, height) in inches passed to matplotlib.pyplot.subplots().

  • color_scheme (Union[str, dict, Sequence, Colormap, callable, None]) – Colour mapping for groups. Accepts a named Matplotlib colormap, a single colour, a list/tuple of colours, a dict mapping labels to colours, a Colormap, or a callable.

  • title (str or None, optional) – Plot title.

  • ylabel (str or None, optional) – Label for the y-axis.

  • xlabel_rotation (float, optional) – Rotation in degrees applied to x-axis tick labels.

  • order_by_label_rotation (float, optional) – Rotation in degrees applied to group labels drawn above the plot.

  • show (bool, optional) – Call matplotlib.pyplot.show() when True.

  • ax (Axes or None, optional) – Matplotlib Axes to plot onto. If None, a new figure and axes are created.

  • save (str or Path or None, optional) – File path to save the figure.

Returns:

The Matplotlib Axes object used for plotting.

Return type:

Axes

Examples

>>> import proteopy as pr
>>> adata = pr.datasets.williams_2018()
>>> pr.pl.n_peptides_per_sample(adata)

Show mean +/- std per group:

>>> pr.pl.n_peptides_per_sample(
...     adata,
...     group_by="tissue",
... )
Note:

This function is a partial of n_var_per_sample, with the following arguments fixed: level=’peptide’.