NVBIO
|
Go to the source code of this file.
Classes | |
struct | bam_hdr_t |
struct | bam1_core_t |
struct | bam1_t |
struct | bam_pileup1_t |
Macros | |
#define | BAM_CMATCH 0 |
#define | BAM_CINS 1 |
#define | BAM_CDEL 2 |
#define | BAM_CREF_SKIP 3 |
#define | BAM_CSOFT_CLIP 4 |
#define | BAM_CHARD_CLIP 5 |
#define | BAM_CPAD 6 |
#define | BAM_CEQUAL 7 |
#define | BAM_CDIFF 8 |
#define | BAM_CBACK 9 |
#define | BAM_CIGAR_STR "MIDNSHP=XB" |
#define | BAM_CIGAR_SHIFT 4 |
#define | BAM_CIGAR_MASK 0xf |
#define | BAM_CIGAR_TYPE 0x3C1A7 |
#define | bam_cigar_op(c) ((c)&BAM_CIGAR_MASK) |
#define | bam_cigar_oplen(c) ((c)>>BAM_CIGAR_SHIFT) |
#define | bam_cigar_opchr(c) (BAM_CIGAR_STR[bam_cigar_op(c)]) |
#define | bam_cigar_gen(l, o) ((l)<<BAM_CIGAR_SHIFT|(o)) |
#define | bam_cigar_type(o) (BAM_CIGAR_TYPE>>((o)<<1)&3) |
#define | BAM_FPAIRED 1 |
#define | BAM_FPROPER_PAIR 2 |
#define | BAM_FUNMAP 4 |
#define | BAM_FMUNMAP 8 |
#define | BAM_FREVERSE 16 |
#define | BAM_FMREVERSE 32 |
#define | BAM_FREAD1 64 |
#define | BAM_FREAD2 128 |
#define | BAM_FSECONDARY 256 |
#define | BAM_FQCFAIL 512 |
#define | BAM_FDUP 1024 |
#define | BAM_FSUPPLEMENTARY 2048 |
#define | bam_is_rev(b) (((b)->core.flag&BAM_FREVERSE) != 0) |
#define | bam_is_mrev(b) (((b)->core.flag&BAM_FMREVERSE) != 0) |
#define | bam_get_qname(b) ((char*)(b)->data) |
#define | bam_get_cigar(b) ((uint32_t*)((b)->data + (b)->core.l_qname)) |
#define | bam_get_seq(b) ((b)->data + ((b)->core.n_cigar<<2) + (b)->core.l_qname) |
#define | bam_get_qual(b) ((b)->data + ((b)->core.n_cigar<<2) + (b)->core.l_qname + (((b)->core.l_qseq + 1)>>1)) |
#define | bam_get_aux(b) ((b)->data + ((b)->core.n_cigar<<2) + (b)->core.l_qname + (((b)->core.l_qseq + 1)>>1) + (b)->core.l_qseq) |
#define | bam_get_l_aux(b) ((b)->l_data - ((b)->core.n_cigar<<2) - (b)->core.l_qname - (b)->core.l_qseq - (((b)->core.l_qseq + 1)>>1)) |
#define | bam_seqi(s, i) ((s)[(i)>>1] >> ((~(i)&1)<<2) & 0xf) |
#define | bam_itr_destroy(iter) hts_itr_destroy(iter) |
#define | bam_itr_queryi(idx, tid, beg, end) sam_itr_queryi(idx, tid, beg, end) |
#define | bam_itr_querys(idx, hdr, region) sam_itr_querys(idx, hdr, region) |
#define | bam_itr_next(htsfp, itr, r) hts_itr_next((htsfp)->fp.bgzf, (itr), (r), 0) |
#define | bam_index_load(fn) hts_idx_load((fn), HTS_FMT_BAI) |
#define | sam_itr_destroy(iter) hts_itr_destroy(iter) |
#define | sam_itr_next(htsfp, itr, r) hts_itr_next((htsfp)->fp.bgzf, (itr), (r), (htsfp)) |
#define | sam_open(fn, mode) (hts_open((fn), (mode))) |
#define | sam_close(fp) hts_close(fp) |
Typedefs | |
typedef htsFile | samFile |
typedef int(* | bam_plp_auto_f )(void *data, bam1_t *b) |
typedef struct __bam_plp_t * | bam_plp_t |
typedef struct __bam_mplp_t * | bam_mplp_t |
#define bam_cigar_gen | ( | l, | |
o | |||
) | ((l)<<BAM_CIGAR_SHIFT|(o)) |
#define bam_cigar_op | ( | c) | ((c)&BAM_CIGAR_MASK) |
#define bam_cigar_opchr | ( | c) | (BAM_CIGAR_STR[bam_cigar_op(c)]) |
#define bam_cigar_oplen | ( | c) | ((c)>>BAM_CIGAR_SHIFT) |
#define bam_cigar_type | ( | o) | (BAM_CIGAR_TYPE>>((o)<<1)&3) |
#define BAM_FMREVERSE 32 |
#define BAM_FPAIRED 1 |
#define BAM_FREVERSE 16 |
#define BAM_FUNMAP 4 |
#define bam_get_aux | ( | b) | ((b)->data + ((b)->core.n_cigar<<2) + (b)->core.l_qname + (((b)->core.l_qseq + 1)>>1) + (b)->core.l_qseq) |
#define bam_get_cigar | ( | b) | ((uint32_t*)((b)->data + (b)->core.l_qname)) |
#define bam_get_l_aux | ( | b) | ((b)->l_data - ((b)->core.n_cigar<<2) - (b)->core.l_qname - (b)->core.l_qseq - (((b)->core.l_qseq + 1)>>1)) |
#define bam_get_qname | ( | b) | ((char*)(b)->data) |
#define bam_get_qual | ( | b) | ((b)->data + ((b)->core.n_cigar<<2) + (b)->core.l_qname + (((b)->core.l_qseq + 1)>>1)) |
#define bam_get_seq | ( | b) | ((b)->data + ((b)->core.n_cigar<<2) + (b)->core.l_qname) |
Get query sequence
b | pointer to an alignment |
Each base is encoded in 4 bits: 1 for A, 2 for C, 4 for G, 8 for T and 15 for N. Two bases are packed in one byte with the base at the higher 4 bits having smaller coordinate on the read. It is recommended to use bam_seqi() macro to get the base.
#define bam_index_load | ( | fn) | hts_idx_load((fn), HTS_FMT_BAI) |
#define bam_is_mrev | ( | b) | (((b)->core.flag&BAM_FMREVERSE) != 0) |
#define bam_is_rev | ( | b) | (((b)->core.flag&BAM_FREVERSE) != 0) |
#define bam_itr_destroy | ( | iter) | hts_itr_destroy(iter) |
#define bam_itr_next | ( | htsfp, | |
itr, | |||
r | |||
) | hts_itr_next((htsfp)->fp.bgzf, (itr), (r), 0) |
#define bam_itr_queryi | ( | idx, | |
tid, | |||
beg, | |||
end | |||
) | sam_itr_queryi(idx, tid, beg, end) |
#define bam_itr_querys | ( | idx, | |
hdr, | |||
region | |||
) | sam_itr_querys(idx, hdr, region) |
#define bam_seqi | ( | s, | |
i | |||
) | ((s)[(i)>>1] >> ((~(i)&1)<<2) & 0xf) |
#define sam_itr_destroy | ( | iter) | hts_itr_destroy(iter) |
#define sam_itr_next | ( | htsfp, | |
itr, | |||
r | |||
) | hts_itr_next((htsfp)->fp.bgzf, (itr), (r), (htsfp)) |
typedef struct __bam_mplp_t* bam_mplp_t |
Calculate the rightmost base position of an alignment on the reference genome.
b | pointer to an alignment |
For a mapped read, this is just b->core.pos + bam_cigar2rlen. For an unmapped read (either according to its flags or if it has no cigar string), we return b->core.pos + 1 by convention.
char* bam_flag2str | ( | int | flag) |
bam_hdr_t* bam_hdr_init | ( | void | ) |
int bam_mplp_auto | ( | bam_mplp_t | iter, |
int * | _tid, | ||
int * | _pos, | ||
int * | n_plp, | ||
const bam_pileup1_t ** | plp | ||
) |
void bam_mplp_destroy | ( | bam_mplp_t | iter) |
bam_mplp_t bam_mplp_init | ( | int | n, |
bam_plp_auto_f | func, | ||
void ** | data | ||
) |
void bam_mplp_init_overlaps | ( | bam_mplp_t | iter) |
bam_mplp_init_overlaps() - if called, mpileup will detect overlapping read pairs and for each base pair set the base quality of the lower-quality base to zero, thus effectively discarding it from calling. If the two bases are identical, the quality of the other base is increased to the sum of their qualities (capped at 200), otherwise it is multiplied by 0.8.
void bam_mplp_set_maxcnt | ( | bam_mplp_t | iter, |
int | maxcnt | ||
) |
const bam_pileup1_t* bam_plp_auto | ( | bam_plp_t | iter, |
int * | _tid, | ||
int * | _pos, | ||
int * | _n_plp | ||
) |
bam_plp_t bam_plp_init | ( | bam_plp_auto_f | func, |
void * | data | ||
) |
bam_plp_init() - sets an iterator over multiple : see mplp_func in bam_plcmd.c in samtools for an example. Expected return status: 0 on success, -1 on end, < -1 on non-recoverable errors : user data to pass to
const bam_pileup1_t* bam_plp_next | ( | bam_plp_t | iter, |
int * | _tid, | ||
int * | _pos, | ||
int * | _n_plp | ||
) |