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/genbank.c src/hg/lib/genbank.c index c4b1020da59..8c2458002c1 100644 --- src/hg/lib/genbank.c +++ src/hg/lib/genbank.c @@ -114,31 +114,31 @@ if (!convertCoord(startBuf, &cds->start)) return FALSE; cds->start--; /* convert to zero-based */ return TRUE; } static boolean parseEndCds(char *endBuf, struct genbankCds* cds) /* parse an ending CDS coordinate */ { cds->endComplete = (endBuf[0] != '>'); if (!cds->endComplete) endBuf++; return convertCoord(endBuf, &cds->end); } -static boolean parseRange(char *cdsBuf, struct genbankCds* cds) +static boolean genbankParseRange(char *cdsBuf, struct genbankCds* cds) /* parse a cds range in the for 221..617 */ { char *p1; /* find .. */ p1 = strchr(cdsBuf, '.'); if ((p1 == NULL) || (p1[1] != '.')) return FALSE; /* no .. */ *p1 = '\0'; p1 += 2; if (!parseStartCds(cdsBuf, cds)) return FALSE; return parseEndCds(p1, cds); } @@ -172,56 +172,56 @@ static boolean parseComplement(char *cdsBuf, struct genbankCds* cds) /* parse a complement cds, perhaps recursively parsing a join */ { int len = strlen(cdsBuf); char *p1 = cdsBuf+strlen(COMPLEMENT_PREFIX); if (cdsBuf[len-1] != ')') return FALSE; /* no closing paren */ cdsBuf[len-1] = '\0'; cds->complement = TRUE; if (startsWith(JOIN_PREFIX, p1)) return parseJoin(p1, cds); else - return parseRange(p1, cds); + return genbankParseRange(p1, cds); } boolean genbankCdsParse(char *cdsStr, struct genbankCds* cds) /* Parse a genbank CDS, returning TRUE if it can be successfuly parsed, FALSE * if there are problems. If a join() is specified, the first and last * coordinates are used for the CDS. Incomplete CDS specifications will still * return the start or end. start/end are set to 0 on error. */ { static struct dyString* cdsBuf = NULL; /* buffer for CDS strings */ boolean isOk; if (cdsBuf == NULL) cdsBuf = dyStringNew(512); /* copy so that string can be modified without changing input */ dyStringClear(cdsBuf); dyStringAppend(cdsBuf, cdsStr); ZeroVar(cds); /* FIXME: complement handling is wrong here, but it should only occur in DNA*/ if (startsWith(JOIN_PREFIX, cdsBuf->string)) isOk = parseJoin(cdsBuf->string, cds); else if (startsWith(COMPLEMENT_PREFIX, cdsBuf->string)) isOk = parseComplement(cdsBuf->string, cds); else - isOk = parseRange(cdsBuf->string, cds); + isOk = genbankParseRange(cdsBuf->string, cds); if (!isOk) cds->start = cds->end = 0; return isOk; } boolean genbankParseCds(char *cdsStr, unsigned *cdsStart, unsigned *cdsEnd) /* Compatiblity function, genbankCdsParse is prefered. Parse a genbank CDS, * returning TRUE if it can be successfuly parsed, FALSE if there are * problems. If a join() is specified, the first and last coordinates are * used for the CDS. Incomplete CDS specifications will still return the * start or end. cdsStart and cdsEnd are set to -1 on error. */ { struct genbankCds cds;