proteobench.plotting.plot_generator_denovo module#

Module for plotting results of de novo models

class proteobench.plotting.plot_generator_denovo.DeNovoPlotGenerator[source]#

Bases: PlotGeneratorBase

Plot generator for de novo sequencing data points. Implements the PlotGeneratorBase interface for consistent module plotting.

generate_in_depth_plots(performance_data: DataFrame, parse_settings: any = None, **kwargs) → Dict[str, Figure][source]#

Generate module-specific in-depth plots.

Parameters:
  • performance_data (pd.DataFrame) – The performance data to plot.

  • parse_settings (any, optional) – Parse settings for the module (not used by de novo, included for signature compatibility).

  • **kwargs (dict) – Additional parameters: - mod_labels: List[str] - list of PTM modification labels - mod_label: str - specific PTM label for detailed plot - feature: str - spectrum feature to plot - evaluation_type: str - evaluation type (“mass” or “exact”)

Returns:

Dictionary mapping plot names to plotly figures.

Return type:

Dict[str, go.Figure]

get_in_depth_metrics_help_markdown() → str[source]#

Return a Markdown explanation of how the in-depth plots are calculated.

Returns:

The Markdown explanation shown in the “How are the metrics calculated?” popover on the in-depth tab.

Return type:

str

get_in_depth_plot_descriptions() → Dict[str, str][source]#

Get descriptions for each in-depth plot.

Returns:

Dictionary mapping plot names to their descriptions.

Return type:

Dict[str, str]

get_in_depth_plot_layout() → list[source]#

Define the layout configuration for displaying plots.

Returns:

List of plot configurations for organizing the UI display.

Return type:

list

get_metrics_help_markdown() → str[source]#

Return a Markdown explanation of how the metrics of the main plot are calculated.

Returns:

The Markdown explanation shown in the “How are the metrics calculated?” popover.

Return type:

str

static get_modification_scores(mod_dict, mod_labels)[source]#
plot_infasta_overview(benchmark_metrics_df: DataFrame) → Figure[source]#

Stacked bar chart of the FASTA-category breakdown (correct / in FASTA / not in FASTA) for each datapoint, one bar per tool. Reads the per-datapoint proportions precomputed by DenovoDatapoint.get_infasta_metrics at benchmarking time (stored under results[“in_depth”][“in_FASTA”]) – never a live groupby over raw intermediate data, which isn’t persisted for a submitted datapoint in the first place.

plot_main_metric(result_df: DataFrame, **kwargs) → Figure[source]#

Generate the main performance metric plot.

Parameters:
  • result_df (pd.DataFrame) – DataFrame containing the results to plot.

  • **kwargs (dict) –

    Additional parameters: - level: str (default “precision”) - metric type (“precision” or “auc”) - evaluation_type: str (default “mass”) - evaluation type (“mass” or “exact”) - allow_il: bool (default True) - under exact evaluation, treat I/L as equivalent - allow_deamidation: bool (default False) - under exact evaluation, treat

    deamidated Q/N as equivalent to E/D

    • colorblind_mode: bool (default False) - whether to use different shapes for software tools

    • software_colors: Dict[str, str] - color mapping for software tools

    • software_markers: Dict[str, str] - marker mapping for software tools (used when colorblind_mode is True)

    • mapping: Dict[str, int] - size mapping for old/new datapoints

    • highlight_color: str - color for highlighted datapoints

    • label: str - label field to display

Returns:

The generated plotly figure for the main performance metric.

Return type:

go.Figure

plot_precision_coverage_curves(result_df: DataFrame, **kwargs) → Figure[source]#

Generate the precision-vs-coverage curve view: peptide-level and amino-acid-level curves side by side, one line per software tool. An alternative to plot_main_metric showing the full threshold-swept curve behind a single-point precision/AUC value, rather than a single-point summary of it.

Parameters:
  • result_df (pd.DataFrame) – DataFrame containing the results to plot.

  • **kwargs (dict) –

    Additional parameters: - evaluation_type: str (default “mass”) - evaluation type (“mass” or “exact”) - allow_il: bool (default True) - under exact evaluation, treat I/L as equivalent - allow_deamidation: bool (default False) - under exact evaluation, treat

    deamidated Q/N as equivalent to E/D

    • software_colors: Dict[str, str] - color mapping for software tools

Returns:

A 1x2 subplot figure: peptide-level curve (left), amino-acid-level curve (right).

Return type:

go.Figure

plot_ptm_overview(benchmark_metrics_df: DataFrame, mod_labels: List[str], software_colors: Dict[str, str] = {'AdaNovo': '#88CCEE', 'Casanovo': '#CC6677', 'ContraNovo': '#882255', 'Custom': '#000000', 'DeepNovo': '#DDCC77', 'InstaNovo': '#999933', 'NovoB': '#4477AA', 'PEAKS': '#661100', 'PepNet': '#117733', 'Pi-HelixNovo': '#332288', 'Pi-PrimeNovo': '#AA4499', 'PointNovo': '#E07030', 'SMSNet': '#44AA99'})[source]#
plot_ptm_specific(benchmark_metrics_df, mod_label, software_colors: Dict[str, str] = {'AdaNovo': '#88CCEE', 'Casanovo': '#CC6677', 'ContraNovo': '#882255', 'Custom': '#000000', 'DeepNovo': '#DDCC77', 'InstaNovo': '#999933', 'NovoB': '#4477AA', 'PEAKS': '#661100', 'PepNet': '#117733', 'Pi-HelixNovo': '#332288', 'Pi-PrimeNovo': '#AA4499', 'PointNovo': '#E07030', 'SMSNet': '#44AA99'})[source]#
plot_species_overview(benchmark_metrics_df, evaluation_type='mass', software_colors={'AdaNovo': '#88CCEE', 'Casanovo': '#CC6677', 'ContraNovo': '#882255', 'Custom': '#000000', 'DeepNovo': '#DDCC77', 'InstaNovo': '#999933', 'NovoB': '#4477AA', 'PEAKS': '#661100', 'PepNet': '#117733', 'Pi-HelixNovo': '#332288', 'Pi-PrimeNovo': '#AA4499', 'PointNovo': '#E07030', 'SMSNet': '#44AA99'})[source]#
plot_species_specific()[source]#
plot_spectrum_feature(benchmark_metrics_df, feature, evaluation_type='mass', software_colors={'AdaNovo': '#88CCEE', 'Casanovo': '#CC6677', 'ContraNovo': '#882255', 'Custom': '#000000', 'DeepNovo': '#DDCC77', 'InstaNovo': '#999933', 'NovoB': '#4477AA', 'PEAKS': '#661100', 'PepNet': '#117733', 'Pi-HelixNovo': '#332288', 'Pi-PrimeNovo': '#AA4499', 'PointNovo': '#E07030', 'SMSNet': '#44AA99'})[source]#
proteobench.plotting.plot_generator_denovo.datapoint_has_required_fields(results_dict: dict, evaluation_type: str, needs_auc: bool, ambiguity_combo: str | None, needs_curve: bool = False) → bool[source]#

Check whether a datapoint’s results dict has the fields the main plot needs for the currently selected evaluation type, metric (precision or AUC), and ambiguity combination.

Used to silently hide datapoints submitted before a given field existed (e.g. auc, curve, or the ambiguity sub-dict) rather than erroring, mirroring the HYE plot generator’s handling of legacy datapoints missing newer metric fields.

proteobench.plotting.plot_generator_denovo.flatten_results_column(df: DataFrame, ambiguity_combo: str | None = None) → DataFrame[source]#

Flatten each row’s nested results dict into flat {level}_{evaluation_type}_{metric} columns for plotting.

Parameters:

ambiguity_combo (str, optional) – One of “il”, “deam”, “both” to read the corresponding exact-mode ambiguity combination instead of the baseline; None (default) reads the baseline. Ignored for mass-mode fields, which don’t have ambiguity combinations (see _get_metrics_leaf).