Skip to content

fix/ipf for low quality data#214

Merged
singjc merged 7 commits into
PyProphet:masterfrom
singjc:split/ipf-experimental
Jun 18, 2026
Merged

fix/ipf for low quality data#214
singjc merged 7 commits into
PyProphet:masterfrom
singjc:split/ipf-experimental

Conversation

@singjc

@singjc singjc commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

This pull request introduces new configuration options and enhancements for the IPF (Inferred PeptidoForm) workflow, focusing on improved filtering, grouped FDR strategies, and additional metadata extraction. The changes primarily add new CLI/configuration parameters, extend SQL queries to support new filters, and enhance the metadata available for transitions. These updates provide users with more control over post-IPF filtering and enable richer downstream analysis.

IPF configuration and CLI enhancements:

  • Added new configuration options and CLI arguments for IPF:

    • ipf_grouped_fdr_strategy to select the grouping strategy for grouped FDR (currently only "num_peptidoforms" supported).
    • ipf_min_supporting_transitions to filter inferred peptidoforms by the minimum number of supporting transitions.
    • ipf_min_peakgroup_intensity to filter inferred peptidoforms by minimum MS2 peakgroup area intensity.
      [1] [2] [3] [4]
  • Updated the CLI and configuration parsing to accept and propagate the new parameters throughout the pipeline. [1] [2] [3] [4]

Database query and data extraction improvements:

  • Extended SQL queries in both DuckDB and SQLite readers to optionally join FEATURE_MS2 and extract intensity values when ipf_min_peakgroup_intensity is set, including validation for table existence. [1] [2] [3] [4] [5] [6] [7] [8] [9]

  • Enhanced transition-level metadata extraction:

    • Added a query to extract the number of mapped peptides per transition and a flag for phospho loss transitions (using the ANNOTATION column if present).
    • Merged this metadata with the main transition dataframe for richer downstream filtering or analysis.
      [1] [2] [3]

Other improvements:

  • Refactored the glycoform feature mapping function to use a more flexible confidence threshold and updated its SQL query for clarity and robustness.

These changes collectively improve the flexibility, robustness, and analytical power of the IPF pipeline.

Copilot AI review requested due to automatic review settings June 18, 2026 00:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 extends the IPF (Inferred PeptidoForm) workflow to better handle low-quality data by adding new post-IPF filtering capabilities, enhancing transition/precursor metadata extraction (including optional MS2 intensity), and improving grouped FDR computation options.

Changes:

  • Added post-IPF filtering metrics + filtering logic (supporting transitions, optional MS2 peakgroup intensity) and improved Bayesian model numerical stability (log-space + evidence clipping).
  • Extended OSW/Parquet/DuckDB readers to optionally extract MS2 intensity and additional transition metadata (mapped-peptide counts, phospho-loss flag, isotope overlap when available).
  • Added new CLI/config options for grouped FDR strategy and post-IPF filtering thresholds.

Reviewed changes

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

Show a summary per file
File Description
tests/test_ipf.py Adds unit tests for log-space BM behavior and new post-IPF filtering/metrics helpers.
pyprophet/ipf.py Implements grouped-FDR helper, log-space BM option, post-IPF filter metrics + filtering, and wires filters into infer_peptidoforms.
pyprophet/io/ipf/split_parquet.py Adds optional intensity extraction and enriches transition metadata pulled from split Parquet inputs.
pyprophet/io/ipf/parquet.py Adds optional intensity extraction and enriches transition metadata pulled from Parquet inputs.
pyprophet/io/ipf/osw.py Adds optional FEATURE_MS2 join for intensity and enriches transition metadata (mapped peptides + phospho-loss).
pyprophet/glyco/glycoform.py Refactors across-run feature mapping query to use candidate alignments + a confidence threshold.
pyprophet/cli/ipf.py Adds CLI options for grouped FDR strategy and post-IPF filtering thresholds.
pyprophet/_config.py Plumbs new CLI/config parameters into IPFIOConfig.
.gitignore Ignores tools/* and normalizes docs ignore entries.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pyprophet/ipf.py Outdated
import numpy as np
import pandas as pd
from loguru import logger
from scipy.special import expit, logsumexp
Comment thread pyprophet/cli/ipf.py
Comment on lines +51 to +57
@click.option(
"--ipf_grouped_fdr_strategy",
default="num_peptidoforms",
show_default=True,
type=click.Choice(["num_peptidoforms"]),
help="Grouping strategy used when --ipf_grouped_fdr is enabled.",
)
Comment thread pyprophet/glyco/glycoform.py Outdated


def get_feature_mapping_across_runs(infile, ipf_max_alignment_pep=1):
def get_feature_mapping_across_runs(infile, min_confidence=0.5):
Comment thread pyprophet/glyco/glycoform.py Outdated
Comment on lines +37 to +42
FROM FEATURE_MS2_ALIGNMENT_CANDIDATE
WHERE SELECTED = 1
AND MAPPING_CONFIDENCE >= ?
AND REFERENCE_FEATURE_ID != ALIGNED_FEATURE_ID
AND ALIGNED_FEATURE_ID != -1

@singjc singjc merged commit d678739 into PyProphet:master Jun 18, 2026
1 check passed
@singjc singjc deleted the split/ipf-experimental branch June 18, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants