Error correction and clustering algorithms for next generation sequencing