0c1d13ef4e3214c4029e098ed5ef708d15e6096f max Mon Nov 21 16:34:53 2016 -0800 CIRM: As per Jim: adding the trackDb tag 'bigDataIndex'. It allows to specify the URL of the .tbi or .bai file, in case you cannot put it alongside the .bam or .vcf.gz file. diff --git src/lib/vcf.c src/lib/vcf.c index 0e80f39..45f7875 100644 --- src/lib/vcf.c +++ src/lib/vcf.c @@ -979,31 +979,43 @@ vcff->records = vcfParseData(vcff, chrom, start, end, maxRecords); lineFileClose(&(vcff->lf)); // Not sure why it is closed. Angie? } return vcff; } struct vcfFile *vcfTabixFileMayOpen(char *fileOrUrl, char *chrom, int start, int end, int maxErr, int maxRecords) /* Open a VCF file that has been compressed and indexed by tabix and * parse VCF header, or return NULL if unable. If chrom is non-NULL, * seek to the position range and parse all lines in range into * vcff->records. If maxErr >= zero, then continue to parse until * there are maxErr+1 errors. A maxErr less than zero does not stop * and reports all errors. Set maxErr to VCF_IGNORE_ERRS for silence */ { -struct lineFile *lf = lineFileTabixMayOpen(fileOrUrl, TRUE); +return vcfTabixFileAndIndexMayOpen(fileOrUrl, NULL, chrom, start, end, maxErr, maxRecords); +} + +struct vcfFile *vcfTabixFileAndIndexMayOpen(char *fileOrUrl, char *tbiFileOrUrl, char *chrom, int start, int end, + int maxErr, int maxRecords) +/* Open a VCF file that has been compressed and indexed by tabix and + * parse VCF header, or return NULL if unable. tbiFileOrUrl can be NULL. + * If chrom is non-NULL, seek to the position range and parse all lines in + * range into vcff->records. If maxErr >= zero, then continue to parse until + * there are maxErr+1 errors. A maxErr less than zero does not stop + * and reports all errors. Set maxErr to VCF_IGNORE_ERRS for silence */ +{ +struct lineFile *lf = lineFileTabixAndIndexMayOpen(fileOrUrl, tbiFileOrUrl, TRUE); if (lf == NULL) return NULL; struct vcfFile *vcff = vcfFileHeaderFromLineFile(lf, maxErr); if (vcff == NULL) return NULL; if (isNotEmpty(chrom) && start != end) { if (lineFileSetTabixRegion(lf, chrom, start, end)) vcff->records = vcfParseData(vcff, NULL, 0, 0, maxRecords); lineFileClose(&(vcff->lf)); // file is all read in so we close it } return vcff; }