Fix: calibration refactoring and bug fixes#221
Open
JemmaLDaniel wants to merge 7 commits into
Open
Conversation
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.
Summary
Ports calibration and dataset bug fixes from
revisions, plus a refactor that de-duplicates peptide tokenisation, validity flags and match columns across data loaders.Changes
Shared peptide metadata (
data_loaders/utils.py)normalize_peptide_cell,is_valid_peptide_tokens,as_token_list,finalize_peptide_metadata(pandas + polars).has_ground_truth_sequence_labels-- asequencecolumn with only empty/null values is treated as unlabelled; column is dropped at load.labelled_training_mask/require_labelled_rowsfor rows withvalid_sequence=True.Data loaders
_evaluate_predictions/ tokenization paths; callfinalize_peptide_metadatainstead.valid_prediction/valid_sequencewhen loading saved datasets that predate those columns.Supervised paths exclude invalid ground truth
Rows still get
correct=Falseand features, but do not enter fit curves whenvalid_sequence=False:ProbabilityCalibrator.fitDatabaseGroundedFDRControl.fitvalid_sequence,num_matches,correcton all rowsresolve_diagnostics_labelsfilter_dataset(main.py)valid_predictionwhen present, elseis_valid_peptide_tokensStandalone bug fixes
save_metadatasupports.parquetcalibration_dataset.pytokens_to_proformapeptide.pysequenceat spectrum loadutils.load_spectrum_dataretention_time.pymass_error.pyReviewer Notes
We dual-implement
finalize_peptide_metadatabecause loaders are mid-migration: MZTab is polars through load/merge; InstaNovo and Winnow are still pandas at the merge boundary;CalibrationDatasetis pandas end-to-end. Shared cell-level helpers guarantee identical behaviour; the polars/pandas wrappers are thin adapters so we don’t force premature conversion or block this PR on a full loader rewrite.I would suggest merging #220 , #218 and #219 before this PR.