PeptideIdentificationList#

class pyopenms.PeptideIdentificationList(*args, **kwargs)#

Bases: object

A container for peptide identifications from multiple spectra. This class provides a vector-like interface for managing collections of peptide identifications, typically obtained from tandem mass spectrometry experiments or peptide database searches. Each PeptideIdentification represents the identification results from a single spectrum. This class supports direct iteration in Python.

__init__(self, arg: collections.abc.Sequence[pyopenms._pyopenms_kernel.PeptideIdentification], /) → None#
__init__(self, arg: std::initializer_list<OpenMS::PeptideIdentification>, /) → None
__init__(self) → None

Overloaded function.

  1. __init__(self, arg: collections.abc.Sequence[pyopenms._pyopenms_kernel.PeptideIdentification], /) -> None

  2. __init__(self, arg: std::initializer_list<OpenMS::PeptideIdentification>, /) -> None

  3. __init__(self) -> None

Default constructor - creates an empty list

Methods

df_columns([decode_ontology])

Returns a list of column names that to_df() would produce.

get_df(*args, **kwargs)

Deprecated: Use to_df() instead.

get_psm_columns(*args, **kwargs)

Deprecated: Use psm_columns() instead.

get_psm_df(*args, **kwargs)

Deprecated: Use to_psm_df() instead.

iter_peptide_identification_views()

Yields live views of the identifications, one at a time (see peptide_identification_view).

peptide_identification_views()

Returns a list of live views of the identifications (see peptide_identification_view).

psm_columns()

EXPERIMENTAL: Return list of column names that to_psm_df() and to_qpx() produce.

to_arrow([decode_ontology, ...])

Returns an Apache Arrow Table with peptide identification information.

to_df([decode_ontology, ...])

Converts peptide identifications to a pandas DataFrame.

to_parquet(path[, compression, ...])

EXPERIMENTAL: Export all PSMs to a Parquet file using native Arrow construction.

to_psm_arrow([export_all_hits, ...])

EXPERIMENTAL: Export all PSMs as Apache Arrow Table.

to_psm_df([export_all_hits, ...])

EXPERIMENTAL: Export all PSMs (Peptide-Spectrum Matches) as a DataFrame.

to_psm_qpx(*args, **kwargs)

EXPERIMENTAL: Export PSMs as QPX format structure with file metadata and PSMs array.

to_qpx([qpx_version, creator, ...])

EXPERIMENTAL: Export PSMs as QPX format structure with file metadata and PSMs array.

update_scores_from_df(df, main_score_name)

Updates scores in PeptideIdentification objects from a DataFrame.

Attributes

append

Add a peptide identification (alias for push_back)

at

Returns a copy of the element at index (with bounds checking)

back

Returns a copy of the last element

clear

Clear all identifications

empty

Returns True if the list is empty

extend

Overloaded function.

front

Returns a copy of the first element

peptide_identification_view

Returns a live view of the identification at index i.

push_back

Add a peptide identification

size

Returns the number of peptide identifications

append#

Add a peptide identification (alias for push_back)

at#

Returns a copy of the element at index (with bounds checking)

back#

Returns a copy of the last element

clear#

Clear all identifications

df_columns(decode_ontology=True)#

Returns a list of column names that to_df() would produce.

Parameters:

decode_ontology – Decode meta value names using the PSI-MS ontology.

Returns:

List of column name strings.

empty#

Returns True if the list is empty

extend#

Overloaded function.

  1. extend(self, other: pyopenms._pyopenms_metadata.PeptideIdentificationList) -> None

Extend with items from another PeptideIdentificationList

  1. extend(self, items: list) -> None

Extend with items from a Python list

front#

Returns a copy of the first element

get_df(*args, **kwargs)#

Deprecated: Use to_df() instead.

get_psm_columns(*args, **kwargs)#

Deprecated: Use psm_columns() instead.

get_psm_df(*args, **kwargs)#

Deprecated: Use to_psm_df() instead.

iter_peptide_identification_views()#

Yields live views of the identifications, one at a time (see peptide_identification_view).

peptide_identification_view#

Returns a live view of the identification at index i. The view aliases this object’s storage: edits through it are visible immediately, and it stays valid only until the identification list is resized or reordered. The parent object is kept alive automatically. For an owned copy use peps[i].

peptide_identification_views()#

Returns a list of live views of the identifications (see peptide_identification_view).

psm_columns()#

EXPERIMENTAL: Return list of column names that to_psm_df() and to_qpx() produce.

Returns:

List of column name strings.

push_back#

Add a peptide identification

size#

Returns the number of peptide identifications

to_arrow(decode_ontology=True, default_missing_values=None, export_unidentified=True, columns=None)#

Returns an Apache Arrow Table with peptide identification information.

to_df(decode_ontology=True, default_missing_values=None, export_unidentified=True, columns=None)#

Converts peptide identifications to a pandas DataFrame.

Parameters:
  • decode_ontology – Decode meta value names using the PSI-MS ontology.

  • default_missing_values – Default values for missing data by type.

  • export_unidentified – Export PeptideIdentifications without PeptideHit.

  • columns – List of column names to include. If None, includes all.

Returns:

DataFrame with peptide identification information.

to_parquet(path, compression='zstd', compression_level=None, row_group_size=None, write_statistics=True, export_all_hits=True, include_modifications=True, include_peak_annotations=False, reference_file_name='', columns=None, additional_score_names=None, scan_format='scan')#

EXPERIMENTAL: Export all PSMs to a Parquet file using native Arrow construction.

Parameters:
  • path – Path to the output Parquet file.

  • compression – Compression algorithm (‘none’, ‘snappy’, ‘gzip’, ‘lz4’, ‘zstd’).

  • compression_level – Compression level (ZSTD: 1-22, GZIP: 1-9).

  • row_group_size – Number of rows per row group.

  • write_statistics – Write column statistics.

  • export_all_hits – If True, export all hits per identification.

  • include_modifications – Include modification details.

  • include_peak_annotations – Include fragment ion annotations.

  • reference_file_name – Source file name to include.

  • columns – Column names to include. None includes all.

  • additional_score_names – Additional metavalue names to treat as scores.

  • scan_format – Controls scan column format.

to_psm_arrow(export_all_hits=True, include_modifications=True, include_peak_annotations=False, reference_file_name='', columns=None, additional_score_names=None, scan_format='scan')#

EXPERIMENTAL: Export all PSMs as Apache Arrow Table.

This method builds the Arrow table directly without pandas intermediate, making it more memory-efficient for large datasets.

Parameters:
  • export_all_hits – If True, export all hits per identification.

  • include_modifications – Include detailed modification list column.

  • include_peak_annotations – Include fragment ion annotations.

  • reference_file_name – Source file name to include in each row.

  • columns – List of column names to include. If None, includes all.

  • additional_score_names – List of additional metavalue names to treat as scores.

  • scan_format – Controls scan column: “scan” or “nativeId”.

Returns:

Arrow Table with PSM data.

to_psm_df(export_all_hits=True, include_modifications=True, include_peak_annotations=False, reference_file_name='', columns=None, additional_score_names=None, scan_format='scan')#

EXPERIMENTAL: Export all PSMs (Peptide-Spectrum Matches) as a DataFrame.

Unlike to_df() which exports only the top hit per spectrum, this method exports all hits with proper ranking information, modifications, and additional scores.

Parameters:
  • export_all_hits – If True, export all hits per identification.

  • include_modifications – Include detailed modification list column.

  • include_peak_annotations – Include fragment ion annotations.

  • reference_file_name – Source file name to include in each row.

  • columns – List of column names to include. If None, includes all.

  • additional_score_names – List of additional metavalue names to treat as scores.

  • scan_format – Controls scan column: “scan” or “nativeId”.

Returns:

DataFrame with PSM data.

to_psm_qpx(*args, **kwargs)#

EXPERIMENTAL: Export PSMs as QPX format structure with file metadata and PSMs array.

This is an alias for to_qpx().

to_qpx(qpx_version='1.1', creator='pyOpenMS', software_provider='OpenMS', scan_format='scan', **kwargs)#

EXPERIMENTAL: Export PSMs as QPX format structure with file metadata and PSMs array.

Parameters:
  • qpx_version – Version of the QPX format. Default “1.1”.

  • creator – Name of the tool or person who created the file.

  • software_provider – Name of the software provider.

  • scan_format – Controls the scan column format.

Returns:

Dict with ‘file_metadata’ and ‘psms’ keys following QPX schema.

update_scores_from_df(df, main_score_name)#

Updates scores in PeptideIdentification objects from a DataFrame.