2e75814ac8468bdfb14d01cabe7455b63154a64b kent Thu Feb 10 16:59:09 2011 -0800 Adding example lines to BAM schema page in table browser. Pushing forward on getting identifiers to work there, but still a ways to go. (It no longer bombs at the paste identifiers page, but it does shortly thereafter.) diff --git src/hg/inc/bamFile.h src/hg/inc/bamFile.h index a7cea23..e80e231 100644 --- src/hg/inc/bamFile.h +++ src/hg/inc/bamFile.h @@ -47,30 +47,41 @@ /* Return TRUE if we can successfully open the bam file and its index file. */ 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. */ struct samAlignment *bamFetchSamAlignment(char *fileOrUrl, char *chrom, int start, int end, struct lm *lm); /* Fetch region as a list of samAlignments - which is more or less an unpacked * bam record. Results is allocated out of lm, since it tends to be large... */ +struct samAlignment *bamReadNextSamAlignments(samfile_t *fh, int count, struct lm *lm); +/* Read next count alignments in SAM format, allocated in lm. May return less than + * count at end of file. */ + +samfile_t *bamOpen(char *fileOrUrl, char **retBamFileName); +/* Return an open bam file, dealing with FUSE caching if need be. + * Return parameter if NON-null will return the file name after FUSing */ + +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. */ { #ifdef USE_BAM // decoding lifted from samtools bam.c bam_format1(), long may it remain stable: #define BAM_DOT_C_OPCODE_STRING "MIDNSHP" int n = packed>>BAM_CIGAR_SHIFT; int opcode = packed & BAM_CIGAR_MASK; if (opcode >= strlen(BAM_DOT_C_OPCODE_STRING)) errAbort("bamUnpackCigarElement: unrecognized opcode %d. "