fix/ipf for low quality data#214
Merged
Merged
Conversation
…on and related checks
Contributor
There was a problem hiding this comment.
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.
| import numpy as np | ||
| import pandas as pd | ||
| from loguru import logger | ||
| from scipy.special import expit, logsumexp |
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.", | ||
| ) |
|
|
||
|
|
||
| def get_feature_mapping_across_runs(infile, ipf_max_alignment_pep=1): | ||
| def get_feature_mapping_across_runs(infile, min_confidence=0.5): |
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 | ||
|
|
…e IPF q-value computation with strategy parameter
…into split/ipf-experimental
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_strategyto select the grouping strategy for grouped FDR (currently only "num_peptidoforms" supported).ipf_min_supporting_transitionsto filter inferred peptidoforms by the minimum number of supporting transitions.ipf_min_peakgroup_intensityto 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_MS2and extract intensity values whenipf_min_peakgroup_intensityis set, including validation for table existence. [1] [2] [3] [4] [5] [6] [7] [8] [9]Enhanced transition-level metadata extraction:
ANNOTATIONcolumn if present).[1] [2] [3]
Other improvements:
These changes collectively improve the flexibility, robustness, and analytical power of the IPF pipeline.