fdb4b5d215ff23b0f066a9b7d7a96ae31045a347 braney Fri Jan 15 12:27:29 2016 -0800 yet more work on support CRAM under htslib diff --git src/inc/bamFile.h src/inc/bamFile.h index 1bded69..4c27828 100644 --- src/inc/bamFile.h +++ src/inc/bamFile.h @@ -75,30 +75,40 @@ * contains a pointer to a bam_header_t with information about the header. * The implementation is just a wrapper around samopen from the samtools library * that aborts with error message if there's a problem with the open. */ #ifdef USE_HTS void bamFetchAlreadyOpen(samfile_t *samfile, bam_hdr_t *header, bam_index_t *idx, char *bamFileName, #else void bamFetchAlreadyOpen(samfile_t *samfile, bam_index_t *idx, char *bamFileName, #endif char *position, bam_fetch_f callbackFunc, void *callbackData); /* With the open bam file, return items the same way with the callbacks as with bamFetch() */ /* except in this case use an already-open bam file and index (use bam_index_load and free() for */ /* the index). It seems a little strange to pass the filename in with the open bam, but */ /* it's just used to report errors. */ +void bamFetchPlus(char *fileOrUrl, char *position, bam_fetch_f callbackFunc, void *callbackData, + samfile_t **pSamFile, char *refUrl, char *cacheDir); +/* 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. + * 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 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)