proteometer.barcode#

Functions#

plot_barcode() → matplotlib.axes.Axes)

Plot a color-coded barcode.

get_barcode(→ list[matplotlib.typing.ColorType])

Get a color-coded barcode for a given DataFrame of fold changes.

plot_pept_barcode(→ matplotlib.axes.Axes)

Plot the barcode of a protein with fold changes at tryptic peptide level.

plot_site_barcode(→ matplotlib.figure.Figure)

Plot the barcode of a protein with fold changes at lytic site level.

Module Contents#

proteometer.barcode.plot_barcode(pal: collections.abc.Collection[matplotlib.typing.ColorType], ticklabel: list[str] | None = None, barcode_name: str | None = None, ax: matplotlib.axes.Axes | None = None, size: tuple[int, int] = (10, 2)) matplotlib.axes.Axes[source]#

Plot a color-coded barcode.

Parameters:
  • pal (Collection[ColorType]) – A collection of colors for the barcode.

  • ticklabel (list[str] | None, optional) – Labels for the ticks on the x-axis. Defaults to None.

  • barcode_name (str | None, optional) – Name label for the barcode on the y-axis. Defaults to None.

  • ax (Axes | None, optional) – Matplotlib Axes object to draw the barcode on. If None, a new Axes is created. Defaults to None.

  • size (tuple[int, int], optional) – Size of the figure (width, height). Defaults to (10, 2).

Returns:

The matplotlib Axes object with the plotted barcode.

Return type:

Axes

proteometer.barcode.get_barcode(fc_bar: pandas.DataFrame, color_levels: int = 20, fc_bar_max: float | None = None) list[matplotlib.typing.ColorType][source]#

Get a color-coded barcode for a given DataFrame of fold changes.

Parameters:
  • fc_bar (pd.DataFrame) – DataFrame with columns “FC_DIFF”, “FC_TYPE”, and “Res”.

  • color_levels (int, optional) – Number of colors in the palette. Defaults to 20.

  • fc_bar_max (float | None, optional) – Maximum fold change value. Defaults to None.

Returns:

A list of colors for the barcode.

Return type:

list[ColorType]

proteometer.barcode.plot_pept_barcode(pept_df: pandas.DataFrame, pairwise_ttest_name: str, sequence: str, max_vis_fc: float = 3.0, color_levels: int = 20, sig_type: str = 'adj-p', sig_thr: float = 0.05, ax: matplotlib.axes.Axes | None = None) matplotlib.axes.Axes[source]#

Plot the barcode of a protein with fold changes at tryptic peptide level.

When peptides overlap, the one with the largest effect size (fold change over significance value) is shown.

Parameters:
  • pept_df (pd.DataFrame) – DataFrame with peptide-level data.

  • pairwise_ttest_name (str) – Name of the column with pairwise t-test p-values.

  • sequence (str) – The sequence of the protein.

  • output_file_name (str | None, optional) – If not None, save the figure to the given file. Defaults to None.

  • max_vis_fc (float, optional) – The maximum fold change value to visualize. Defaults to 3.0.

  • color_levels (int, optional) – The number of colors in the palette. Defaults to 20.

  • sig_type (str, optional) – The type of significance test. Defaults to “pval”.

  • sig_thr (float, optional) – The significance threshold. Defaults to 0.05.

  • ax (Axes | None, optional) – Matplotlib Axes object to draw the barcode on. If None, a new Axes is created. Defaults to None.

Returns:

The matplotlib Axes object with the plotted barcode.

Return type:

Axes

proteometer.barcode.plot_site_barcode(site_df: pandas.DataFrame, pairwise_ttest_name: str, sequence: str, output_file_name: str | None = None, uniprot_id: str = 'Protein ID (provided by user)', max_vis_fc: float = 3.0, color_levels: int = 20, site_type_col: str = 'Type', sig_type: str = 'pval', sig_thr: float = 0.05) matplotlib.figure.Figure[source]#

Plot the barcode of a protein with fold changes at lytic site level.

Parameters:
  • site_df (pd.DataFrame) – DataFrame with site-level data.

  • sequence (str) – The sequence of the protein.

  • pairwise_ttest_name (str) – Name of the column with pairwise t-test p-values.

  • output_file_name (str | None, optional) – If not None, save the figure to the given file. Defaults to None.

  • uniprot_id (str, optional) – The UniProt ID of the protein. Defaults to “Protein ID (provided by user)”.

  • max_vis_fc (float, optional) – The maximum fold change value to visualize. Defaults to 3.0.

  • color_levels (int, optional) – The number of colors in the palette. Defaults to 20.

  • site_type_col (str, optional) – The column name for site type. Defaults to “Lytic site type”.

  • sig_type (str, optional) – The type of significance test. Defaults to “pval”.

  • sig_thr (float, optional) – The significance threshold. Defaults to 0.05.

Returns:

The matplotlib Figure object with the plotted barcode.

Return type:

Figure

Raises:

ValueError – If there is no trypsin or prok data.