def test_rooted_hashed_labels(tree): assert vector_dict(get_rooted_vector(tree, hashing=True)) ==\ vector_dict(['c4ca4238a0b923820dcc509a6f75849b', 'c4ca4238a0b923820dcc509a6f75849b', 'c4ca4238a0b923820dcc509a6f75849b', 'c4ca4238a0b923820dcc509a6f75849b', 'c4ca4238a0b923820dcc509a6f75849b', 'c4ca4238a0b923820dcc509a6f75849b', 'c4ca4238a0b923820dcc509a6f75849b', 'c4ca4238a0b923820dcc509a6f75849b', 'c81e728d9d4c2f636f067f89cc14862c', 'c81e728d9d4c2f636f067f89cc14862c', 'c81e728d9d4c2f636f067f89cc14862c', 'c81e728d9d4c2f636f067f89cc14862c', 'a87ff679a2f3e71d9181a67b7542122c', 'a87ff679a2f3e71d9181a67b7542122c', '6512bd43d9caa6e02c990b0a82652dca']) assert get_root_label(tree, hashing=True) ==\ '6512bd43d9caa6e02c990b0a82652dca'
def dict_from_file(file): """ Return {value:count} dict for file lines :param file: :return: """ return vector_dict((x.rstrip() for x in open(file)))
def test_graph_unrooted_hashed_labels(tree): assert vector_dict(get_unrooted_vector(tree, hashing=True, annotation_method='graph')) == \ vector_dict(['c4ca4238a0b923820dcc509a6f75849b', 'c4ca4238a0b923820dcc509a6f75849b', 'c4ca4238a0b923820dcc509a6f75849b', 'c4ca4238a0b923820dcc509a6f75849b', 'c4ca4238a0b923820dcc509a6f75849b', 'c4ca4238a0b923820dcc509a6f75849b', 'c4ca4238a0b923820dcc509a6f75849b', 'c4ca4238a0b923820dcc509a6f75849b', 'c81e728d9d4c2f636f067f89cc14862c', 'c81e728d9d4c2f636f067f89cc14862c', 'c81e728d9d4c2f636f067f89cc14862c', 'c81e728d9d4c2f636f067f89cc14862c', 'a87ff679a2f3e71d9181a67b7542122c', 'a87ff679a2f3e71d9181a67b7542122c', '45c48cce2e2d7fbdea1afc51c7c6ad26', '45c48cce2e2d7fbdea1afc51c7c6ad26', '45c48cce2e2d7fbdea1afc51c7c6ad26', '45c48cce2e2d7fbdea1afc51c7c6ad26', 'a5771bce93e200c36f7cd9dfd0e5deaa', 'a5771bce93e200c36f7cd9dfd0e5deaa', 'a5771bce93e200c36f7cd9dfd0e5deaa', 'a5771bce93e200c36f7cd9dfd0e5deaa', 'a5771bce93e200c36f7cd9dfd0e5deaa', 'a5771bce93e200c36f7cd9dfd0e5deaa', 'a5771bce93e200c36f7cd9dfd0e5deaa', 'a5771bce93e200c36f7cd9dfd0e5deaa'])