491395482b817cfe82cbdef4dd7f8ee0723c1a4a angie Wed Mar 23 21:01:49 2011 -0700 Feature #2822, #2823 (VCF customFactory + track handler):Added a new track type, vcfTabix, with handlers in hgTracks and hgc and a customFactory. It is a new bigDataUrl type of track; the remote VCF file must be compressed and indexed by tabix, so like BAM a separate index file is required. If the VCF file has genotypes, then each sample's two haplotypes are graphed in a line, with one line per sample. Otherwise, alleles and counts (if available) are drawn using Belinda's pgSnp methods. The source code has to be compiled with USE_TABIX=1 (which is automatically set for us by common.mk when it finds the local installation) in order for the CGIs to recognize the track type. diff --git src/lib/tests/vcfParseTest.c src/lib/tests/vcfParseTest.c index 7dd2474..280f52a 100644 --- src/lib/tests/vcfParseTest.c +++ src/lib/tests/vcfParseTest.c @@ -1,60 +1,60 @@ /* vcfParseTest - Parse VCF header and data lines in given position range.. */ #include "common.h" #include "linefile.h" #include "hash.h" #include "options.h" #include "sqlNum.h" #include "vcf.h" static char const rcsid[] = "$Id: newProg.c,v 1.30 2010/03/24 21:18:33 hiram Exp $"; void usage() /* Explain usage and exit. */ { errAbort( "vcfParseTest - Parse VCF header and data lines in given position range.\n" "usage:\n" " vcfParseTest fileOrUrl.vcf.gz seqName start end\n" "\n" "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); +struct vcfFile *vcff = vcfTabixFileMayOpen(fileOrUrl, seqName, start, end, 100); if (vcff == NULL) errAbort("Failed to parse \"%s\" and/or its index file \"%s.tbi\"", fileOrUrl, fileOrUrl); 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[]) /* Process command line. */ { optionInit(&argc, argv, options); if (argc != 5) usage(); vcfParseTest(argv[1], argv[2], sqlUnsigned(argv[3]), sqlUnsigned(argv[4])); return 0; }