def get_order_from_tree(ids, tree_text):
 tree = parse_newick(tree_text, PhyloNode)
 ordered_ids = []
 for tip in tree.iterTips():
  if (tip.Name in ids):
   ordered_ids.append(tip.Name)
 return names_to_indices(ids, ordered_ids)

def get_order_from_tree ( ids , tree_text ) : tree = parse_newick ( tree_text , PhyloNode ) ordered_ids = [ ] for tip in tree . iterTips ( ) : if ( tip . Name in ids ) : ordered_ids . append ( tip . Name ) return names_to_indices ( ids , ordered_ids )
returns the indices that would sort ids by tree tip order .