Applying this algorithm iteratively can be done from outside if given some intermediate results. Thus, the loop should be eliminated. The loop is currently limited to one iteration anyway.
Desired algorithmic structure
// Initialization
maskBadRegions()
filterReadAlignments()
// Close Gaps
buildPileUps()
for each pileUp do
selectGoodReads()
cropAndValidateReads()
buildConsensus()
// Finish
pruneOverfilledGaps()
generateOutput()
Applying this algorithm iteratively can be done from outside if given some intermediate results. Thus, the loop should be eliminated. The loop is currently limited to one iteration anyway.
Desired algorithmic structure