Unify predict_peptides_dataframe schema with predict_proteins_dataframe (fixes #193) - #197
Merged
Merged
Conversation
predict_peptides_dataframe (deprecated) returned the legacy BindingPrediction schema — missing predictor_version, kind, value, and using prediction_method_name instead of predictor_name. Meanwhile predict_proteins_dataframe / predict_dataframe emit the canonical mhctools.pred.COLUMNS schema. The asymmetry forced downstream consumers that treat predictions from either path uniformly (e.g. topiary's CachedPredictor design) to None-fill the missing identity columns. Fix: predict_peptides_dataframe now delegates to predict_dataframe, so both batch-dataframe paths emit the same columns. This is a schema change on an already-deprecated method. Callers that relied on the old legacy columns (affinity, prediction_method_name, length) should migrate to the canonical names (value, predictor_name) and add predictor_version / kind.
iskandr
added a commit
that referenced
this pull request
Apr 15, 2026
predict_peptides_dataframe now emits the canonical COLUMNS schema (matching predict_proteins_dataframe / predict_dataframe). This is a schema change on a deprecated method, hence the minor-version bump.
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.
Fixes #193.
Summary
`predict_peptides_dataframe` (deprecated) emitted the legacy `BindingPrediction` schema — missing `predictor_version`, `kind`, `value` and using `prediction_method_name` instead of `predictor_name`. `predict_proteins_dataframe` and `predict_dataframe` already emit the canonical `mhctools.pred.COLUMNS` schema.
Fix: `predict_peptides_dataframe` now delegates to `predict_dataframe`, so both batch-dataframe paths emit identical columns.
Schema before → after
Before (peptides path):
```
source_sequence_name, offset, peptide, allele,
score, affinity, percentile_rank,
prediction_method_name, length
```
After (peptides path, matches proteins path):
```
sample_name, peptide, n_flank, c_flank,
source_sequence_name, offset,
predictor_name, predictor_version,
allele, kind, score, value, percentile_rank
```
Breaking change
This is a schema change on an already-deprecated method. Downstream callers that relied on the old column names need to migrate:
New columns (`sample_name`, `n_flank`, `c_flank`, `predictor_version`, `kind`) populate with empty strings or inherited values, as they already do in the proteins path.
Requires a minor bump — I'll tag this 3.13.0.
Test plan