I am trying load newick string from a file using following code:
filename = templist.lower().replace(" ","") + ".nwk" tt = Tree(filename, format=1)
but getting following error:
tt = Tree(filename, format=1) # Loads a tree structure from a newick string. The returned variable tt is the root node for the tree. File "/python2.7/dist-packages/ete2-2.2.1072-py2.7.egg/ete2/coretype/tree.py", line 225, in __init__ read_newick(newick, root_node = self, format=format) File "/python2.7/dist-packages/ete2-2.2.1072-py2.7.egg/ete2/parser/newick.py", line 237, in read_newick 'Unexisting tree file or Malformed newick tree structure.' ete2.parser.newick.NewickError: Unexisting tree file or Malformed newick tree structure.
I have verified the file format, and it is Ok. I think I am passing the variable in wrong way, can you please guide me to pass filename as variable.
When I pass the filename as string without using variable it is working fine, but I need to use variable value to load tree.