96a25fe3da2d004c86d950b5a316fc7f1dc4e404 angie Fri Oct 4 13:07:42 2013 -0700 f8bcbbee didn't go far enough to completely fix #11787 -- I forgot toaccount for changing chromosomes. fixes #11787 refs #11775 diff --git src/lib/annoStreamVcf.c src/lib/annoStreamVcf.c index dd32f9a..fe37ed7 100644 --- src/lib/annoStreamVcf.c +++ src/lib/annoStreamVcf.c @@ -245,52 +245,55 @@ return asvPopQ(&self->nextPosQ, sSelf, callerLm); } else // eof return NULL; } struct annoRow *nextRow = NULL; while ((nextRow = nextRowFiltered(self, minChrom, minEnd, callerLm)) != NULL) { // nextRow has been allocated with callerLm; if we save it for later, we need a clone in qLm. // If we're popping a row from qLm, we need to clone back to the (probably new) callerLm. if (vcfAnnoRowIsIndel(nextRow)) { if (self->indelQ != NULL) { // Coords are apples-to-apples (both indels), look for strict ordering: - if (self->indelQ->start < nextRow->start) + if (self->indelQ->start < nextRow->start + || differentString(self->indelQ->chrom, nextRow->chrom)) { // Another indel, but at some subsequent base -- store in nextPosQ & pop indelQ 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: 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) + if (self->indelQ != NULL + && (self->indelQ->start <= nextRow->start + || differentString(self->indelQ->chrom, nextRow->chrom))) { // 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) {