Consensus nucleotide calculation
The consensus nucleotide calculation is performed following the method described in [Hiatt et al., 2013]. The consensus base is chosen so that the posterior probability of the observed read bases is maximized.
In order to maximize the posterior probability of calling a base, i.e.,

where Oi is the observed base at a given position, C the base in question, and where all possible bases are summed up in the denominator, e.g. B=A,T,C,G.
Assuming that the prior for observing any base is equal, i.e., P(A)=P(T)=P(C)=P(G), then the posterior probability is:

And by assuming each read base observation is independent,

To obtain the consensus base we only need to maximize the numerator.
Subsections