bamFile


BAM file handler

typedef RAZF *bamFile;  


bamFile


BAM file handler

typedef BGZF *bamFile;  


bamFile


BAM file handler

typedef RAZF *bamFile;  


bam_header_t


Structure for the alignment header.

typedef struct { 
    int32_t n_targets; 
    char **target_name; 
    uint32_t *target_len; 
    void *hash, *rg2lib; 
    int l_text; 
    char *text; 
} bam_header_t;  
Fields
n_targets
number of reference sequences
target_name
names of the reference sequences
target_len
lengths of the referene sequences
hash
hash table for fast name lookup
rg2lib
hash table for @RG-ID -> LB lookup
l_text
length of the plain text in the header
text
plain text

Discussion

Field hash points to null by default. It is a private member.


bam1_core_t


Structure for core alignment information.

typedef struct { 
    int32_t tid; 
    int32_t pos; 
    uint32_t bin:16, qual:8, l_qname:8; 
    uint32_t flag:16, n_cigar:16; 
    int32_t l_qseq; 
    int32_t mtid; 
    int32_t mpos; 
    int32_t isize; 
} bam1_core_t;  
Fields
tid
chromosome ID, defined by bam_header_t
pos
0-based leftmost coordinate
strand
strand; 0 for forward and 1 otherwise
bin
bin calculated by bam_reg2bin()
qual
mapping quality
l_qname
length of the query name
flag
bitwise flag
n_cigar
number of CIGAR operations
l_qseq
length of the query sequence (read)


bam1_t


Structure for one alignment.

typedef struct { 
    bam1_core_t core; 
    int l_aux, data_len, m_data; 
    uint8_t *data; 
} bam1_t;  
Fields
core
core information about the alignment
l_aux
length of auxiliary data
data_len
current length of bam1_t::data
m_data
maximum length of bam1_t::data
data
all variable-length data, concatenated; structure: cigar-qname-seq-qual-aux

Discussion

Notes:

  1. qname is zero tailing and core.l_qname includes the tailing '\0'.
  2. l_qseq is calculated from the total length of an alignment block on reading or from CIGAR.


tamFile


TAM file handler

typedef struct __tamFile_t *tamFile;  


bam_pileup1_t


Structure for one alignment covering the pileup position.

typedef struct { 
    bam1_t *b; 
    int32_t qpos; 
    int indel, level; 
    uint32_t is_del:1, is_head:1, is_tail:1; 
} bam_pileup1_t;  
Fields
b
pointer to the alignment
qpos
position of the read base at the pileup site, 0-based
indel
indel length; 0 for no indel, positive for ins and negative for del
is_del
1 iff the base on the padded read is a deletion
level
the level of the read in the "viewer" mode

Discussion

See also bam_plbuf_push() and bam_lplbuf_push(). The difference between the two functions is that the former does not set bam_pileup1_t::level, while the later does. Level helps the implementation of alignment viewers, but calculating this has some overhead.


bam_plbuf_t


pileup buffer

typedef struct __bam_plbuf_t bam_plbuf_t;  


bam_pileup_f


Type of function to be called by bam_plbuf_push().

typedef int ( *bam_pileup_f)(
    uint32_t tid,
    uint32_t pos,
    int n,
    const bam_pileup1_t *pl,
    void *data);  
Parameters
tid
chromosome ID as is defined in the header
pos
start coordinate of the alignment, 0-based
n
number of elements in pl array
pl
array of alignments
data
user provided data
Discussion

See also bam_plbuf_push(), bam_plbuf_init() and bam_pileup1_t.


bam_fetch_f


Type of function to be called by bam_fetch().

typedef int ( *bam_fetch_f)(
    const bam1_t *b,
    void *data);  
Parameters
b
the alignment
data
user provided data

© Genome Research Ltd. Last Updated: Saturday, June 13, 2009