fe17dd46857f2bcad6df02174d7c37a5757615e7 angie Fri Oct 15 13:48:12 2010 -0700 Code review suggestion from Larry: errAbort if input has start==end items, but -allowStartEqualEnd not specified (thanks!). diff --git src/hg/bedIntersect/bedIntersect.c src/hg/bedIntersect/bedIntersect.c index c077021..127fb12 100644 --- src/hg/bedIntersect/bedIntersect.c +++ src/hg/bedIntersect/bedIntersect.c @@ -81,10 +81,15 @@ bed->score = lineFileNeedNum(lf, row, 4); if (bed->start > bed->end) errAbort("start after end line %d of %s", lf->lineIx, lf->fileName); - if (allowStartEqualEnd && bed->start == bed->end) + if (bed->start == bed->end) + { + if (allowStartEqualEnd) // Note we are tweaking binKeeper coords here, so use bed->start and bed->end. binKeeperAdd(bk, max(0, bed->start-1), bed->end+1, bed); else + lineFileAbort(lf, "start==end (if this is legit, use -allowStartEqualEnd)"); + } + else binKeeperAdd(bk, bed->start, bed->end, bed); } lineFileClose(&lf); @@ -138,6 +143,8 @@ int end = lineFileNeedNum(lf, row, 2); if (start > end) errAbort("start after end line %d of %s", lf->lineIx, lf->fileName); + if (start == end && !allowStartEqualEnd) + lineFileAbort(lf, "start==end (if this is legit, use -allowStartEqualEnd)"); struct binKeeper *bk = hashFindVal(bHash, chrom); if (bk != NULL) {