Automatically partition a gene phylogeny by using genetic and ecological similarity