Skip to content

Instantly share code, notes, and snippets.

View spond's full-sized avatar

Sergei Pond spond

View GitHub Profile
@spond
spond / README.md
Last active November 22, 2023 09:52
phylotree.js "Hello World"

The simplest example of using phylotree.js

Create a phylotree.js object from a Newick tree string, and display it in an SVG element using default settings and styles. Because the default tree view supports clickable nodes, it is necessary to include jQuery and Bootstrap. It is always necessary to include d3, and phylotree.js script and styles (unless overridden by the user).

Click on internal nodes to bring up menus that allow you to collapse/select them.

@spond
spond / README.md
Last active May 3, 2017 20:27
Vanilla tree

Non-interactive tree using phylotree.js

This is an example of using phylotree.js settings to create a tree which is suitable for a static display: no clickable nodes, nothing is selectable, fixed sizes in both dimensions.

The Newick string is loaded from a file using an asynchronous d3.text call.

@spond
spond / README.md
Last active August 29, 2015 14:24
Radial tree layout

Different tree layouts.

In addition to linear/cladogram layouts, phylotree.js also implements a radial or cicrular layout. Invoking it is a matter of overriding the default setting.

It is important to set the radial option prior to binding Newick data to the tree, because at that time nodes are mapped to screen coordinates using current settings.

The layout mode can be changed after the tree has been rendered, but then it is

@spond
spond / README.md
Created July 13, 2015 22:21
Multiple trees on page

Multiple trees on a single page

/* 1. include a file to define the genetic code
Note the use of base directory and path forming variables to make this analysis
independent of directory placement
*/
/*incFileName = HYPHY_LIB_DIRECTORY+"TemplateBatchFiles"+DIRECTORY_SEPARATOR+"TemplateModels"+DIRECTORY_SEPARATOR+"chooseGeneticCode.def"; */
/* ExecuteCommands ("#include \""+incFileName+"\";"); */
/* #include "functions.txt";*/ /*functions.txt has the genetic code*/
@spond
spond / EDEPS.bf
Created August 15, 2015 18:23
EDEPS HBL files
RequireVersion ("2.22");
VERBOSITY_LEVEL = 1;
// namespace 'io' for interactive/datamonkey i/o functions
LoadFunctionLibrary("lib2014/IOFunctions.bf");
// namespace 'utility' for convenience functions
LoadFunctionLibrary("lib2014/UtilityFunctions.bf");
io.displayAnalysisBanner ({"info" : "EDEPS is a modification of DEPS to look for directional evolution along all or
@spond
spond / dNdS.bf
Created August 21, 2015 19:50
Pairwise dN/dS estimation
/*
THIS HyPhy BATCH LANGUAGE FILE IS PROVIDED AS AN EXAMPLE/TOOL FOR
THE 2nd EDITION OF 'The Phylogenetic Handbook'
Written by
Sergei L Kosakovsky Pond (spond@ucsd.edu)
Art FY Poon (apoon@ucsd.edu)
Simon DW Frost (sdfrost@ucsd.edu)
@spond
spond / README.md
Last active February 15, 2018 19:21
clone-comaprtment-view

Within-host HIV tree.

This is an example which parses leaf names for meta information, including compartment, sample date, and copy number, and then annotates the tree accordingly. This example demonstrates how to use styling callbacks, e.g. style_nodes, and node_span.

The example also uses Bootstrap to allow interactive tree input via a model dialog.

More documentation forthcoming.

@spond
spond / README.md
Last active March 11, 2016 21:42
Color terminal branches based on user-specified clustering; style interior branches based on bootstrap support.

Annotated tree

An example that shows how to use styling call-backs to

  1. Color terminal branches based on an externally supplied annotation (cluster assignment)
  2. Adjust thickness of interior branches based on their bootstrap support
  3. Label interior nodes (for the cladogram layout) with bootstrap values
@spond
spond / README.md
Last active March 10, 2016 18:38
FUBAR estimates of dN-dS

Plot site-by-site estimates of dN-dS from FUBAR .csv files

Take the output (main .CSV) of FUBAR, and create a D3 plot over sites. Optionally, partition the plot into chunks of different color (e.g. gene/genome regions), and annotate them with horizontal bars.