85b15e64af21551227c0c052b3dcbb65a54225ef hiram Fri Jun 24 15:07:55 2022 -0700 allow binKeeper to work with chr sizes up to 2Gb refs #29545 diff --git src/hg/bedIntersect/bedIntersect.c src/hg/bedIntersect/bedIntersect.c index 8f6f396..b16faf7 100644 --- src/hg/bedIntersect/bedIntersect.c +++ src/hg/bedIntersect/bedIntersect.c @@ -1,19 +1,20 @@ /* bedIntersect - Intersect two bed files. */ /* Copyright (C) 2014 The Regents of the University of California * See kent/LICENSE or http://genome.ucsc.edu/license/ for licensing information. */ +#include <limits.h> #include "common.h" #include "linefile.h" #include "hash.h" #include "options.h" #include "binRange.h" static boolean aHitAny = FALSE; static boolean bScore = FALSE; static float minCoverage = 0.00001; static boolean strictTab = FALSE; static boolean allowStartEqualEnd = FALSE; static struct optionSpec optionSpecs[] = { {"aHitAny", OPTION_BOOLEAN}, @@ -60,31 +61,31 @@ /* Read bed and return it as a hash keyed by chromName * with binKeeper values. */ { char *row[5]; struct lineFile *lf = lineFileOpen(fileName, TRUE); struct hash *hash = newHash(0); int expectedCols = bScore ? 5 : 3; while (lineFileNextRow(lf, row, expectedCols)) { struct binKeeper *bk; struct bed5 *bed; struct hashEl *hel = hashLookup(hash, row[0]); if (hel == NULL) { - bk = binKeeperNew(0, 1024*1024*1024); + bk = binKeeperNew(0, INT_MAX); hel = hashAdd(hash, row[0], bk); } bk = hel->val; AllocVar(bed); bed->chrom = hel->name; bed->start = lineFileNeedNum(lf, row, 1); bed->end = lineFileNeedNum(lf, row, 2); if (bScore) bed->score = lineFileNeedNum(lf, row, 4); if (bed->start > bed->end) errAbort("start after end line %d of %s", lf->lineIx, lf->fileName); if (bed->start == bed->end) { if (allowStartEqualEnd) // Note we are tweaking binKeeper coords here, so use bed->start and bed->end.