26c2f650359cc1c74fb31d96109bc0f8dedbc3d7 angie Thu May 30 10:32:19 2019 -0700 Adding BAM and VCF item counts to hubApi's list/tracks function. Note: older index files may not contain counts. refs #18869, #23521 diff --git src/inc/vcf.h src/inc/vcf.h index 36b5d61..cc9d121 100644 --- src/inc/vcf.h +++ src/inc/vcf.h @@ -215,30 +215,36 @@ * 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 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. */ +long long vcfTabixItemCount(char *fileOrUrl, char *tbiFileOrUrl); +/* Return the total number of items across all sequences in fileOrUrl, using index file. + * If tbiFileOrUrl is NULL, the index file is assumed to be fileOrUrl.tbi. + * NOTE: not all tabix index files include mapped item counts, so this may return 0 even for + * large files. */ + int vcfTabixBatchRead(struct vcfFile *vcff, char *chrom, int start, int end, int maxErr, int maxRecords); // Reads a batch of records from an opened and indexed VCF file, adding them to // vcff->records and returning the count of new records added in this batch. // Note: vcff->records will continue to be sorted, even if batches are loaded // out of order. Additionally, resulting vcff->records will contain no duplicates // so returned count refects only the new records added, as opposed to all records // in range. 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. void vcfFileMakeReusePool(struct vcfFile *vcff, int initialSize); // Creates a separate memory pool for records. Establishing this pool allows // using vcfFileFlushRecords to abandon previously read records and free // the associated memory. Very useful when reading an entire file in batches.