46c1bc52a2a4bfe0402c3436058d42acc34ddfe7 markd Thu Mar 6 14:41:18 2014 -0800 commit 5a7542dced0497f6d08a503a95eba87619b23a8aAuthor: Mark Diekhans Date: Wed Mar 5 19:35:34 2014 -0800 Fixed bug in GTF to genePred conversion where an assertion was triggered when the GTF had a spliced stop codon where the exon containing the first part of the stop codon only consisted of the stop codon bases. For example, a two-base exon where with two bases are the first two bases of the stop codon. This commit handle negative strand case. diff --git src/hg/lib/genePred.c src/hg/lib/genePred.c index 45a3828..e015343 100644 --- src/hg/lib/genePred.c +++ src/hg/lib/genePred.c @@ -550,31 +550,32 @@ if (!((gp->exonFrames[iExon] < 0) || (gp->exonFrames[iExon] == frame))) errAbort("conflicting frame for %s exon index %d, was %d, trying to assign %d", gp->name, iExon, gp->exonFrames[iExon], frame); gp->exonFrames[iExon] = frame; frame = incrFrame(gp->exonFrames[iExon], (gp->exonEnds[iExon]-gp->exonStarts[iExon])); } } static void extendFrameNeg(struct genePred *gp) /* extend frame missing from last exon(s) for negative strand genes, normally * caused by GTF stop_codon */ { int iExon = findLastFramedExon(gp); int frame = incrFrame(gp->exonFrames[iExon], (gp->exonEnds[iExon]-gp->exonStarts[iExon])); for (iExon--; (iExon >= 0) && (gp->exonEnds[iExon] > gp->cdsStart); iExon--) { - assert(gp->exonFrames[iExon] < 0); + if (!((gp->exonFrames[iExon] < 0) || (gp->exonFrames[iExon] == frame))) + errAbort("conflicting frame for %s exon index %d, was %d, trying to assign %d", gp->name, iExon, gp->exonFrames[iExon], frame); gp->exonFrames[iExon] = frame; frame = incrFrame(gp->exonFrames[iExon], (gp->exonEnds[iExon]-gp->exonStarts[iExon])); } } static void fixStopFrame(struct genePred *gp) /* Handle nasty corner case: GTF with the all or part of the stop codon as the * only codon in an exon, we must set the frame on these exons. Some ENSEMBL * GTFs have single base `exons' with just a base of the stop codon, so must * check every base. While less than ideal, we just extend the frame past the * last exon with frame, so a conflicting frame on the stop codon will be * missed. Just switching to GFF3 fixes this mess. */ { if (gp->strand[0] == '+') extendFramePos(gp);