[Biopython-dev] Phylo: support for JSON trees

Fabio Zanini fabio.zanini at fastmail.fm
Sat Dec 12 00:12:40 UTC 2015


Thanks David, I wasn't aware of the NexSON format.

I feel I should clarify a point. NeXML/NexSON try to establish a
standard that reaches far beyond trees, and I agree that such
standardization efforts are good.

However, standardization might take a long time and consideration. More
modestly, I just wish there was a way to read Biopython trees in
JavaScript without copy/paste the same 100 lines of code into every one
of my Python projects.

Although a good standard format is what we all wish for, basic JSON
support would still be much, much better than no support at all ;-)

Cheers,
Fabio

On 11/12/2015 23:51, David Winter wrote:
> Hi All, 
> 
> There is at least one JSON specification for phylogenies. The Open Tree
> of Life project (http://opentreeoflife.org/) uses a json "translation"
> of nexml they call nexson: https://opentree.wikispaces.com/NexSON.
> 
> There is python code that handles at least some reading/writing ofthe
> format: https://github.com/OpenTreeOfLife/peyotl
> 
> It's specific to open tree project, but it's at least something that's
> out there.
> 
> On Wed, Dec 9, 2015 at 3:21 PM, Fields, Christopher J
> <cjfields at illinois.edu <mailto:cjfields at illinois.edu>> wrote:
> 
>     Agreed.  This is veering towards the deadly sin of reinvention. 
>     Instead of that, maybe a good look should be taken at the current
>     XML tree formats to see if they can reasonably be represented in or
>     translated to JSON.  And only if a JSON-based format doesn't already
>     exist.
> 
>     Chris
> 
>     > On Dec 9, 2015, at 4:12 PM, Peter Cock <p.j.a.cock at googlemail.com
>     <mailto:p.j.a.cock at googlemail.com>> wrote:
>     >
>     > Hi Fabio,
>     >
>     > You're right JSON has a lot of advantages (people said this about XML
>     > too), but inventing your own file format is not something to be taken
>     > lightly.
>     >
>     > Are there really no pre-existing tree formats using JSON?
>     >
>     > Peter
>     >
>     >> On Wed, Dec 9, 2015 at 9:12 PM, Fabio Zanini
>     <fabio.zanini at fastmail.fm <mailto:fabio.zanini at fastmail.fm>> wrote:
>     >> Hi all,
>     >>
>     >> I've been working with phylogenetic trees for a few years and
>     found it
>     >> very convenient to convert Bio.Phylo trees to/from JSON, e.g.
>     >>
>     >> {'name': 'root', 'children': [
>     >>  {'name': 'leaf1', 'branch_length': 0.01, children: []},
>     >>  {'name': 'leaf2', 'branch_length': 0.02, children: []}]
>     >> }
>     >>
>     >> I would like to implement such import/export functions into
>     Bio.Phylo if
>     >> there is interest. Because Python has a JSON parser already, it's
>     like
>     >> 50 lines of code altogether.
>     >>
>     >> The main arguments in favour of this are:
>     >> - *JSON is standard for the web*, and the web is where all is moving
>     >> (Jupyter, bokeh, but also specific tree-oriented web apps such as
>     >> http://nextflu.org)
>     >> - embedding metadata is trivial (just add more keys to those dicts!)
>     >>
>     >> How's that sound, shall I make a github PR?
>     >>
>     >> Cheers,
>     >> Fabio
>     >>
>     >>
>     >> _______________________________________________
>     >> Biopython-dev mailing list
>     >> Biopython-dev at mailman.open-bio.org
>     <mailto:Biopython-dev at mailman.open-bio.org>
>     >> http://mailman.open-bio.org/mailman/listinfo/biopython-dev
>     > _______________________________________________
>     > Biopython-dev mailing list
>     > Biopython-dev at mailman.open-bio.org
>     <mailto:Biopython-dev at mailman.open-bio.org>
>     > http://mailman.open-bio.org/mailman/listinfo/biopython-dev
> 
>     _______________________________________________
>     Biopython-dev mailing list
>     Biopython-dev at mailman.open-bio.org
>     <mailto:Biopython-dev at mailman.open-bio.org>
>     http://mailman.open-bio.org/mailman/listinfo/biopython-dev
> 
> 
> 
> 
> -- 
> David Winter
> Postdoctoral Research Associate
> Center for Evolutionary Medicine and Informatics
> The Biodesign Institute
> Arizona State University
> 
> ph: +1 480 519 5113
> w: www.david-winter.info <http://www.david-winter.info>
> lab: http://cartwrig.ht/lab/
> blog: sciblogs.co.nz/the-atavism <http://sciblogs.co.nz/the-atavism>
> 
> 
> _______________________________________________
> Biopython-dev mailing list
> Biopython-dev at mailman.open-bio.org
> http://mailman.open-bio.org/mailman/listinfo/biopython-dev
> 


More information about the Biopython-dev mailing list