Skip to content

Unify predict_peptides_dataframe schema with predict_proteins_dataframe (fixes #193) - #197

Merged
iskandr merged 1 commit into
masterfrom
fix-193-dataframe-schema-parity
Apr 15, 2026
Merged

Unify predict_peptides_dataframe schema with predict_proteins_dataframe (fixes #193)#197
iskandr merged 1 commit into
masterfrom
fix-193-dataframe-schema-parity

Conversation

@iskandr

@iskandr iskandr commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

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:

Legacy Canonical
`affinity` `value`
`prediction_method_name` `predictor_name`
`length` (derive from `len(peptide)`)

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

  • New `tests/test_dataframe_schema_parity.py` — asserts peptides & proteins paths emit identical columns matching `COLUMNS`; asserts predictor identity columns (`predictor_name`, `predictor_version`, `kind`, `value`) are present on peptides path.
  • Full non-integration test suite (`tests/` minus NetMHC*/BigMHC/Pepsickle/IEDB/MixMHCpred integration tests): 163 passed.

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
iskandr merged commit 023f6cc into master Apr 15, 2026
4 checks passed
@iskandr
iskandr deleted the fix-193-dataframe-schema-parity branch April 15, 2026 18:46
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.
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.

predict_peptides_dataframe missing predictor_version / kind / value columns (asymmetric with predict_proteins_dataframe)

1 participant