A dynamic programming algorithm for binning microbial community profiles