7f189483b4b3547d03a1ee9a47494074bba7cc10 angie Tue Mar 22 11:01:54 2011 -0700 Tweak to vcfParseTest: better handling of ranges with 0 items;include the range in output message. diff --git src/lib/vcf.c src/lib/vcf.c index 419d81d..b583131 100644 --- src/lib/vcf.c +++ src/lib/vcf.c @@ -584,36 +584,37 @@ lf = lineFileMayOpen(fileOrUrl, TRUE); struct vcfFile *vcff = vcfFileHeaderFromLineFile(lf, maxErr, errFh); vcfParseData(vcff); return vcff; } struct vcfFile *vcfTabixFileMayOpen(char *fileOrUrl, char *chrom, int start, int end, int maxErr, FILE *errFh) /* Parse header and rows within the given position range from a VCF file that has been * compressed and indexed by tabix into a vcfFile object; return NULL if or if file has * no items in range. * If maxErr not zero, then continue to parse until this number of error have been reached. * A maxErr less than zero does not stop and reports all errors. Write errors to errFh, * if NULL, use stderr. */ { -struct lineFile *lf = lineFileOnTabix(fileOrUrl, TRUE); +struct lineFile *lf = lineFileTabixMayOpen(fileOrUrl, TRUE); struct vcfFile *vcff = vcfFileHeaderFromLineFile(lf, maxErr, errFh); if (vcff == NULL) return NULL; if (! lineFileSetTabixRegion(lf, chrom, start, end)) - return NULL; + // No items in region + return vcff; vcfParseData(vcff); return vcff; } void vcfFileFree(struct vcfFile **pVcff) /* Free a vcfFile object. */ { if (pVcff == NULL || *pVcff == NULL) return; struct vcfFile *vcff = *pVcff; hashFree(&(vcff->pool)); hashFree(&(vcff->byName)); hashFree(&(vcff->metaDataHash)); lineFileClose(&(vcff->lf)); freez(pVcff);