ms2pip.result

Definition and handling of MS²PIP results.

class ms2pip.result.ProcessingResult(*, psm_index, psm, theoretical_mz=None, predicted_intensity=None, observed_intensity=None, correlation=None, feature_vectors=None)[source]

Bases: BaseModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config = {'arbitrary_types_allowed': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

as_spectra()[source]

Convert result to predicted and observed spectra.

Return type:

tuple[PredictedSpectrum | None, ObservedSpectrum | None]

plot_spectra()[source]

Plot predicted and observed spectra.

Return type:

matplotlib.axes.Axes

Notes

Requires optional dependency spectrum_utils to be installed.

ms2pip.result.calculate_correlations(results)[source]

Calculate and add Pearson correlations to list of results.

Parameters:

results (list[ProcessingResult])

Return type:

None

ms2pip.result.write_correlations(results, output_file)[source]

Write correlations to CSV file.

Parameters:
Return type:

None