Repository navigation
fix(ptm): map each UniProt site through a transcript encoding its isoform; classify on the codon's three bases - #489
Conversation
…form; classify on the codon's three bases #486: map_ptm_sites placed every UniProt position on one transcript per protein, the MANE Select one when cross-referenced, whatever isoform it encodes, and read MOD_RES features numbered on a non-canonical isoform as canonical positions. Such sites landed on the wrong codon with no error (95 of 1,098 sites in a 123-gene sample). The UniProt download now also fetches cc_alternative_products, records the isoform a site is numbered on (`isoform`, empty for the canonical sequence) and keeps in `ensembl_xrefs` only the transcripts whose isoformId is that sequence. Those sites never fall back to the gene's MANE Select transcript; with no matching transcript they fail as `unresolved`. A site on a non-canonical isoform is written with that isoform as `uniprot_id` and no `amino_acid`. PTMBuildResult.failure_counts and `ptm build`'s summary give the failed sites per reason. A UniProt TSV without the `isoform` column is refused. PeptideAtlas and CPTAC rows keep the gene_mane path. #487: the mapper computed a codon's three bases but kept only their min and max, and the three consumers each guessed the rest: annotate_variants_with_ptm took codon_start..+2 (the splice-donor base, never the base in the next exon), annotate_variants_by_symbol took codon_start..codon_end (the whole intron), and the training-set codon join took the two ends. The sites table now carries codon_pos1..3 (transcript order); all three classify on them, with the window measured from the nearest base, which is unchanged for a contiguous codon. A sites table without them is refused with a message to rebuild it. Verified on live UniProt and Ensembl 113: ETS1 Thr38 and Ser251 land on the codons of residues 82 and 295 of the MANE protein, CDK9 Ser35 (P50750-2) is dropped, RBM10's P98175-5 sites map through the transcript encoding P98175-5, and GATA4 Lys300 moves off the MANE codon. For GLI1 Ser130 both classifiers call chr12:57465111 a site and the splice-donor base chr12:57464869 proximal.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
|
ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing |
…d release 2026_04 The probe fingerprints the download's TSV columns and the response's entry keys; this PR adds the isoform column and the comments key (cc_alternative_products). UniProt also moved from 2026_03 to 2026_04, so the rebuild-ledger row records the dataset as needing a rebuild.
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| Documentation | 7 minor |
🟢 Metrics 33 complexity
Metric Results Complexity 33
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Fixes #486 and #487. Both proposals are trimmed to what changes results; the sections below say what was left out and why.
#486: a UniProt site maps through a transcript encoding its isoform
map_ptm_sitesplaced every UniProt position on one transcript per protein (the MANE Select one when UniProt cross-references it) whatever isoform that transcript encodes, and read MOD_RES features numbered on a non-canonical isoform as canonical positions. Those sites landed on the wrong codon with no error.cc_alternative_products(which isoform is canonical) and adds anisoformcolumn: empty for a site on the canonical sequence, the isoform's id (P98175-5) otherwise. A row'sensembl_xrefskeeps only the transcripts whose cross-referenceisoformIdis that sequence.amino_acidcomes from the canonical sequence, so it is left empty for a non-canonical site.unresolved. A non-canonical site is written with its isoform asuniprot_id, so(uniprot_id, residue_pos)stays unique (the per-source overlap inplot.pykeys on it).PTMBuildResult.failure_countsand aFailed:line inptm build's summary give the failed sites per reason (unresolved,beyond_cds).isoformis refused with a message to download it again, since some of its sites would land on another isoform's codon.gene_manepath; the docs now say when that is right.Left out: the protein-FASTA download, sequence alignment and residue check. UniProt already says which transcript encodes which isoform, and using that fixes both causes, including the 8 sites in the issue's sample that encode the same residue on the wrong codon, which no residue check can catch. Sites whose isoform has no transcript are dropped rather than rescued by alignment.
#487: classify on the codon's three bases
The mapper computed a codon's three bases and kept only their min and max, and each consumer reconstructed the codon differently:
annotate_variants_with_ptm(annotate,landscape,population)codon_start..+2: took in the splice-donor base, missed the base in the next exonannotate_variants_by_symbolcodon_start..codon_end: the whole intron wassitecodon_sites)The sites table now carries
codon_pos1..codon_pos3(transcript order), and all three read them. The window is every position within the flank of one of the bases: identical to before for a contiguous codon, and no longer spanning the intron for a split one. A sites table without these fields is refused with a message to rebuild it.Left out: counting
--flanking-codonsalong the CDS. It needs transcript structure at annotate time; the docs keep saying the window is counted in genomic bases.Verification
unresolved.site, the splice-donor base chr12:57464869 isproximal, the middle of the intron is non-PTM. A contiguous codon keeps the same site and window positions.test_ptm.py: the round-trip test now covers a split codon (TP53 residue 25). One new regression test runs the UniProt parser and mapper on an entry whose MANE transcript encodes another isoform; it fails when cross-references are left unfiltered.pytest --require-round-tripslocally: everything passes except 4 tests inpqtl(caplogcomes back empty after earlier tests), which fail identically ondevand pass alone; CI ondevis green.After merge
Rebuild
uniprot-ptm:sites, anyptm buildtable, and training sets with aptm_sitecolumn (the ClinVar x heart example).