API

The Phylo.API submodule provides the API that must be extended for new AbstractTree, AbstractNode and AbstractBranch subtypes.

Usage

Providing additional code to extend the functionality of the system is simple:

using Phylo
importall Phylo.API

type SimplestTree <: AbstractTree{Int, Int}
    nodes::OrderedDict{Int, BinaryNode{Int}}
    branches::Dict{Int, Branch{Int}}
end

function _addnode!(tree::SimplestTree, num)
    _setnode!(tree, num, BinaryNode{Int}())
    return num
end

creates a new SimplestTree type (a subtype of AbstractTree) and extends Phylo.API._addnode!() (and therefore the directly accessible addnode!() interface) to handle the SimplestTree subtype of AbstractTree. See docs here to see which Phylo.API functions have to be extended for any new subtype, and which have default implementations.

# Phylo.APIModule.

Phylo.API submodule

The Phylo.API submodule should be import[all]ed if you want to create a new phylogeny, node or branch subtype. Otherwise it can be ignored.

source

# Phylo.API._addbranch!Function.

_addbranch!(tree::AbstractTree, source, destination;
            length::Float64 = NaN,
            branchname = _newbranchlabel(tree))

Must be implemented for any AbstractTree subtype.

source

# Phylo.API._addnode!Function.

_addnode!(tree::AbstractTree, nodename)

Must be implemented for any AbstractTree subtype.

source

# Phylo.API._addnodes!Function.

_addnodes!(tree::AbstractTree, nodenames::AbstractVector)
_addnodes!(tree:AbstractTree, count::Integer)

source

# Phylo.API._addoutbound!Function.

_addinbound!(node::AbstractNode, outbound)

Must be implemented for any AbstractNode subtype.

source

# Phylo.API._branch!Method.

_branch!(tree::AbstractTree, source, length::Float64, destination, branchname)

source

# Phylo.API._branchtypeFunction.

_branchtype(::AbstractTree)

Returns type of branches in a tree.

source

# Phylo.API._deletebranch!Function.

_deletebranch!(tree::AbstractTree, branchname)

Must be implemented for any AbstractTree subtype.

source

# Phylo.API._deletenode!Function.

_deletenode!(tree::AbstractTree, nodename)

Must be implemented for any AbstractTree subtype.

source

# Phylo.API._deleteoutbound!Function.

_deleteoutbound!(node::AbstractNode, outbound)

Must be implemented for any AbstractNode subtype.

source

# Phylo.API._dstFunction.

_dst

Return destination node for a branch. Must be implemented for any AbstractBranch subtype.

source

# Phylo.API._getbranchFunction.

_getbranch(tree::AbstractTree, branchname)

Must be implemented for any AbstractTree subtype.

source

# Phylo.API._getbranchesFunction.

_getbranches(tree::AbstractTree)

Must be implemented for any AbstractTree subtype.

source

# Phylo.API._getbranchnamesFunction.

_getbranchnames(tree::AbstractTree)

Must be implemented for any AbstractTree subtype.

source

# Phylo.API._getheightMethod.

_getheight(tree::AbstractTree, nodename)

source

# Phylo.API._getinboundFunction.

_getinbound(node::AbstractNode)

Must be implemented for any AbstractNode subtype.

source

# Phylo.API._getlengthFunction.

_getlength

Return length of a branch. May be implemented for any AbstractBranch subtype.

source

# Phylo.API._getnodeFunction.

_getnode(tree::AbstractTree, nodename)

Must be implemented for any AbstractTree subtype.

source

# Phylo.API._getnodenamesFunction.

_getnodenames(tree::AbstractTree)

Must be implemented for any AbstractTree subtype.

source

# Phylo.API._getnodesFunction.

_getnodes(tree::AbstractTree)

Must be implemented for any AbstractTree subtype.

source

# Phylo.API._getoutboundsFunction.

_getoutbounds(node::AbstractNode)

Must be implemented for any AbstractNode subtype.

source

# Phylo.API._getrootheightMethod.

_getrootheight(::AbstractTree)

source

# Phylo.API._hasbranchFunction.

_hasbranch(tree::AbstractTree, branchname)

Must be implemented for any AbstractTree subtype.

source

# Phylo.API._hasheightMethod.

_hasheight(tree::AbstractTree, nodename)

source

# Phylo.API._hasinboundFunction.

_hasinbound(node::AbstractNode)

Must be implemented for any AbstractNode subtype.

source

# Phylo.API._hasinboundspaceMethod.

_hasinboundspace(node::AbstractNode)

source

# Phylo.API._hasnodeFunction.

_hasnode(tree::AbstractTree, nodename)

Must be implemented for any AbstractTree subtype.

source

# Phylo.API._hasoutboundspaceFunction.

_hasoutboundspace(node::AbstractNode)

source

# Phylo.API._hasrootheightMethod.

_hasrootheight(::AbstractTree)

source

# Phylo.API._indegreeMethod.

_indegree(node::AbstractNode)

source

# Phylo.API._isinternalMethod.

_isinternal(node::AbstractNode)

source

# Phylo.API._isleafMethod.

_isleaf(node::AbstractNode)

source

# Phylo.API._isrootMethod.

_isroot(node::AbstractNode)

source

# Phylo.API._isunattachedMethod.

_isunattached(node::AbstractNode)

source

# Phylo.API._newbranchlabelFunction.

_newbranchlabel(tree::AbstractTree)

source

# Phylo.API._newnodelabelFunction.

_newnodelabel(tree::AbstractTree)

source

# Phylo.API._nodetypeFunction.

_nodetype(::AbstractTree)

Returns type of nodes in a tree.

source

# Phylo.API._outdegreeFunction.

_outdegree(node::AbstractNode)

Must be implemented for any AbstractNode subtype.

source

# Phylo.API._setdst!Function.

_setdst!

Set destination node for a graph. Must be implemented for any AbstractBranch subtype.

source

# Phylo.API._setheight!Method.

_setheight!(::AbstractTree, nodename, value)

source

# Phylo.API._setinbound!Function.

_setinbound!(node::AbstractNode, inbound)

Must be implemented for any AbstractNode subtype.

source

# Phylo.API._setrootheight!Method.

_setrootheight!(::AbstractTree, value)

source

# Phylo.API._setsrc!Function.

_setsrc!

Set source node for a branch. Must be implemented for any AbstractBranch subtype.

source

# Phylo.API._srcFunction.

_src

Return source node for a branch. Must be implemented for any AbstractBranch subtype.

source

# Phylo.API._validateMethod.

_validate(::AbstractTree)

source