BAM_FPAIRED


the read is paired in sequencing, no matter whether it is mapped in a pair

#define BAM_FPAIRED 1 


BAM_FPROPER_PAIR


the read is mapped in a proper pair

#define BAM_FPROPER_PAIR 2 


BAM_FUNMAP


the read itself is unmapped; conflictive with BAM_FPROPER_PAIR

#define BAM_FUNMAP 4 


BAM_FMUNMAP


the mate is unmapped

#define BAM_FMUNMAP 8 


BAM_FREVERSE


the read is mapped to the reverse strand

#define BAM_FREVERSE 16 


BAM_FMREVERSE


the mate is mapped to the reverse strand

#define BAM_FMREVERSE 32 


BAM_FREAD1


this is read1

#define BAM_FREAD1 64 


BAM_FREAD2


this is read2

#define BAM_FREAD2 128 


BAM_FSECONDARY


not primary alignment

#define BAM_FSECONDARY 256 


BAM_FQCFAIL


QC failure

#define BAM_FQCFAIL 512 


BAM_FDUP


optical or PCR duplicate

#define BAM_FDUP 1024 


BAM_DEF_MASK


defautl mask for pileup

#define BAM_DEF_MASK  


BAM_CMATCH


CIGAR: match

#define BAM_CMATCH 0 


BAM_CINS


CIGAR: insertion to the reference

#define BAM_CINS 1 


BAM_CDEL


CIGAR: deletion from the reference

#define BAM_CDEL 2 


BAM_CREF_SKIP


CIGAR: skip on the reference (e.g. spliced alignment)

#define BAM_CREF_SKIP 3 


BAM_CSOFT_CLIP


CIGAR: clip on the read with clipped sequence present in qseq

#define BAM_CSOFT_CLIP 4 


BAM_CHARD_CLIP


CIGAR: clip on the read with clipped sequence trimmed off

#define BAM_CHARD_CLIP 5 


BAM_CPAD


CIGAR: padding

#define BAM_CPAD 6 


bam1_cigar


Get the CIGAR array

#define bam1_cigar(b)  
Parameters
b
pointer to an alignment
Return Value

pointer to the CIGAR array

Discussion

In the CIGAR array, each element is a 32-bit integer. The lower 4 bits gives a CIGAR operation and the higher 28 bits keep the length of a CIGAR.


bam1_qname


Get the name of the query

#define bam1_qname(b)  
Parameters
b
pointer to an alignment
Return Value

pointer to the name string, null terminated


bam1_seq


Get query sequence

#define bam1_seq(b)  
Parameters
b
pointer to an alignment
Return Value

pointer to sequence

Discussion

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 bam1_seqi() macro to get the base.


bam1_qual


Get query quality

#define bam1_qual(b)  
Parameters
b
pointer to an alignment
Return Value

pointer to quality string


bam1_seqi


Get a base on read

#define bam1_seqi(s, i)  
Parameters
s
Query sequence returned by bam1_seq()
i
The i-th position, 0-based
Return Value

4-bit integer representing the base.


bam1_aux


Get query sequence and quality

#define bam1_aux(b)  
Parameters
b
pointer to an alignment
Return Value

pointer to the concatenated auxiliary data


kroundup32


Round an integer to the next closest power-2 integer.

#define kroundup32(x)  
Parameters
x
integer to be rounded (in place)
Discussion

x will be modified.


bam_init1


Initiate a pointer to bam1_t struct

#define bam_init1()  


bam_destroy1


Free the memory allocated for an alignment.

#define bam_destroy1(b) do { \ 
    free((b)->data); free(b); \ 
    } while (0) 
Parameters
b
pointer to an alignment

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