def check_tree_exact_match(fasta_labels, tree_fp):
 raw_fasta_labels = set([label.split('_')[0] for label in fasta_labels])
 tree_f = open(tree_fp, 'U')
 tree = DndParser(tree_f)
 tree_tips = set(tree.getTipNames())
 labels_not_in_tips = []
 for curr_label in raw_fasta_labels:
  if (curr_label not in tree_tips):
   labels_not_in_tips.append(curr_label)
 if (len(labels_not_in_tips) == 0):
  labels_not_in_tips = True
 tips_not_in_labels = []
 for curr_tip in tree_tips:
  if (curr_tip not in raw_fasta_labels):
   tips_not_in_labels.append(curr_tip)
 if (len(tips_not_in_labels) == 0):
  tips_not_in_labels = True
 return [labels_not_in_tips, tips_not_in_labels]

def check_tree_exact_match ( fasta_labels , tree_fp ) : raw_fasta_labels = set ( [ label . split ( '_' ) [ 0 ] for label in fasta_labels ] ) tree_f = open ( tree_fp , 'U' ) tree = DndParser ( tree_f ) tree_tips = set ( tree . getTipNames ( ) ) labels_not_in_tips = [ ] for curr_label in raw_fasta_labels : if ( curr_label not in tree_tips ) : labels_not_in_tips . append ( curr_label ) if ( len ( labels_not_in_tips ) == 0 ) : labels_not_in_tips = True tips_not_in_labels = [ ] for curr_tip in tree_tips : if ( curr_tip not in raw_fasta_labels ) : tips_not_in_labels . append ( curr_tip ) if ( len ( tips_not_in_labels ) == 0 ) : tips_not_in_labels = True return [ labels_not_in_tips , tips_not_in_labels ]
checks fasta labels to exact match to tree tips returns a list of two lists .