static boolean isAdjacentFrames(struct exonFrames *ef0, struct exonFrames *ef1) /* check if exonFrames objects are adjacent and should be joined. ef0 preceeds * ef1 in the direction of transcription. Must be i */ { if (ef0->mf.strand[0] == '+') return (ef1->mf.chromStart == ef0->mf.chromEnd) && (ef1->mf.frame == frameIncr(ef0->mf.frame, (ef0->mf.chromEnd-ef0->mf.chromStart))); else return (ef1->mf.chromEnd == ef0->mf.chromStart) && (ef1->mf.frame == frameIncr(ef0->mf.frame, (ef0->mf.chromEnd-ef0->mf.chromStart))); }
static boolean isSplitCodon(struct exonFrames *ef0, struct exonFrames *ef1) /* Determine if the last codon of ef0 is split across maf blocks and is * continued in ef1. If codon is not split, or only partially aligned, false * is returned. ef0 preceeds ef1 in the direction of transcription */ { int tLen0 = ef0->mf.chromEnd - ef0->mf.chromStart; if (ef1->cdsStart != ef0->cdsEnd) return FALSE; /* deletion in gene between two records */ if (frameIncr(ef0->mf.frame, tLen0) == 0) return FALSE; /* codon not split */ if (ef1->mf.frame != frameIncr(ef0->mf.frame, tLen0)) return FALSE; /* frame not contiguous */ return TRUE; }
static struct codonCoords findLastCodon(struct genePred *gp, int *frames) /* get the coordinates of the last codon (start or stop). It must be in * correct frame, or zero is returned. */ { if (honorCdsStat && (gp->optFields & genePredCdsStatFld) && (gp->cdsEndStat != cdsComplete)) return zeroCodonCoords; // not flagged as complete // find last CDS exon int iExon, cdsStart = 0, cdsEnd = 0; for (iExon = gp->exonCount-1; iExon >= 0; iExon--) { if (genePredCdsExon(gp, iExon, &cdsStart, &cdsEnd)) break; } if (iExon == -1) return zeroCodonCoords; // no CDS // get frame of last base and validate that we are on a bound. int frame = (gp->strand[0] == '-') ? frames[iExon] : frameIncr(frames[iExon], (cdsEnd-cdsStart)); if (frame != 0) return zeroCodonCoords; // not on a frame boundary /* get last part of codon */ struct codonCoords codon = zeroCodonCoords; codon.start= codon.start1 = max(cdsStart, cdsEnd-3); codon.end = codon.end1 = cdsEnd; codon.iExon1 = iExon; /* first part, if spliced */ if ((codon.end1 - codon.start1) < 3) { codon.start2 = codon.start1; codon.end = codon.end2 = codon.end1; codon.iExon2 = iExon; iExon--; codon.iExon1 = iExon; if ((iExon == -1) || !genePredCdsExon(gp, iExon, &cdsStart, &cdsEnd)) return zeroCodonCoords; // no more int needed = 3 - (codon.end2 - codon.start2); if ((cdsEnd - cdsStart) < needed) return zeroCodonCoords; // not enough space codon.start = codon.start1 = cdsEnd-needed; codon.end1 = cdsEnd; } return codon; }