def _iter_loci(meta, clusters, s2p, filtered, n_cluster):
global CONFLICT<EOL>loci = dict(zip(meta, [clusters[idc] for idc in meta]))<EOL>n_loci = len(meta)<EOL>n_loci_prev = n_loci + <NUM_LIT:1><EOL>cicle = <NUM_LIT:0><EOL>internal_cluster = {}<EOL>if n_loci == <NUM_LIT:1>:<EOL><INDENT>n_cluster += <NUM_LIT:1><EOL>filtered[n_cluster] = clusters[meta[<NUM_LIT:0>]]<EOL>filtered[n_cluster].update(id=n_cluster)<EOL>filtered[n_cluster].set_freq(s2p[<NUM_LIT:1>])<EOL><DEDENT>while n_loci < n_loci_prev and n_loci != <NUM_LIT:1>:<EOL><INDENT>n_loci_prev = n_loci<EOL>cicle += <NUM_LIT:1><EOL>if (cicle % <NUM_LIT:1>) == <NUM_LIT:0>:<EOL><INDENT>logger.debug("<STR_LIT>" % (cicle, n_loci))<EOL><DEDENT>loci_similarity = _calculate_similarity(loci)<EOL>internal_cluster = _merge_similar(loci, loci_similarity)<EOL>n_loci = len(internal_cluster)<EOL>loci = internal_cluster<EOL>logger.debug("<STR_LIT>" % n_loci)<EOL><DEDENT>if n_loci > <NUM_LIT:1>:<EOL><INDENT>n_internal_cluster = sorted(internal_cluster.keys(), reverse=True)[<NUM_LIT:0>]<EOL>CONFLICT += <NUM_LIT:1><EOL>internal_cluster = _solve_conflict(internal_cluster, s2p, n_internal_cluster)<EOL><DEDENT>internal_cluster = _clean_cluster(internal_cluster)<EOL>for idc in internal_cluster:<EOL><INDENT>n_cluster += <NUM_LIT:1><EOL>logger.debug("<STR_LIT>" % n_cluster)<EOL>filtered[n_cluster] = internal_cluster[idc]<EOL>filtered[n_cluster].id = n_cluster<EOL>filtered[n_cluster].update(id=n_cluster)<EOL>filtered[n_cluster].set_freq(s2p[<NUM_LIT:1>])<EOL><DEDENT>logger.debug("<STR_LIT>" % filtered.keys())<EOL>return filtered, n_cluster<EOL>
Go through all locus and decide if they are part
of the same TU or not.

:param idx: int cluster id
:param s2p: dict with [loci].coverage[start] = # of sequences there
:param filtered: dict with clusters object
:param n_cluster: int cluster id

:return:
    * filtered: dict of cluster objects
    * n_cluster: int cluster id