eweitz / ideogram

Chromosome visualization for the web
https://eweitz.github.io/ideogram
Other
288 stars 72 forks source link

Fix splice bug when 1st UTR and exon exactly align #337

Closed eweitz closed 1 year ago

eweitz commented 1 year ago

This fixes a bug seen upon splicing some RNA diagrams, e.g. by clicking the scissors button.

It occurred when the first UTR subpart is exactly equal in length to the first exon, and that exon subpart is ordered first among subparts in the transcript. The spliced pre-mRNA would could misordered subparts, which would further degrade with each toggle.

Examples:

Altogether, it manifested in 4% of canonical transcripts for protein-coding genes (834 / 20015), and 10% of all protein-coding transcripts (6802 / 70593). It's fixed now, as confirmed by manual and automated tests.

This also fixes an invalid test for a related issue.

Analysis code ```js affecteds = [] canonicalAffecteds = [] all = [] genes = [] Object.entries(ideogram.geneStructureCache).forEach(([geneName, transcripts], i) => { genes.push(geneName) affected = transcripts.find(t => { all.push(t); sp = t.subparts; return sp.length >= 3 && sp[0][0] === 'exon' && sp[2][0] === 'exon' && ["3'-UTR", "5'-UTR"].includes(sp[1][0]); }); if (affected) { affecteds.push(affected); if (affected.name.endsWith('-201')) canonicalAffecteds.push(affected) } }); console.log(`# affected: ${affecteds.length}`) console.log(`# affected canonical: ${canonicalAffecteds.length}`) console.log(`# total transcripts: ${all.length}`) console.log(`# total protein-coding genes: ${genes.length}`) console.log(`% affected: ${100 * affecteds.length / all.length}`) console.log(`% genes with canonical affected: ${100 * canonicalAffecteds.length / genes.length}`) VM24:18 # affected: 6802 VM24:19 # affected canonical: 834 VM24:20 # total transcripts: 70593 VM24:21 # total protein-coding genes: 20015 VM24:22 % affected: 9.635516269318488 VM24:23 % genes with canonical affected: 4.1668748438671 ```
coveralls commented 1 year ago

Coverage Status

Coverage: 86.871% (+3.5%) from 83.356% when pulling c0c254f787b5238037e95270bfde888bd37928a2 on fix-1st-exon-utr-splice into 260a4c4f1188545df41463f8a55d736cca82cc8e on master.