46da73e7e18e0ee3f4299ae70d4359bfa1600f23 angie Fri Sep 27 17:27:02 2013 -0700 Code review feedback, thanks Tim.refs #11800 diff --git src/lib/annoStreamVcf.c src/lib/annoStreamVcf.c index 33a8e2c..7496f8e 100644 --- src/lib/annoStreamVcf.c +++ src/lib/annoStreamVcf.c @@ -251,44 +251,47 @@ nextPosQShouldBeEmpty(self); self->nextPosQ = asvCloneForQ(self, nextRow); return asvPopQ(&self->indelQ, sSelf, callerLm); } else // Another indel at same position -- queue it up and keep looking. // I expect very few of these, so addTail OK slAddTail(&self->indelQ, asvCloneForQ(self, nextRow)); } else // nextRow is first indel at this position -- queue it up and keep looking. self->indelQ = asvCloneForQ(self, nextRow); } else // i.e. nextRow is non-indel { - // Coords are not apples-to-apples, so having the same start means let indels go first: + // Coords are not apples-to-apples: having the same annoRow->start means + // that the indel VCF starts are one less than the non-indel VCF starts, + // so let indels go first: if (self->indelQ != NULL && self->indelQ->start <= nextRow->start) { // nextRow is a non-indel at a subsequent *VCF* base; store in nextPosQ & pop indelQ nextPosQShouldBeEmpty(self); self->nextPosQ = asvCloneForQ(self, nextRow); return asvPopQ(&self->indelQ, sSelf, callerLm); } else // No indelQ, or nextRow is a non-indel at the same *VCF* base (but prior UCSC base); // use it now (BTW I expect this to be the common case): return nextRow; } } +nextPosQShouldBeEmpty(self); if (nextRow == NULL) { if (self->indelQ != NULL) return asvPopQ(&self->indelQ, sSelf, callerLm); else return NULL; } errAbort("annoStreamVcf %s: how did we get here?", sSelf->name); return NULL; // avoid compiler warning } static void asvClose(struct annoStreamer **pVSelf) /* Close VCF file and free self. */ { if (pVSelf == NULL)