npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

alcmonavis-poeschli

v1.0.15

Published

A packaged version of Christain M. Zmasek's archaeopteryx.js phylogenetic tree viewer

Downloads

21

Readme

Archaeopteryx.js

Archaeopteryx.js is a software tool for the visualization and analysis of highly annotated phylogenetic trees.

Website

https://sites.google.com/site/cmzmasek/home/software/archaeopteryx-js

npm

https://www.npmjs.com/package/archaeopteryx

GitHub

https://github.com/cmzmasek/archaeopteryx-js

Examples

Detailed developer documentation

https://docs.google.com/document/d/1COVe0iYbKtcBQxGTP4_zuimpk2FH9iusOVOgd5xCJ3A/edit

Dependencies

Archaeopteryx.js has the following dependencies:

  • forester.js: https://www.npmjs.com/package/archaeopteryx
  • phyloxml.js: https://www.npmjs.com/package/phyloxml
  • d3.js (version 3): https://www.npmjs.com/package/d3/v/3.5.17
  • jQuery (1.12.4): https://www.npmjs.com/package/jquery/v/1.12.4
  • jQuery UI (1.12.1): https://www.npmjs.com/package/jquery-ui/v/1.12.1
  • sax.js (1.2.4): https://www.npmjs.com/package/sax/v/1.2.4

For file (Newick/New Hampshire, phyloXML) and graphics (PNG, SVG) download/export, the following five libraries are required as well:

  • canvg: https://www.npmjs.com/package/canvg
  • rgbcolor: https://www.npmjs.com/package/rgbcolor
  • Blob.js: https://github.com/eligrey/Blob.js
  • canvas-toBlob.js (needed in some versions of Internet Explorer and Opera): https://github.com/eligrey/canvas-toBlob.js
  • FileSaver.js: https://github.com/eligrey/FileSaver.js

Additionally, Archaeopteryx.js also requires the following CSS:

  • jquery-ui.css: https://code.jquery.com/ui/1.12.0/themes/base/jquery-ui.css

Basic Example of HTML for launching Archaeopteryx.js

Example of HTML page to launch a basic Archaeopteryx.js instance:

<!DOCTYPE html>
<meta charset="utf-8">
<head>
   <title>Archaeopteryx.js Basic Demo</title>

   <!-- For MS IE/Edge compatibility:-->
   <meta http-equiv="X-UA-Compatible" content="IE=100">

   <!-- D3.js, jQuery, and jQuery UI:-->
   <script src="http://d3js.org/d3.v3.min.js"></script>
   <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
   <script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script>

   <!-- SAX XML parser:-->
   <script src="http://www.phyloxml.org/js/dependencies/sax.js"></script>

   <!-- Archaeopteryx.js requires forester.js and phyloxml.js:-->
   <script src="http://path/to/phyloxml.js"></script>
   <script src="http://path/to/forester.js"></script>
   <script src="http://path/to/archaeopteryx.js"></script>

   <!-- CSS for jQuery UI: -->
   <link rel="stylesheet" href="https://code.jquery.com/ui/1.12.0/themes/base/jquery-ui.css">

   <script>
       function load() {
           var options = {};
           options.backgroundColorDefault = '#f0f0f0';
           var settings = {};
           var loc = 'https://raw.githubusercontent.com/cmzmasek/archaeopteryx-js/master/test/data/phyloxml_trees/apaf.xml';

           jQuery.get(loc,
                   function (data) {
                       var tree = null;
                       try {
                           tree = archaeopteryx.parseTree(loc, data, true, false);
                       }
                       catch (e) {
                           alert("error while parsing tree: " + e);
                       }
                       if (tree) {
                           try {
                               archaeopteryx.launch('#phylogram1', tree, options, settings);
                           }
                           catch (e) {
                               alert("error while launching archaeopteryx: " + e);
                           }
                       }
                   },
                   "text")
                   .fail(function () {
                               alert("error: failed to read tree(s) from \"" + loc + "\"");
                           }
                   );
       }
   </script>
</head>

<body onload="load()">
<div>
   <h2>Archaeopteryx.js Basic Demo</h2>
   <div id='phylogram1'></div>
   <div id='controls0' class='ui-widget-content'></div>
</div>
</body>

forester.js

forester.js is a general suite for dealing with phylogenetic trees.

forester.js Example

This basic example shows how to parse a New Hampshire formatted String into to a object representing a phylogenetic tree. Followed by pre- and post-order traversal, and writing back to a New Hampshire formatted String.

Change './forester' to 'forester' if you use this code outside of this package

var forester = require('./forester').forester;

var newHampshireFormattedString = "(((a:1,b:1,c:1)N:2,(d:1,e:1)M:4)O:4,f:1)R:1;";
var phylogeneticTree = forester.parseNewHampshire(newHampshireFormattedString);

console.log('Pre-order traversal:');
forester.preOrderTraversalAll(forester.getTreeRoot(phylogeneticTree), function (n) {
    console.log(n.name + ':' + n.branch_length);
});

console.log('Post-order traversal:');
forester.postOrderTraversalAll(forester.getTreeRoot(phylogeneticTree), function (n) {
    console.log(n.name + ':' + n.branch_length);
});

console.log('In New Hampshire format:');
var nh = forester.toNewHampshire(phylogeneticTree);
console.log(nh);

Expected output:

Pre-order traversal:
R:1
f:1
O:4
M:4
e:1
d:1
N:2
c:1
b:1
a:1
Post-order traversal:
a:1
b:1
c:1
N:2
d:1
e:1
M:4
O:4
f:1
R:1
In New Hampshire format:
(((a:1,b:1,c:1)N:2,(d:1,e:1)M:4)O:4,f:1)R:1;