1ff2e18ba5e50dd2d1becd3cd6a25343578c10b8 markd Tue Apr 21 14:09:04 2026 -0700 rework of htslib/UDC integration to use htslib hfile driver mechanism diff --git src/inc/bamFile.h src/inc/bamFile.h index 4c517c9854c..507ded3afde 100644 --- src/inc/bamFile.h +++ src/inc/bamFile.h @@ -80,30 +80,35 @@ * and call callbackFunc on each bam item retrieved from the file plus callbackData. * This handles BAM files with "chr"-less sequence names, e.g. from Ensembl. * The pSamFile parameter is optional. If non-NULL it will be filled in, just for * the benefit of the callback function, with the open samFile. * refUrl points to the place to grab CRAM reference sequences (if any) * cacheDir points to the directory in which CRAM reference sequences are cached */ void bamFetch(char *fileOrUrl, char *position, bam_fetch_f callbackFunc, void *callbackData, samfile_t **pSamFile); /* Open the .bam file, fetch items in the seq:start-end position range, * and call callbackFunc on each bam item retrieved from the file plus callbackData. * This handles BAM files with "chr"-less sequence names, e.g. from Ensembl. * The pSamFile parameter is optional. If non-NULL it will be filled in, just for * the benefit of the callback function, with the open samFile. */ +void cramCheckRefs(samfile_t *fh, char *refUrl, char *cacheDir); +/* Check if all CRAM reference sequences are locally available. If any are + * missing, create pending-download request files and errAbort with a message + * telling the user to refresh. No-op if fh is not CRAM or cacheDir is NULL. */ + void bamClose(samfile_t **pSamFile); /* Close down a samefile_t */ boolean bamIsRc(const bam1_t *bam); /* Return TRUE if alignment is on - strand. */ INLINE int bamUnpackCigarElement(unsigned int packed, char *retOp) /* Given an unsigned int containing a number of bases and an offset into an * array of BAM-enhanced-CIGAR ASCII characters (operations), store operation * char into *retOp (retOp must not be NULL) and return the number of bases. */ { // decoding lifted from samtools bam.c bam_format1_core(), long may it remain stable: #define BAM_DOT_C_OPCODE_STRING "MIDNSHP=X" int n = packed>>BAM_CIGAR_SHIFT; int opcode = packed & BAM_CIGAR_MASK;