Skip to content

Commit

Permalink
Merge pull request #104 from andrewjpage/print_excluded_sequences
Browse files Browse the repository at this point in the history
Support for bipartition trees as input
  • Loading branch information
andrewjpage committed Aug 22, 2014
2 parents cae13d8 + c0ce86e commit 4350943
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.10
0.1.11
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
gubbins (0.1.11~trusty1) trusty; urgency=low

* Python remove internal node names if passed in as a starting tree

-- Andrew Page <[email protected]> Fri, 22 Aug 2014 16:44:00 +0000

gubbins (0.1.10~trusty1) trusty; urgency=low

* Python print list of excluded sequences to STDOUT by default
Expand Down
5 changes: 3 additions & 2 deletions python/gubbins/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,7 @@ def filter_out_removed_taxa_from_tree_and_return_new_file(starting_tree, temp_wo

tree = dendropy.Tree.get_from_path(starting_tree, 'newick',
preserve_underscores=True)

tree.prune_taxa_with_labels(taxa_removed, update_splits=True, delete_outdegree_one=False)
tree.prune_leaves_without_taxa(update_splits=True, delete_outdegree_one=False)
tree.deroot()
Expand All @@ -642,8 +643,8 @@ def filter_out_removed_taxa_from_tree_and_return_new_file(starting_tree, temp_wo
taxon_set=None,
suppress_leaf_taxon_labels=False,
suppress_leaf_node_labels=True,
suppress_internal_taxon_labels=False,
suppress_internal_node_labels=False,
suppress_internal_taxon_labels=True,
suppress_internal_node_labels=True,
suppress_rooting=True,
suppress_edge_lengths=False,
unquoted_underscores=True,
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
(((sequence_7:0.300658,sequence_10:2e-05)N3:1.1e-05,sequence_9:0.193531)N2:2e-05,sequence_6:0.030557,sequence_8:2e-05)N1:0.0;
(((sequence_7:0.300658,sequence_10:2e-05):1.1e-05,sequence_9:0.193531):2e-05,sequence_6:0.030557,sequence_8:2e-05):0.0;
1 change: 1 addition & 0 deletions python/gubbins/tests/data/tree_with_internal_nodes.tre
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
((A0006:0.000000,A0004:21.489000)N2:103.770966,A0003:0.000000,(A0005:0.000000,(A0001:0.000000,A0002:3.659100)N4:2.366730)N3:19.463560)N1:0.000000;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
((A0006:0.0,A0004:21.489):103.770966,A0003:0.0,(A0005:0.0,(A0001:0.0,A0002:3.6591):2.36673):19.46356):0.0;
10 changes: 10 additions & 0 deletions python/gubbins/tests/test_tree_python_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,16 @@ def test_filter_out_removed_taxa_from_tree_and_return_new_file(self):
os.remove(temp_working_dir + '/robinson_foulds_distance_tree1.tre')
os.removedirs(temp_working_dir)

def test_internal_node_taxons_removed_when_used_as_starting_tree(self):
temp_working_dir = tempfile.mkdtemp(dir=os.getcwd())
common.GubbinsCommon.filter_out_removed_taxa_from_tree_and_return_new_file('gubbins/tests/data/tree_with_internal_nodes.tre', temp_working_dir, [])
actual_file_content = open(temp_working_dir + '/tree_with_internal_nodes.tre', 'U').readlines()
expected_file_content = open('gubbins/tests/data/tree_with_internal_nodes.tre_expected', 'U').readlines()
assert actual_file_content == expected_file_content
os.remove(temp_working_dir + '/tree_with_internal_nodes.tre')
os.removedirs(temp_working_dir)


def test_create_pairwise_newick_tree(self):
common.GubbinsCommon.create_pairwise_newick_tree(['sequence_2','sequence_3'], 'gubbins/tests/data/pairwise_newick_tree.actual')
actual_file_content = open('gubbins/tests/data/pairwise_newick_tree.actual', 'U').readlines()
Expand Down
2 changes: 1 addition & 1 deletion python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

setup(
name='gubbins',
version='0.1.10',
version='0.1.11',
description='Frontend to the Gubbins BioInformatics tool',
author='Andrew J. Page',
author_email='[email protected]',
Expand Down

0 comments on commit 4350943

Please sign in to comment.