Skip to main content
. 2018 Jun 20;9(6):313. doi: 10.3390/genes9060313
Algorithm 2 (Gibbs Sampling Algorithm for the Metagenomic Model).
Require: references species M , metagenomic reads R , hyperparameter α
Global data: count statistics n , read-composition distributions Φ , memory for full conditionals p{zi|z¬i,R;α,Φ}
Ensure: mixture parameters
θ //initialization: obtain read-composition distributions Φ according to alignment results zero all count statistics n
for i=1 to N do sample the species index zi=mMult(M) increment sampled species count nm=nm+1
end for //Gibbs sampling
while not finished do
for i=1 to N do decrement target species count nm=nm1
sample a new species index zi=m˜p{zi|z¬i,R;α,Φ}
increment sampled species’ count nm˜=nm˜+1
end for
if converged and a given number of samples generated then
return mixture parameter θ according to the equation
end if
end while