[Biopython] Bio.Phylo: writing newick trees with internal node names
Eric Talevich
eric.talevich at gmail.com
Tue Mar 20 18:11:25 EDT 2012
Hi Tanya,
In case you haven't solved this yet, could you post some small portion of
the Newick tree you're working with? It's possible that your tree is oddly
formatted, and the Newick parser isn't picking up the internal node labels
in the first place.
In the current version of Biopython (1.59), this seems to work fine:
from Bio import Phylo
# Example file from our test suite
tree = Phylo.read("Tests/Nexus/int_node_labels.nwk", "newick")
# Print to the console
print tree.format("newick")
# To write the tree to a file, this is preferred:
Phylo.write(tree, "my_new_file.nwk", "newick")
Cheers,
Eric
On Fri, Mar 16, 2012 at 8:13 AM, Tanya Golubchik <golubchi at stats.ox.ac.uk>wrote:
> Dear all,
>
> I may be missing something in the documentation, but I can't seem to
> figure out how to write newick trees with internal node names (preserved
> as plain text). I think in some versions of Bio.Phylo a call to
> tree.format('newick') accomplished this by default, but currently I
> can't replicate this behaviour and get a tree with unnamed internal nodes.
>
> Any pointers would be appreciated!
>
> Thanks
> Tanya
> _______________________________________________
> Biopython mailing list - Biopython at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/biopython
>
More information about the Biopython
mailing list