Biopython
Convert from any graph formatto Biopython Convert from Biopythonto any other format
Biopython is a freely available, open-source collection of Python modules for computational molecular biology and bioinformatics. It began in August 1999 as a volunteer-driven project (inspired by BioPerl) and released its first public version in 2000; it remains maintained by an international group of contributors and distributed under the permissive Biopython License. The library bundles parsers, data models, and convenience wrappers for reading, writing, and processing common bioinformatics formats. Its central abstraction for sequence data is the SeqRecord object, which pairs a sequence with metadata such as an identifier, description, and annotations, exposed through the uniform Bio.SeqIO read/write interface.
For graph and tree work, the relevant component is the Bio.Phylo module, introduced in Biopython 1.54 and described in a 2012 paper led by Eric Talevich (with Brandon Invergo, Peter Cock, and Brad Chapman). Bio.Phylo provides a source-format-independent way to work with phylogenetic trees behind a consistent four-function API: parse(), read(), write(), and convert(). All parsers return a common object type regardless of the input format, so a tree read from one representation can be written to another with convert(). Supported formats include Newick, Nexus, phyloXML, and NeXML, plus CDAO.
The tree data model is deliberately simple: a Tree object holds global phylogeny information and references a root Clade, and each Clade recursively contains child clades along with node attributes like branch length and name. There is no hidden data structure beneath this, which keeps traversal and algorithm code readable. Format-specific subclasses (for example PhyloXML and Newick variants) inherit from the base classes to expose extra fields while preserving the shared operations. Beyond I/O, the module offers tree construction (UPGMA, neighbor-joining, parsimony), consensus and bootstrap analysis, and visualization via ASCII art, matplotlib dendrograms, and Graphviz.
For the graph-conversion world, Bio.Phylo's to_networkx function exports a tree into a NetworkX graph (and adjacency matrix), bridging phylogenetics into general-purpose network analysis and, indirectly, any format NetworkX can emit. It integrates with the wider Biopython ecosystem, reusing SeqIO for sequence extraction. Honest limitations: trees are rooted, hierarchical structures rather than arbitrary graphs, so Biopython is not a general graph library like NetworkX or igraph; its Graphviz plotting ignores branch lengths and uses arbitrary node spacing, which the documentation itself flags as misleading; and XML-based formats parse more slowly than plain Newick.
Graph Formats(Input & Output)
Frequently Asked Questions
What graph file formats does Biopython support?
See the list on this page — it shows every format Biopython can read, write and display.
How do I import a graph into Biopython?
Convert your file to a format Biopython can read, then open it in Biopython. Use GraphInOut to get a Biopython-compatible file in seconds.
How do I convert a file so Biopython can open it?
Use the convert links above — upload or paste your graph, pick a format Biopython accepts and download the result, right in your browser.