def tree_support(master, subsampled_tree):
 master_tipnames = set(master.getTipNames())
 subsampled_tree_trimmed = copy.deepcopy(subsampled_tree)
 def delete_test(node):
  if (not node.isTip()):
   return False
  else:
   return (node.Name not in master_tipnames)
 subsampled_tree_trimmed.removeDeleted(delete_test)
 subsampled_tree_trimmed.prune()
 subsampled_tree_nodes_names = []
 for node in subsampled_tree_trimmed.iterNontips(include_self=True):
  subsampled_tree_nodes_names.append(node.getTipNames())
 subsampled_tree_nodes_names = map(set, subsampled_tree_nodes_names)
 for master_node in master.iterNontips(include_self=True):
  if (set(master_node.getTipNames()) in subsampled_tree_nodes_names):
   try:
    master_node.bootstrap_support += 1
   except AttributeError:
    master_node.bootstrap_support = 1

def tree_support ( master , subsampled_tree ) : master_tipnames = set ( master . getTipNames ( ) ) subsampled_tree_trimmed = copy . deepcopy ( subsampled_tree ) def delete_test ( node ) : if ( not node . isTip ( ) ) : return False else : return ( node . Name not in master_tipnames ) subsampled_tree_trimmed . removeDeleted ( delete_test ) subsampled_tree_trimmed . prune ( ) subsampled_tree_nodes_names = [ ] for node in subsampled_tree_trimmed . iterNontips ( include_self = True ) : subsampled_tree_nodes_names . append ( node . getTipNames ( ) ) subsampled_tree_nodes_names = map ( set , subsampled_tree_nodes_names ) for master_node in master . iterNontips ( include_self = True ) : if ( set ( master_node . getTipNames ( ) ) in subsampled_tree_nodes_names ) : try : master_node . bootstrap_support += 1 except AttributeError : master_node . bootstrap_support = 1
compares master tree to subsampled_tree .