I am trying to display attributes of a tree. The tree has been loaded in newick format with attributes (annotated in the newick file) e.g.:
"Genes" , "Identical", "Duplicated" etc.
When I try to make an image of the tree with these attributes I get an error. I am able to print the attributes and tree as ascii.
t=Tree('sampleGeneTree.tree', format=1) ts = TreeStyle() ts.show_leaf_name = True def my_layout(node): #dont include root if not node.is_leaf() and node.up: #add attributes node.add_face(TextFace(node.name), column=1, position="branch-right") node.add_face(AttrFace(node.Genes, text_prefix="/"), column=2, position="branch-top") ts.layout_fn = my_layout ts.show(tre_style=ts)
This gives this error :
AttributeError: 'TreeNode' object has no attribute '10'
10 is the value of the node.Genes.
What am I doing wrong here ?