[Biopython-dev] [Wg-phyloinformatics] GSoC Weekly Update 11: PhyloXML for Biopython
Eric Talevich
eric.talevich at gmail.com
Thu Aug 6 12:47:47 UTC 2009
On Thu, Aug 6, 2009 at 4:06 AM, Peter <biopython at maubp.freeserve.co.uk>wrote:
> On Wed, Aug 5, 2009 at 11:31 PM, Eric Talevich<eric.talevich at gmail.com>
> wrote:
>
> > OK, it works now but the resulting trees look a little odd. The options
> > needed to get a reasonable tree representation are fiddly, so I made
> > draw_graphviz() a separate function that basically just handles the RTFM
> > work (not trivial), while the graph export still happens in
> to_networkx().
> >
> > Here are a few recipes and a taste of each dish. The matplotlib engine
> seems
> > usable for interactive exploration, albeit cluttered -- I can't hide the
> > internal clade identifiers since graphviz needs unique labels, though
> maybe
> > I could make them less prominent. ...
>
> Graphviv does need unique names, and the node labels default to the
> node name - but you can override this and use a blank label if you want.
> How are you calling Graphviz? There are several Python wrappers out
> there, or you could just write a dot file directly and call the graphviz
> command line tools.
>
I'm using the networkx and pygraphviz wrappers, since networkx already
partly wraps pygraphviz.
The direct networkx->matplotlib rendering engine figures out the
associations correctly when I pass a LabeledDiGraph instance, using Clade
objects as nodes and the str() representation as the label -- so
networkx.draw(tree) shows a tree with the internal nodes all labeled as
"Clade". But networkx.draw_graphviz(tree), while otherwise working the same
as the other networkx drawing functions, seems to convert nodes to strings
earlier, and then treats all "Clade" strings as the same node.
Surely there's a way to fix this through the networkx or pygraphviz API, but
I couldn't figure it out yesterday from the documentation and source code.
I'll poke at it some more today and try using blank labels.
Thanks,
Eric
More information about the Biopython-dev
mailing list