[Biopython] Nexus.Tree fails to import nexus tree file

Peter biopython at maubp.freeserve.co.uk
Sat Sep 26 10:23:39 UTC 2009


On Sat, Sep 26, 2009 at 4:17 AM, Thomas Keller
<thomas.e.keller at gmail.com> wrote:
> I apologize if this has been addressed, I looked online and it does
> not seem to be a general issue. I have several programs that generate
> nexus files consisting entirely of trees; there is no sequence
> information.  Can the Nexus parser not read this type of nexus file?
> When I try to open the a file with:
>
> from Bio.Nexus import Trees
> tree_string=open('Analysis_tree_1a.tre').read()
> tree=Trees.Tree(tree_string)

Use the above code if tree_string is JUST a Newick tree.
In your case, from the example you have a full NEXUS
file, so use the Bio.Nexus.Nexus parser.

Peter




More information about the Biopython mailing list