Skip to content

Instantly share code, notes, and snippets.

@dnbaker
Last active March 8, 2016 19:02
Show Gist options
  • Save dnbaker/e3d85bfcbe3c29201e5a to your computer and use it in GitHub Desktop.
Save dnbaker/e3d85bfcbe3c29201e5a to your computer and use it in GitHub Desktop.
bam1_t sequence setting
/*
* :abstract: set the base in pSeq at index i in the read to the base in bSeq at index i in the read.
* These 8-bit integers are the points in memory returned by bam_get_seq(p) and bam_get_seq(b), respectively.
* :param: pSeq [uint8_t *]
* :param: bSeq [uint8_t *]
* :param: i [int/integral type]
*/
#define set_base(pSeq, bSeq, i) (pSeq)[(i)>>1] = ((bam_seqi(bSeq, i) << (((~i) & 1) << 2)) | (((pSeq)[(i)>>1]) & (0xf0U >> (((~i) & 1) << 2))))
/*
* :abstract: set the base at index i in the read to "N".
* :param: pSeq [uint8_t *]
* :param: i [int/integral type]
*/
#define n_base(pSeq, i) pSeq[(i)>>1] |= (0xf << ((~(i) & 1) << 2));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment