def secondary_clustering(sff_file, mapping, bestscores, log_fh, threshold=4.5, verbose=False):
 if (len(bestscores) == 0):
  return
 (flowgrams, header) = lazy_parse_sff_handle(open(sff_file))
 counter = 0
 for f in flowgrams:
  (id, score) = bestscores[f.Name]
  if (score < threshold):
   counter += 1
   mapping[id].extend(mapping[f.Name])
   mapping[id].append(f.Name)
   del mapping[f.Name]
 if verbose:
  log_fh.write(('Secondary clustering removed %d flowgrams\n' % counter))

def secondary_clustering ( sff_file , mapping , bestscores , log_fh , threshold = 4.5 , verbose = False ) : if ( len ( bestscores ) == 0 ) : return ( flowgrams , header ) = lazy_parse_sff_handle ( open ( sff_file ) ) counter = 0 for f in flowgrams : ( id , score ) = bestscores [ f . Name ] if ( score < threshold ) : counter += 1 mapping [ id ] . extend ( mapping [ f . Name ] ) mapping [ id ] . append ( f . Name ) del mapping [ f . Name ] if verbose : log_fh . write ( ( 'Secondary clustering removed %d flowgrams\n' % counter ) )
clusters sequences based on their best distance to any of the centroids .