f7f5b164d6bacfd8da9b8f7772497ef971f2b0f8 galt Fri Dec 19 11:37:31 2025 -0800 Add options -chrom -start -end -range -bed -positions -udcDir to bigMafToMaf. Adds -positions to bigBedToBed. Moved parsePosition and parseRange routines into common.c so they could be shared with these and other utilities. -range has one 0-based start on commandline. -positions is a file with a list of 1-based starts. fixes #28109 diff --git src/hg/lib/hdb.c src/hg/lib/hdb.c index 74dc75fbf87..0ebe588d47d 100644 --- src/hg/lib/hdb.c +++ src/hg/lib/hdb.c @@ -5325,56 +5325,30 @@ if (position == NULL) return NULL; if (hgParseChromRangeLong(NULL, position, &chromName, &winStart, &winEnd)) { sprintLongWithCommas(num1Buf, winStart + 1); sprintLongWithCommas(num2Buf, winEnd); safef(buffer, sizeof(buffer), "%s:%s-%s",chromName, num1Buf, num2Buf); } else safecpy(buffer, sizeof(buffer), position); return buffer; } -boolean parsePosition(char *position, char **retChrom, uint *retStart, uint *retEnd) -/* If position is word:number-number (possibly with commas & whitespace), - * set retChrom, retStart (subtracting 1) and retEnd, and return TRUE. - * Otherwise return FALSE and leave rets unchanged. */ -{ -char *chrom = cloneString(position); -stripChar(chrom, ','); -eraseWhiteSpace(chrom); -char *startStr = strchr(chrom, ':'); -if (startStr == NULL) - return FALSE; -*startStr++ = '\0'; -char *endStr = strchr(startStr, '-'); -if (endStr == NULL) - return FALSE; -*endStr++ = '\0'; -if (!isAllDigits(startStr)) - return FALSE; -if (!isAllDigits(endStr)) - return FALSE; -*retChrom = chrom; -*retStart = sqlUnsigned(startStr) - 1; -*retEnd = sqlUnsigned(endStr); -return TRUE; -} - static struct grp* loadGrps(char *db, char *confName, char *defaultTbl) /* load all of the grp rows from a table. The table name is first looked up * in hg.conf with confName. If not there, use defaultTbl. If the table * doesn't exist, return NULL */ { if (trackHubDatabase(db)) return trackHubLoadGroups(db); struct grp *grps = NULL; char query[128]; char *tbl = cfgOption(confName); struct slName *tables = NULL, *table; if (tbl == NULL) tbl = defaultTbl;