Skip to content

fix: predictCoding uses CDS-mapped width for exon/intron boundary deletions (#83)#97

Open
jmg421 wants to merge 3 commits into
Bioconductor:develfrom
jmg421:fix/83-exon-intron-boundary-codon
Open

fix: predictCoding uses CDS-mapped width for exon/intron boundary deletions (#83)#97
jmg421 wants to merge 3 commits into
Bioconductor:develfrom
jmg421:fix/83-exon-intron-boundary-codon

Conversation

@jmg421

@jmg421 jmg421 commented Jun 30, 2026

Copy link
Copy Markdown

Summary

A deletion that starts inside an exon and extends into the adjacent intron produced incorrect REFCODON/VARCODON values because the codon extraction logic used the genomic width of the variant instead of the transcript-space width (CDS overlap only).

Example from the issue

chr1:3826659-3826710 (52bp genomic deletion)
Only 37bp overlap exon 16 of ENST00000378230

predictCoding reported a 54-character REFCODON spanning into the next exon and a 3-character VARCODON extending into intron sequence — both wrong.

Root Cause

Two places in methods-predictCoding.R used width(txlocal) (the genomic width of the variant) when they should use width(mcols(txlocal)$CDSLOC) (the width of the variant as mapped to transcript/CDS coordinates):

  1. .getRefCodons()cend calculation extends past the actual CDS overlap
  2. Frameshift detectionrefwidth inflated by intronic bases, causing incorrect mod-3 check

Fix

Replace width(txlocal) with width(mcols(txlocal)$CDSLOC) in both locations. The CDSLOC IRanges represents the variant's position and extent in transcript coordinates (exons only, introns excluded), which is what the codon arithmetic needs.

Fixes #83

vjcitn and others added 3 commits July 17, 2026 21:15
Convert \itemize blocks that used \item{label}{desc} syntax to \describe,
and replace empty \item{}{} labels in \describe blocks with the function
signature from the body, resolving all checkRd warnings in isSNV-methods,
PolyPhenDb-class, readVcf-methods, SIFTDb-class, summarizeVariants-methods,
VariantType-class, VCF-class, VcfFile-class, VCFHeader-class, VRanges-class,
and VRangesList-class Rd files.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…etions (Bioconductor#83)

A deletion starting in an exon and extending into the intron produced
incorrect REFCODON/VARCODON because .getRefCodons() and the frameshift
calculation used the genomic width of the variant rather than the
transcript-space (CDSLOC) width.

For example, a 51bp genomic deletion with only 37bp overlapping the CDS
would compute cend using 51, causing the reference codon to extend
incorrectly into the next exon's sequence.

Fix: replace width(txlocal) (genomic width) with
width(mcols(txlocal)$CDSLOC) (CDS-mapped width) in both:
- .getRefCodons(): codon boundary calculation
- frameshift detection: refwidth for length-change check

Fixes Bioconductor#83
@jmg421
jmg421 force-pushed the fix/83-exon-intron-boundary-codon branch from 1583da3 to 9c8000f Compare July 18, 2026 03:18
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.

Incorrect annotation of exon/intron boundary deletion

2 participants