def genotypes_from_list(alleles, ploidy):
	"""
	Given a list of alleles and a ploidy,
	construct the genotypes.
	"""
	genotypes = []
	n_alleles = len(alleles)
	assert n_alleles % ploidy == 0
	for i in range(0, n_alleles, ploidy):
		genotypes.append('|'.join([str(a) for a in alleles[i:i + ploidy]]))
	return genotypes