84f9843f1c767648dde8a3afafa8762c21b6a0cc angie Tue Mar 22 10:57:28 2011 -0700 Code review feedback from Mark: use MayOpen naming convention, solineFileOnTabix -> lineFileTabixMayOpen. I still can't bring myself to remove the calls to warn, because I want the CGIs to get those using the webAbort error handlers in conjunction w/errCatch etc. There are tons of calls to warn() in our lib code, which can be redirected using the errAbort handler stack if desired. diff --git src/lib/tests/tabixFetch.c src/lib/tests/tabixFetch.c index 50f3b05..fef9fb8 100644 --- src/lib/tests/tabixFetch.c +++ src/lib/tests/tabixFetch.c @@ -1,32 +1,32 @@ -/* tabixFetch - Test lineFileOnTabix and lineFileSetTabixRegion (compare with cmd line tabix output). */ +/* tabixFetch - Test lineFileTabixMayOpen and lineFileSetTabixRegion (compare with cmd line tabix output). */ #include "common.h" #include "linefile.h" #include "options.h" #ifdef USE_TABIX #include "sqlNum.h" #include "udc.h" #include "knetUdc.h" void usage() /* Explain usage and exit. */ { errAbort( - "tabixFetch - Test lineFileOnTabix and lineFileSetTabixRegion (compare\n" + "tabixFetch - Test lineFileTabixMayOpen and lineFileSetTabixRegion (compare\n" " with command-line tabix output)\n" "usage:\n" " tabixFetch fileOrUrl chrom:start-end\n" "Fetch lines from the specified position range from a line-based file\n" "with genomic positions that has been compressed and indexed by tabix.\n" "This duplicates the fetching functionality of the tabix program -- it\n" "was written solely to test lib/lineFile.c's tabix-wrapper mode.\n" ); } static struct optionSpec options[] = { {NULL, 0}, }; @@ -40,36 +40,36 @@ int wordCount = chopByChar(posDupe, ':', words, ArraySize(words)); if (wordCount != 2) errAbort(BAD_POS_FORMAT, position); *retChrom = posDupe; stripChar(words[1], ','); char *range = cloneString(words[1]); wordCount = chopByChar(range, '-', words, ArraySize(words)); if (wordCount != 2) errAbort(BAD_POS_FORMAT, position); *retStart = sqlUnsigned(words[0]) - 1; *retEnd = sqlUnsigned(words[1]); } void tabixFetch(char *fileOrUrl, char *position) -/* tabixFetch - Test lineFileOnTabix and lineFileSetTabixRegion +/* tabixFetch - Test lineFileTabixMayOpen and lineFileSetTabixRegion * (compare with cmd line tabix output). */ { udcSetDefaultDir("/data/tmp/angie/udcCache"); knetUdcInstall(); -struct lineFile *lf = lineFileOnTabix(fileOrUrl, TRUE); +struct lineFile *lf = lineFileTabixMayOpen(fileOrUrl, TRUE); if (lf == NULL) exit(1); int lineSize; char *line = NULL; boolean gotLine = FALSE; if (0) do { gotLine = lineFileNext(lf, &line, &lineSize); puts(line); } while (gotLine && (line[0] == '#' || isEmpty(line))); char *chrom = NULL; int start, end;