""" Single source of truth for the canonical STXBP1 reference protein. DO NOT hardcode the sequence anywhere else. All STXBP1 fold scripts, validators, manifest builders, and stub generators MUST import from here. Source: NCBI NM_003165.6 -> NP_003156.1 (translation), confirmed 2026-04-24. This is the protein product ClinVar reports against — verified by: * NCBI esummary returns hgvs_p positions up to 604 for STXBP1 variants * 10 ClinVar variants exist at positions 595-604, impossible on a 594-aa frame * Direct mRNA translation: CDS starts at nt 128, terminates at first stop after 1809 nt, producing 603 amino acids ending in TPTKFLMDLRHPDFRESSRVSFEDQAPTME Note: UniProt P61764-1 (their canonical) is 594 aa with a different C-terminal splice isoform. The 594-aa version is NOT what ClinVar uses. Do not use it. History: Session 96 (2026-04-24): discovered original ARIA STXBP1 dataset was folded against a 586-aa NON-Munc18-1 protein. First rebuild attempt used 594-aa P61764-1 (also wrong for ClinVar variants 583-604). Final rebuild uses the 603-aa NM_003165.6 translation (this file). """ from __future__ import annotations import hashlib from pathlib import Path # Canonical 603-aa STXBP1 protein (NM_003165.6 -> NP_003156.1) STXBP1_WT_603 = ( "MAPIGLKAVVGEKIMHDVIKKVKKKGEWKVLVVDQLSMRMLSSCCKMTDIMTEGITIVED" "INKRREPLPSLEAVYLITPSEKSVHSLISDFKDPPTAKYRAAHVFFTDSCPDALFNELVK" "SRAAKVIKTLTEINIAFLPYESQVYSLDSADSFQSFYSPHKAQMKNPILERLAEQIATLC" "ATLKEYPAVRYRGEYKDNALLAQLIQDKLDAYKADDPTMGEGPDKARSQLLILDRGFDPS" "SPVLHELTFQAMSYDLLPIENDVYKYETSGIGEARVKEVLLDEDDDLWIALRHKHIAEVS" "QEVTRSLKDFSSSKRMNTGEKTTMRDLSQMLKKMPQYQKELSKYSTHLHLAEDCMKHYQG" "TVDKLCRVEQDLAMGTDAEGEKIKDPMRAIVPILLDANVSTYDKIRIILLYIFLKNGITE" "ENLNKLIQHAQIPPEDSEIITNMAHLGVPIVTDSTLRRRSKPERKERISEQTYQLSRWTP" "IIKDIMEDTIEDKLDTKHYPYISTRSSASFSTTAVSARYGHWHKNKAPGEYRSGPRLIIF" "ILGGVSLNEMRCAYEVTQANGKWEVLIGSTHILTPTKFLMDLRHPDFRESSRVSFEDQAP" "TME" ) CANONICAL_REFERENCE = "NP_003156.1" CANONICAL_TRANSCRIPT = "NM_003165.6" CANONICAL_LENGTH = 603 CANONICAL_FIRST_10 = "MAPIGLKAVV" # PINNED full-sequence SHA-256 (computed once at file commit; never derive at runtime). # If a future edit changes the sequence by even one character, the assert below # fails loudly at module import — much stronger than the 6-residue spot check. CANONICAL_SHA256_PINNED = "f09d3d8cab1a46153031896bab6713a241b2eabd497cb2d354285d3a87756e6c" # Derived hash for downstream code that needs to embed it in JSON / manifests. CANONICAL_SHA256 = hashlib.sha256(STXBP1_WT_603.encode("utf-8")).hexdigest() CANONICAL_BUILD_DATE = "2026-04-24" # Sanity residues — used in validators to confirm the right protein loaded SANITY_RESIDUES = { 196: "K", # K196X most-common nonsense 292: "R", # R292H most-frequent missense 251: "A", # A251P known pathogenic 550: "M", # within the agreement zone (1-575) 583: "R", # within the divergence zone (576-603) — caught the 594/603 bug 603: "E", # absolute C-terminus } def assert_canonical() -> None: """Run module-load sanity checks. If something replaced our sequence with a different one, fail loudly at import time. The full-sequence SHA-256 pin is the strongest check — would catch even a single-character change anywhere in the 603 aa, including the 546-aa sibling sequence Claude flagged that coincidentally has K at position 196 (which would silently pass the 6-residue spot check).""" # Strongest check: full sequence SHA must match the pinned constant. actual_sha = hashlib.sha256(STXBP1_WT_603.encode("utf-8")).hexdigest() assert actual_sha == CANONICAL_SHA256_PINNED, ( f"STXBP1 canonical sequence SHA-256 mismatch.\n" f" Expected (pinned): {CANONICAL_SHA256_PINNED}\n" f" Got (actual): {actual_sha}\n" f" Someone modified STXBP1_WT_603 in this file. Restore from git or " f"D:/STXBP1_datasets/STXBP1_CANONICAL_603.txt before continuing." ) # Belt-and-suspenders: length + first-10 + 6-residue spot check assert len(STXBP1_WT_603) == CANONICAL_LENGTH, \ f"Sequence length {len(STXBP1_WT_603)} != {CANONICAL_LENGTH}" assert STXBP1_WT_603[:10] == CANONICAL_FIRST_10, \ f"First 10 residues {STXBP1_WT_603[:10]} != {CANONICAL_FIRST_10}" for pos, expected in SANITY_RESIDUES.items(): actual = STXBP1_WT_603[pos - 1] assert actual == expected, \ f"Position {pos}: got {actual}, expected {expected}" # Run sanity check at import — fail fast if anyone tampers with the sequence assert_canonical() if __name__ == "__main__": print(f"STXBP1 Canonical Reference") print(f" Accession: {CANONICAL_REFERENCE}") print(f" Transcript: {CANONICAL_TRANSCRIPT}") print(f" Length: {CANONICAL_LENGTH} aa") print(f" SHA256: {CANONICAL_SHA256}") print(f" First 10: {CANONICAL_FIRST_10}") print(f" Last 10: {STXBP1_WT_603[-10:]}") print(f" Build date: {CANONICAL_BUILD_DATE}") print() print(f"Sanity residues:") for pos, expected in SANITY_RESIDUES.items(): actual = STXBP1_WT_603[pos - 1] ok = "OK" if actual == expected else "FAIL" print(f" [{pos}] expected {expected}, got {actual} {ok}")