Skip to content

feat: script to annotate proteome hits onto winnow outputs#220

Open
JemmaLDaniel wants to merge 4 commits into
mainfrom
feat-proteome-hit-annotation
Open

feat: script to annotate proteome hits onto winnow outputs#220
JemmaLDaniel wants to merge 4 commits into
mainfrom
feat-proteome-hit-annotation

Conversation

@JemmaLDaniel

@JemmaLDaniel JemmaLDaniel commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a post-winnow predict utility that annotates prediction outputs with a proteome_hit column by matching peptides against a reference FASTA proteome.

The command drops short peptides (default: fewer than 7 tokeniser residues), strips modifications and normalises I/L for matching, then uses Aho-Corasick substring search. It updates preds_and_fdr_metrics.csv in place and filters metadata.csv to the retained spectra.

The resulting proteome_hit column is designed to feed winnow diagnose-calibration via diagnostics.label_source=precomputed diagnostics.label_column=proteome_hit.

Changes

  • New library module winnow/scripts/annotate_proteome_hits.py holding the matching logic (FASTA loading, modification stripping, residue tokenisation, batched substring search, folder annotation).
  • New CLI subcommand winnow annotate-proteome-hits on the main Typer app in winnow/scripts/main.py, following the existing lazy-import pattern..
  • Tokenisation uses instanovo.utils.residues.ResidueSet.tokenize.
  • biopython and pyahocorasick are added as an optional proteome extra (pip install 'winnow-fdr[proteome]'), not as core dependencies. Their imports are lazy and guarded, so the base install and winnow.scripts.main remain importable without the extra.
  • Documentation for the new command and the [proteome] extra added to docs/cli.md.
  • Unit tests in tests/scripts/test_annotate_proteome_hits.py covering modification stripping, short-peptide filtering, the cross-protein separator guarantee, residue token counting edge cases, and a full folder round-trip.

@JemmaLDaniel JemmaLDaniel self-assigned this Jul 1, 2026
@JemmaLDaniel JemmaLDaniel added the enhancement New feature or request label Jul 1, 2026
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

Coverage

Coverage Report
FileStmtsMissCoverMissing
__init__.py00100% 
data_types.py40100% 
calibration
   __init__.py00100% 
   calibration_features.py90100% 
   calibrator.py1021189%69–70, 72, 107, 134–135, 137, 163, 168, 195–196
   diagnostics.py1685070%70, 96, 101, 111, 115, 137, 146, 203–218, 261–262, 266, 307, 309–324, 335–341
calibration/features
   __init__.py100100% 
   base.py80100% 
   beam.py470100% 
   chimeric.py82198%213
   constants.py90100% 
   fragment_match.py78198%203
   mass_error.py67297%16, 20
   retention_time.py135993%183, 190, 206, 257–259, 269, 272–273
   sequence.py190100% 
   token_score.py37197%82
   utils.py261398%96, 368, 594
compat
   __init__.py00100% 
   instanovo.py10640%12, 14–15, 17, 24–25
datasets
   __init__.py00100% 
   calibration_dataset.py1091784%155, 169, 171, 173, 183, 196, 249, 251–252, 258–261, 263–266
   interfaces.py30100% 
   psm_dataset.py250100% 
datasets/data_loaders
   __init__.py50100% 
   instanovo.py1191984%90, 93, 119, 142, 168–169, 172–174, 176–177, 179, 182–183, 185, 343–345, 356
   mztab.py2155574%103, 106, 157, 161, 210–211, 223, 236–240, 287, 290, 302–303, 315–317, 319–320, 322, 324, 330, 334–336, 338–339, 343–346, 350, 514–515, 518, 521, 528, 542–546, 550–555, 561, 570–571, 573, 599
   pointnovo.py70100% 
   utils.py59198%11
   winnow.py39489%54–55, 91–92
fdr
   __init__.py00100% 
   base.py581574%81, 85–86, 91, 98–99, 105, 126, 129–130, 135, 137–138, 144, 186
   database_grounded.py27196%54
   nonparametric.py25484%62, 68–69, 72
scripts
   __init__.py00100% 
   annotate_proteome_hits.py1101289%33, 40, 53, 63, 68, 72, 103, 151, 153, 157, 159, 172
   main.py2792790%8, 10–14, 17–21, 24–25, 27–29, 33, 40, 45, 48, 54, 56–57, 60, 69, 77, 80, 87, 89–91, 93, 95–100, 103, 105–106, 111, 126, 129, 136–142, 145–146, 149, 162–164, 167, 170, 175, 177–179, 181, 183–184, 187–188, 191, 193–194, 196, 198, 200–201, 203, 206–207, 210–211, 214–215, 218–220, 222–225, 228–230, 232, 235, 249–251, 253, 255, 260, 262–264, 266–267, 269, 271–272, 274–276, 278, 280, 282–283, 287–290, 292–293, 295–296, 298–299, 301, 304, 318–320, 323, 326, 331, 333–335, 337–339, 341–342, 345–346, 349, 351–352, 354, 356, 358–359, 361, 364–365, 371–373, 375–378, 381–382, 385–386, 389–390, 393–394, 402–404, 408, 411, 415, 418, 424–426, 428–429, 436–437, 439, 441, 446, 448–450, 452–453, 456, 458–459, 461–464, 466–467, 469–470, 472–474, 480–481, 485–486, 489, 496, 501–502, 507–509, 512, 517, 527, 534, 536, 540, 542–543, 547–548, 551, 574, 587–588, 591, 613, 625–626, 629, 654, 667–668, 671, 686, 698–699, 702, 704–707, 710, 725, 729, 731–732, 737, 739–741, 747–748, 754–756, 765, 777, 812, 820, 835, 847–848, 851, 863, 875–876, 879, 894, 906–907, 910, 919, 931–932
utils
   __init__.py40100% 
   config_formatter.py534024%29, 37–38, 40–42, 44, 55, 58–60, 62–63, 66–69, 72–74, 77–78, 80, 91, 102, 113, 127–128, 130–132, 145–147, 150, 153–154, 157–158, 160
   config_path.py76593%24–26, 117–118
   peptide.py160100% 
TOTAL227553676% 

Tests Skipped Failures Errors Time
442 0 💤 0 ❌ 0 🔥 37.933s ⏱️

@JemmaLDaniel
JemmaLDaniel force-pushed the feat-proteome-hit-annotation branch from a20cd15 to 055b975 Compare July 17, 2026 10:44
@JemmaLDaniel
JemmaLDaniel force-pushed the feat-proteome-hit-annotation branch from 055b975 to edc01f8 Compare July 17, 2026 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant