Newick parser

Fredrik Lundh fredrik at pythonware.com
Sun Sep 21 20:53:28 CEST 2008


aditya shukla wrote:

> Hello folks , i have a .nwk file.I want to parser the tree from that 
> file.I found this python parser for newick trees.
> http://www.daimi.au.dk/~mailund/newick.html
> 
> But i don't understand the usage properly.What i wanna do is if i have a 
> file in the location c:\\files\\file1.nwk , then i wanna parse the trees 
> in that file.

judging from the docs, you should be able to do e.g.

   from newick import parse_tree

   file = open("c:\\files\\file1.nwk")
   text = file.read()

   print parse_tree(text)

</F>




More information about the Python-list mailing list