Skip to content

AlphaPept Protein Group Reader - #327

Merged
lucas-diedrich merged 86 commits into
pg-reader-3-diannfrom
pg-reader-4-alphapept
Aug 26, 2025
Merged

AlphaPept Protein Group Reader#327
lucas-diedrich merged 86 commits into
pg-reader-3-diannfrom
pg-reader-4-alphapept

Conversation

@lucas-diedrich

Copy link
Copy Markdown
Collaborator

Implements the protein group reader for AlphaPept protein group reports. This is the first reader that requires regex logic for reading.

Key challenges are that alphapept dataframes do not contain a name in the feature column and that feature names are extracted from custom fasta headers, i.e. it is difficult to parse the feature names.

  • Implements a custom _pre_process logic that supports standard uniprot + ensembl entries.
  • The parsing logic is implemented in a class-specific function _parse_alphapept_index, which is tested based on the examples provided in the example data.

@lucas-diedrich
lucas-diedrich requested a review from Copilot August 1, 2025 07:59
@lucas-diedrich lucas-diedrich added the enhancement New feature or request label Aug 1, 2025

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a new protein group reader for AlphaPept search engine outputs, enabling the parsing of AlphaPept protein group reports with custom regex-based protein identifier parsing.

  • Adds AlphaPeptPGReader class with custom preprocessing logic for parsing protein identifiers from FASTA headers
  • Extends the protein group column schema to support Ensembl IDs, source databases, and decoy indicators
  • Implements comprehensive test coverage for the new reader functionality

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
alphabase/pg_reader/alphapept_pg_reader.py Main implementation of AlphaPept reader with regex-based protein identifier parsing
alphabase/pg_reader/keys.py Extends column schema with new fields for Ensembl IDs, source DB, and decoy indicators
alphabase/pg_reader/pg_reader.py Modifies base reader to handle cases where no feature columns are specified
alphabase/constants/const_files/pg_reader.yaml Configuration for AlphaPept reader with default measurement regex
alphabase/pg_reader/__init__.py Exports the new AlphaPept reader class
tests/unit/pg_reader/test_alphapept_pg_reader.py Comprehensive unit tests for protein identifier parsing logic
tests/integration/test_pg_readers.py Integration tests for file import functionality
tests/integration/test_pg_reader_provider.py Tests for reader provider integration
tests/integration/conftest.py Test fixture for AlphaPept example data

Comment thread alphabase/pg_reader/alphapept_pg_reader.py
Comment thread alphabase/pg_reader/alphapept_pg_reader.py Outdated
Comment thread tests/unit/pg_reader/test_alphapept_pg_reader.py
@lucas-diedrich

Copy link
Copy Markdown
Collaborator Author
  • Question: How to handle REV sequences

Currently, reverse (decoy) sequences are marked with a designated flag (is_decoy), and the respective database entries are marked with a REV__ prefix. However, IDs (uniprot IDs, ensembl IDs) and names are left unchanged. Is this desirable?

Example

# REV__sp|Q13085|ACACA_HUMAN
{"source_db": "REV__sp", "uniprot_ids": "Q13085", "ensembl_ids": "na", "proteins": "ACACA_HUMAN", "is_decoy": True}

@lucas-diedrich

Copy link
Copy Markdown
Collaborator Author

Added functionality to pre-configure regular expressions:

Configuration in pg_reader.yaml:

alphapept:
  ...
  measurement_regex:
    raw: "^.*(?<!_LFQ)$"
    lfq: "_LFQ$"

Usage

Get available pre-configured regular expressions:

AlphaPeptPGReader.get_preconfigured_regex()
 > {'raw': '^.*(?<!_LFQ)$', 'lfq': '_LFQ$'}

Read

reader = AlphaPeptPGReader(measurement_regex="lfq")
results = reader.import_file(...)
# reads LFQ values

@lucas-diedrich lucas-diedrich self-assigned this Aug 12, 2025
Comment thread alphabase/constants/const_files/pg_reader.yaml Outdated
Comment thread alphabase/constants/const_files/pg_reader.yaml
Comment thread alphabase/pg_reader/alphapept_pg_reader.py Outdated
Comment thread alphabase/pg_reader/alphapept_pg_reader.py
Comment thread alphabase/pg_reader/alphapept_pg_reader.py Outdated
Comment thread alphabase/pg_reader/keys.py
Comment thread alphabase/pg_reader/pg_reader.py
Comment thread requirements/requirements.txt
Comment thread tests/integration/conftest.py
Comment thread tests/unit/pg_reader/test_alphapept_pg_reader.py
@lucas-diedrich

Copy link
Copy Markdown
Collaborator Author

Added explicit equivalence test in integration testing.

lucas-diedrich and others added 27 commits August 23, 2025 12:11
… reports which are also exported in parquet format
@lucas-diedrich
lucas-diedrich merged commit 8fe61f9 into pg-reader-3-diann Aug 26, 2025
3 checks passed
@lucas-diedrich
lucas-diedrich deleted the pg-reader-4-alphapept branch August 26, 2025 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants