def compare_clades(pw):
names = sorted(set([i for i in pw]))<EOL>for i in range(<NUM_LIT:0>, <NUM_LIT:4>):<EOL><INDENT>wi, bt = {}, {}<EOL>for a in names:<EOL><INDENT>for b in pw[a]:<EOL><INDENT>if '<STR_LIT:;>' not in a or '<STR_LIT:;>' not in b:<EOL><INDENT>continue<EOL><DEDENT>pident = pw[a][b]<EOL>cA, cB = a.split('<STR_LIT:;>')[i], b.split('<STR_LIT:;>')[i]<EOL>if i == <NUM_LIT:0> and '<STR_LIT:_>' in cA and '<STR_LIT:_>' in cB:<EOL><INDENT>cA = cA.rsplit('<STR_LIT:_>', <NUM_LIT:1>)[<NUM_LIT:1>]<EOL>cB = cB.rsplit('<STR_LIT:_>', <NUM_LIT:1>)[<NUM_LIT:1>]<EOL><DEDENT>elif '<STR_LIT:>>' in cA or '<STR_LIT:>>' in cB:<EOL><INDENT>cA = cA.split('<STR_LIT:>>')[<NUM_LIT:1>]<EOL>cB = cB.split('<STR_LIT:>>')[<NUM_LIT:1>]<EOL><DEDENT>if cA == cB:<EOL><INDENT>if cA not in wi:<EOL><INDENT>wi[cA] = []<EOL><DEDENT>wi[cA].append(pident)<EOL><DEDENT>else:<EOL><INDENT>if cA not in bt:<EOL><INDENT>bt[cA] = {}<EOL><DEDENT>if cB not in bt[cA]:<EOL><INDENT>bt[cA][cB] = []<EOL><DEDENT>bt[cA][cB].append(pident)<EOL><DEDENT><DEDENT><DEDENT>print('<STR_LIT>')<EOL>for clade, pidents in list(wi.items()):<EOL><INDENT>print('<STR_LIT:\t>'.join(['<STR_LIT>' % str(i), clade, str(min(pidents))]))<EOL><DEDENT>comps = []<EOL>print('<STR_LIT>')<EOL>for comp in print_pairwise(bt):<EOL><INDENT>if comp is not None:<EOL><INDENT>print('<STR_LIT:\t>'.join(['<STR_LIT>' % str(i)] + [str(j) for j in comp]))<EOL>if comp[<NUM_LIT:0>] != '<STR_LIT:#>':<EOL><INDENT>comps.extend([j for j in comp[<NUM_LIT:1>:] if j != '<STR_LIT:->'])<EOL><DEDENT><DEDENT><DEDENT>print_comps(comps)<EOL>comps = []<EOL>print('<STR_LIT>')<EOL>for comp in print_pairwise(bt, median = True):<EOL><INDENT>if comp is not None:<EOL><INDENT>print('<STR_LIT:\t>'.join(['<STR_LIT>' % str(i)] + [str(j) for j in comp]))<EOL>if comp[<NUM_LIT:0>] != '<STR_LIT:#>':<EOL><INDENT>comps.extend([j for j in comp[<NUM_LIT:1>:] if j != '<STR_LIT:->'])<EOL><DEDENT><DEDENT><DEDENT>print_comps(comps)<EOL><DEDENT>
print min. pident within each clade and then matrix of between-clade max.