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/tests/vcfParseTest.c src/lib/tests/vcfParseTest.c index 3c8af00..050e5a9 100644 --- src/lib/tests/vcfParseTest.c +++ src/lib/tests/vcfParseTest.c @@ -18,31 +18,34 @@ "fileOrUrl.vcf.gz needs to have been compressed by tabix, and index file\n" "fileOrUrl.vcf.gz.tbi must exist.\n" ); } static struct optionSpec options[] = { {NULL, 0}, }; void vcfParseTest(char *fileOrUrl, char *seqName, int start, int end) /* vcfParseTest - Parse VCF header and data lines in given position range.. */ { struct vcfFile *vcff = vcfTabixFileMayOpen(fileOrUrl, seqName, start, end, 100, stderr); if (vcff == NULL) errAbort("Failed to parse \"%s\" and/or its index file \"%s.tbi\"", fileOrUrl, fileOrUrl); -printf("Finished parsing \"%s\", got %d data rows\n", fileOrUrl, slCount(vcff->records)); +int recCount = slCount(vcff->records); +printf("Finished parsing \"%s\" items in %s:%d-%d, got %d data rows\n", + fileOrUrl, seqName, start+1, end, recCount); +if (recCount > 0) printf("First (up to) 100 rows in range:\n"); int i = 0; struct vcfRecord *rec = vcff->records; while (rec != NULL && i < 100) { printf("%s\t%d\t%d\t%s:%s/%s\t%f\n", rec->chrom, rec->chromStart, rec->chromEnd, rec->name, rec->ref, rec->alt, rec->qual); rec = rec->next; i++; } vcfFileFree(&vcff); } int main(int argc, char *argv[])