c709a48585f153d6aab69081cbc5ff3fee7b6b3f angie Mon Sep 26 15:21:34 2011 -0700 Samtools CIGAR strings have two new opcodes: '=' for exactly matchingbases, 'X' for mismatching bases. These are more explicit versions of the 'M' opcode for matching and/or mismatching bases. diff --git src/inc/bamFile.h src/inc/bamFile.h index 2c876c7..01ce1e8 100644 --- src/inc/bamFile.h +++ src/inc/bamFile.h @@ -52,32 +52,32 @@ * 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) /* 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" +// 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; if (opcode >= strlen(BAM_DOT_C_OPCODE_STRING)) errAbort("bamUnpackCigarElement: unrecognized opcode %d. " "(I only recognize 0..%lu [" BAM_DOT_C_OPCODE_STRING "]) " "Perhaps samtools bam.c's bam_format1 encoding changed? If so, update me.", opcode, (unsigned long)(strlen(BAM_DOT_C_OPCODE_STRING)-1)); *retOp = BAM_DOT_C_OPCODE_STRING[opcode]; return n; #else // no USE_BAM errAbort(COMPILE_WITH_SAMTOOLS, "bamUnpackCigarElement"); return 0; #endif// USE_BAM }