GithubHelp home page GithubHelp logo

lwphylo's Introduction

lwPhylo

A lightweight, low level javascript library to plot phylogenies from a Newick file. It uses no dependencies on any other package, but is designed to be given to the D3 library for visualisation.

Functionality

Newick trees can be parsed using the readTree() function. This object can then be wrapped in three main functions; rectangleLayout() to produce a "regular" phylogenetic tree, radialLayout() to produce a circular phylogeny, and unrooted() to produce an unrooted tree via the equal angle layout algorithm.

Examples

A quick tutorial is now available to see on Observable: https://observablehq.com/@euphrasiologist/lwphylo-tutorial
It goes over the three tree layout functions, and hopefully is all quite straightforward.

Stay tuned for examples in the browser.

Acknowledgements

Original implementation of tree layout schemes are found here: https://github.com/ArtPoon/ggfree.

Citation

Brown, M (2020). lwPhylo: A lightweight, low level javascript library to plot phylogenies from a Newick file, version 1.1.2

lwphylo's People

Contributors

euphrasiologist avatar

Stargazers

 avatar

Watchers

 avatar

lwphylo's Issues

Align labels in radial and unrooted trees

Hello

Is there a way to align the labels for radial (and unrooted) trees so they look similar to the second example?
See the first example to see what they currently look like.
p.s. I'm using the data.radii object and x0 and y0 keys to align inside the svg

screenshot

Mean$1 is not a function

Hello

First of all, thank you for building this library - it's such a great tool!

I'm having some issues though when I'm trying to use the rectangular layout. I'm getting the following error in the console:

ERROR TypeError: mean$1 is not a function
    at getHorizontal (lwphylo.js:613)

this is what I'm using to load it:

treeString = "(((t13:0.7790112703,(t1:0.5220431073,t20:0.202340699):0.4815443838):0.3861331961,((t2:0.6067991166,t14:0.8800587754):0.9964700027,((((((t3:0.4080314219,t18:0.3741820636):0.009094102541,(t17:0.4135466665,t7:0.5426334133):0.3566526775):0.2189731502,(t19:0.1208170669,t5:0.1075042752):0.09370149556):0.5956722216,t6:0.8589682591):0.805277324,t15:0.8797334728):0.4385470266,t8:0.2457124488):0.426782382):0.365341407):0.2617313648,((t11:0.5743931823,t16:0.5058572968):0.2053716865,((t10:0.3861640515,t12:0.6367075392):0.739508104,(t4:0.6088686911,t9:0.02072311775):0.856660692):0.5528816739):0.4895316709);";
const parsedTree = lwphylo.readTree(treeString);
const rectPhylo = lwphylo.rectangleLayout(parsedTree);

This only happens when I'm trying to use the rectangleLayout. It works fine with unrooted and radialLayout and it draws the content as expected.

Also, I'm using npm to install it, version 1.1.3. And in my application, I'm loading the lwphylo.js file. However, if I'm loading the lwphylo.min.js I get a different error
ERROR TypeError: o is not a function - but I assume it's referring to the same issue
Any ideas where the problem is?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.