Commit 0e43ad72 authored by Carine Rey's avatar Carine Rey Committed by Philippe Veber
Browse files

add tests

parent 35a594d0
......@@ -93,6 +93,33 @@ except Exception as exc:
logger.info("Ali (%s) ok after checking", AliFile.name)
leaves_names = [ l.name for l in t.get_leaves()]
seq_names = [ s.name for s in alignment]
logger.info("leaves names: %s",leaves_names )
logger.info("sequences names: %s",seq_names )
seq_not_in_tree = set(seq_names) - set(leaves_names)
leaves_not_in_ali = set(leaves_names) - set(seq_names)
if len(set(seq_names)) != len(seq_names):
logger.error("There are duplicated sequence names")
sys.exit(1)
if len(set(leaves_names)) != len(leaves_names):
logger.error("There are duplicated leaf names")
sys.exit(1)
if seq_not_in_tree:
logger.error("Some sequences do not match with a leaf: %s",",".join(list(seq_not_in_tree)))
logger.error("All sequence names must match with a leaf")
sys.exit(1)
elif leaves_not_in_ali:
logger.error("Some leaves do not match with a sequence: %s",",".join(list(leaves_not_in_ali)))
sys.exit(1)
else:
logger.info("Sequence and leaf names match.")
#===================================================================================================
# Create output files
#===================================================================================================
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment