tree.js

Summary
tree.js
bbop.model.treePurpose: Extend bbop.model in model.js to be handy for a (phylo)tree.
bbop.model.tree.node
Functions
nodeSame as parent, but just takes id in constructor.
bbop.model.tree.edge
Functions
edgeSame as parent, but adds distance.
distanceReturn an edge’s “distance”.
cloneMake sure that clone gets distance as well.
bbop.model.tree.graph
Functions
graphSame as parent.
default_sortThe default comparator function for ordering the brackets.
layoutWith the current graph, produce a usable layout object.
dump_cohortsDump the cohorts; for debugging?
dump_distDump distances; for debugging?
dump_bracketsDump brackets; for debugging?

bbop.model.tree

Purpose: Extend bbop.model in model.js to be handy for a (phylo)tree.

TODO: /Much/ better documentation.  I have no idea what’s going on in there anymore...

TODO: See: http://raphaeljs.com/graffle.html

TODO: Subtree calculation during bracket_down.

bbop.model.tree.node

Summary
Functions
nodeSame as parent, but just takes id in constructor.

Functions

node

bbop.model.tree.node = function(new_id)

Same as parent, but just takes id in constructor.

Arguments

new_ida unique id for the node

bbop.model.tree.edge

Summary
Functions
edgeSame as parent, but adds distance.
distanceReturn an edge’s “distance”.
cloneMake sure that clone gets distance as well.

Functions

edge

bbop.model.tree.edge = function(parent,
child,
distance)

Same as parent, but adds distance.

distance

bbop.model.tree.edge.prototype.distance = function()

Return an edge’s “distance”.

Parameters

n/a

Returns

number

clone

bbop.model.tree.edge.prototype.clone = function()

Make sure that clone gets distance as well.

Parameters

n/a

Returns

bbop.model.tree.edge

bbop.model.tree.graph

Summary
Functions
graphSame as parent.
default_sortThe default comparator function for ordering the brackets.
layoutWith the current graph, produce a usable layout object.
dump_cohortsDump the cohorts; for debugging?
dump_distDump distances; for debugging?
dump_bracketsDump brackets; for debugging?

Functions

graph

bbop.model.tree.graph = function()

Same as parent.  Needs some more functionality...

default_sort

this.default_sort = function(a,
b)

The default comparator function for ordering the brackets.  Alphabetical down.

Parameters

aa bracket item
ba bracket item

Returns

string

layout

this.layout = function ()

With the current graph, produce a usable layout object.

TODO: layout should take bracket ordering func

Parameters

n/a

Returns

a rather complicated layout object

dump_cohorts

this.dump_cohorts = function()

Dump the cohorts; for debugging?

Parameters

n/a

Returns

n/a

dump_dist

this.dump_dist = function(in_arg)

Dump distances; for debugging?

Parameters

in_argstring; ‘child’/’parent’?

Returns

n/a

dump_brackets

this.dump_brackets = function(brack)

Dump brackets; for debugging?

Parameters

brack[optional] ???

Returns

n/a

Purpose: Basic edged graph and operations.
bbop.model.tree.node = function(new_id)
Same as parent, but just takes id in constructor.
bbop.model.tree.edge = function(parent,
child,
distance)
Same as parent, but adds distance.
bbop.model.tree.edge.prototype.distance = function()
Return an edge’s “distance”.
bbop.model.tree.edge.prototype.clone = function()
Make sure that clone gets distance as well.
bbop.model.tree.graph = function()
Same as parent.
this.default_sort = function(a,
b)
The default comparator function for ordering the brackets.
this.layout = function ()
With the current graph, produce a usable layout object.
this.dump_cohorts = function()
Dump the cohorts; for debugging?
this.dump_dist = function(in_arg)
Dump distances; for debugging?
this.dump_brackets = function(brack)
Dump brackets; for debugging?
Close