diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index b89177a0..a53d7ca8 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-07-15T22:38:06","documenter_version":"1.5.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-07-18T01:52:13","documenter_version":"1.5.0"}} \ No newline at end of file diff --git a/dev/api/index.html b/dev/api/index.html index 237ab1d1..c0568553 100644 --- a/dev/api/index.html +++ b/dev/api/index.html @@ -10,11 +10,11 @@ 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 imported if you want to create a new phylogeny, node or branch subtype. Otherwise it can be ignored.

source
Phylo.API._addconnection!Function
_addconnection!(tree::AbstractTree, node::AbstractNode, branch)

Add a connection to an unrooted node. Must be implemented for any unrooted AbstractNode subtype unless this happens when a branch is added.

source
Phylo.API._addinbound!Function
_addinbound!(tree::AbstractTree, node::AbstractNode, inbound)

Adds a branch to the input of a rooted node. Must be implemented for any rooted AbstractNode subtype unless this happens when a branch is created.

source
Phylo.API._addoutbound!Function
_addoutbound!(tree::AbstractTree, node::AbstractNode, branch)

Add an outbound branch to a rooted node. Must be implemented for any Rooted AbstractNode subtype unless this happens when a branch is created.

source
Phylo.API._branchdatatypeFunction
_branchdatatype(::Type{<:AbstractTree})

Returns the type of the branch info data.

source
Phylo.API._branchdimsFunction
_branchdims(::Type{<:AbstractTree})

Returns the dimensions of the branch lengths for the tree.

source
Phylo.API._clearrootheight!Function
_clearrootheight!(::AbstractTree)
source
Phylo.API._connFunction
_conn(branch::AbstractBranch, exclude::AbstractNode)

Return the connection for a branch that isn't the exclude node. May be implemented for any Unrooted AbstractBranch subtype, otherwise will use _conns.

source
Phylo.API._connsFunction
_conns(tree::AbstractTree, branch::AbstractBranch)

Return a vector of connections for a branch. Must be implemented for any Unrooted AbstractBranch subtype, otherwise can combine _src and _dst.

source
Phylo.API._createbranch!Function
_createbranch!(tree::AbstractTree, source, destination[,
-               length][, data])

Create a new branch and add it to a tree. Must be implemented for any AbstractTree subtype.

source
Phylo.API._createnode!Function
_createnode!(tree::AbstractTree, nodename[, data])

Must be implemented for any AbstractTree subtype.

source
Phylo.API._degreeFunction
_degree(tree::AbstractTree, node::AbstractNode)

Degree of node. Must be implemented for Unrooted nodes, otherwise can be inferred from indegree and outdegree.

source
Phylo.API._deletebranch!Function
_deletebranch!(tree::AbstractTree, branch)

Delete a branch, reoving it from a tree. 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._dstFunction
_dst(branch::AbstractBranch)

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

source
Phylo.API._getbranchFunction
_getbranch(::AbstractTree, id)

Returns the branch or name associated with id (which could be a name or a branch) from a tree. Must be implemented for any PreferBranchObjects tree and branch label type.

source
Phylo.API._getbranchesFunction
_getbranches(tree::AbstractTree)

Returns a vector of branches for a OneTree tree. Either _getbranches() or _getbranchnames() must be implemented for any OneTree tree type.

source
Phylo.API._getbranchnameFunction
_getbranchname(::AbstractTree, id)

Returns the name of a branch associated with id (which could be a name or a branch) from a tree. Must be implemented for PreferBranchObjects tree types.

source
Phylo.API._getbranchnamesFunction
_getbranchnames(tree::AbstractTree)

Returns a vector of branch names for a OneTree tree. Either _getbranches() or _getbranchnames() must be implemented for any OneTree tree type.

source
Phylo.API._getchildrenFunction
_getchildren(tree::AbstractTree, node)
-_getchildren(tree::AbstractTree, nodename)

Return the child node(s) for this node. May be implemented for any rooted AbstractNode subtype.

source
Phylo.API._getconnectionsFunction
_getconnections(tree::AbstractTree, node::AbstractNode)

Returns all of the connections of a node. Must be implemented for any unrooted AbstractNode subtype, can be inferred from _getinbound and _getoutbounds for a rooted node.

source
Phylo.API._getheightMethod
_getheight(tree::AbstractTree, nodename)
source
Phylo.API._getinboundFunction
_getinbound(tree::AbstractTree, node::AbstractNode)

Get the inbound connection. Must be implemented for any rooted AbstractNode subtype.

source
Phylo.API._getleafnamesFunction
_getleafnames(::AbstractTree, ::TraversalOrder)

Returns the leaf names of a tree. May be implemented for any tree type (otherwise determined from _getnodenames() and _isleaf() functions).

source
Phylo.API._getleavesFunction
_getleaves(::AbstractTree)

Returns the leaves (tips) of a single tree. May be implemented for any OneTree type (otherwise determined from _getnodes() and _isleaf() functions).

source
Phylo.API._getlengthFunction
_getlength

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

source
Phylo.API._getnodeFunction
_getnode(::AbstractTree, id)

Returns the node or name associated with id (which could be a name or a node) from a tree. Must be implemented for any PreferNodeObjects tree and node label type.

source
Phylo.API._getnodenameFunction
_getnodename(::AbstractTree, id)

Returns the name of a node associated with id (which could be a name or a node) from a tree. Must be implemented for PreferNodeObjects tree types.

source
Phylo.API._getnodenamesFunction
_getnodenames(tree::AbstractTree{OneTree})

Returns an iterable collection of node names for a OneTree tree. Can be implemented for any OneTree tree type, especially PreferNodeObjects trees.

source
Phylo.API._getnodesFunction
_getnodes(tree::AbstractTree{OneTree}[, order::TraversalOrder])

Returns an interable collection of nodes for a OneTree tree. _getnodes(tree) must be implemented for a OneTree tree type as a base mechanisms for extracting the node list.

source
Phylo.API._getoutboundsFunction
_getoutbounds(tree::AbstractTree, node::AbstractNode)

Returns the outbound connections of a rooted node. Must be implemented for any rooted AbstractNode subtype.

source
Phylo.API._getparentFunction
_getparent(tree::AbstractTree, node)

Return the parent node for this node. Can be implemented for Rooted node types.

source
Phylo.API._getrootFunction
_getroot(::AbstractTree)

Returns the unique root of a rooted tree. May be implemented for any OneTree type (otherwise determined from _getroots()).

source
Phylo.API._getrootheightFunction
_getrootheight(::AbstractTree)
source
Phylo.API._getrootsMethod
_getroots(::AbstractTree)

Returns the root(s) of a tree. May be implemented for any OneTree type (otherwise determined from _getnodes() and _isroot() functions).

source
Phylo.API._getsiblingsFunction
_getsiblings(tree::AbstractTree, node::AbstractNode)

Returns all of the siblings (actually immediate connections) of a node. May be implemented for any AbstractNode subtype, can be inferred from _getparent and _getchildren for a rooted node or _getconnections for an unrooted node.

source
Phylo.API._gettreeFunction
_gettree(::Pair{Label, AbstractTree})
-_gettree(::AbstractTree, id)

Returns a tree - either itself if it is a single tree, or the single tree in a set with label id. Must be implemented for any ManyTrees type.

source
Phylo.API._gettreeinfoFunction
_gettreeinfo(tree::AbstractTree)
-_gettreeinfo(tree::AbstractTree, treename)

Returns the info data associated with the tree(s).

source
Phylo.API._gettreenameFunction
_gettreename(::AbstractTree)

Returns the name for a single tree. Should be implemented for any OneTree type where they have names.

source
Phylo.API._gettreenamesFunction
_gettreenames(::AbstractTree)

Returns the names for the trees. Can be implemented for any ManyTrees type.

source
Phylo.API._gettreesFunction
_gettrees(::AbstractTree)

Returns the trees in an object. Must be implemented for any ManyTrees type.

source
Phylo.API._hasbranchFunction
_hasbranch(tree::AbstractTree, node[name])

Does the tree contain this branch? Must be implemented for any PreferBranchObjects tree type with a branch label.

source
Phylo.API._hasheightMethod
_hasheight(tree::AbstractTree, nodename)
source
Phylo.API._hasinboundFunction
_hasinbound(tree::AbstractTree, node::AbstractNode)

Must be implemented for any AbstractNode subtype.

source
Phylo.API._hasinboundspaceFunction
_hasinboundspace(tree::AbstractTree, node::AbstractNode)

Is there space for a new inbound connection on a node?

source
Phylo.API._haslengthFunction
_haslength

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

source
Phylo.API._hasnodeFunction
_hasnode(tree::AbstractTree, node[name])

Does the tree contain this node? Must be implemented for any PreferNodeObjects tree type with a node label.

source
Phylo.API._hasoutboundspaceFunction
_hasoutboundspace(tree::AbstractTree, node::AbstractNode)

Is there space for a new outbound connection on a node? Must be implemented if a node has a limit on the number of outbound connections (eg for a binary tree)

source
Phylo.API._hasrootheightMethod
_hasrootheight(::AbstractTree)
source
Phylo.API._hasspaceFunction
_hasspace(tree::AbstractTree, node::AbstractNode)

Is there space for a new connection on a node? Must be implemented if a node has a limit on the number of connections (eg for a binary tree)

source
Phylo.API._indegreeFunction
_indegree(tree::AbstractTree, node)

In degree of node. Can be implemented for rooted nodes, otherwise inferred from _hasinbound.

source
Phylo.API._invalidate!Function
_invalidate!(::AbstractTree, state)

Confirm that the tree is no longer necessarily valid, and remove cache information.

source
Phylo.API._isinternalFunction
_isinternal(tree::AbstractTree, node)

Is the node internal to the tree?

source
Phylo.API._isleafFunction
_isleaf(tree::AbstractTree, node)

Is the node a leaf? Does not need to be implemented for any node type – inferred from _outdegree or _degree - unless tree knows which nodes are leaves and not nodes.

source
Phylo.API._isrootFunction
_isroot(tree::AbstractTree, node)

Is the node a root node of the tree?

source
Phylo.API._isunattachedMethod
_isunattached(tree::AbstractTree, node)

Does the node currently form its own (sub)tree?

source
Phylo.API._leafinfotypeFunction
_leafinfotype(::Type{<:AbstractTree})

Returns the type of the leaf info data.

source
Phylo.API._matchbranchnodetypeFunction
_matchbranchnodetype(::Type{<:AbstractTree},
+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 imported if you want to create a new phylogeny, node or branch subtype. Otherwise it can be ignored.

source
Phylo.API._addconnection!Function
_addconnection!(tree::AbstractTree, node::AbstractNode, branch)

Add a connection to an unrooted node. Must be implemented for any unrooted AbstractNode subtype unless this happens when a branch is added.

source
Phylo.API._addinbound!Function
_addinbound!(tree::AbstractTree, node::AbstractNode, inbound)

Adds a branch to the input of a rooted node. Must be implemented for any rooted AbstractNode subtype unless this happens when a branch is created.

source
Phylo.API._addoutbound!Function
_addoutbound!(tree::AbstractTree, node::AbstractNode, branch)

Add an outbound branch to a rooted node. Must be implemented for any Rooted AbstractNode subtype unless this happens when a branch is created.

source
Phylo.API._connFunction
_conn(branch::AbstractBranch, exclude::AbstractNode)

Return the connection for a branch that isn't the exclude node. May be implemented for any Unrooted AbstractBranch subtype, otherwise will use _conns.

source
Phylo.API._connsFunction
_conns(tree::AbstractTree, branch::AbstractBranch)

Return a vector of connections for a branch. Must be implemented for any Unrooted AbstractBranch subtype, otherwise can combine _src and _dst.

source
Phylo.API._createbranch!Function
_createbranch!(tree::AbstractTree, source, destination[,
+               length][, data])

Create a new branch and add it to a tree. Must be implemented for any AbstractTree subtype.

source
Phylo.API._createnode!Function
_createnode!(tree::AbstractTree, nodename[, data])

Must be implemented for any AbstractTree subtype.

source
Phylo.API._degreeFunction
_degree(tree::AbstractTree, node::AbstractNode)

Degree of node. Must be implemented for Unrooted nodes, otherwise can be inferred from indegree and outdegree.

source
Phylo.API._deletebranch!Function
_deletebranch!(tree::AbstractTree, branch)

Delete a branch, reoving it from a tree. Must be implemented for any AbstractTree subtype.

source
Phylo.API._dstFunction
_dst(branch::AbstractBranch)

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

source
Phylo.API._getbranchFunction
_getbranch(::AbstractTree, id)

Returns the branch or name associated with id (which could be a name or a branch) from a tree. Must be implemented for any PreferBranchObjects tree and branch label type.

source
Phylo.API._getbranchesFunction
_getbranches(tree::AbstractTree)

Returns a vector of branches for a OneTree tree. Either _getbranches() or _getbranchnames() must be implemented for any OneTree tree type.

source
Phylo.API._getbranchnameFunction
_getbranchname(::AbstractTree, id)

Returns the name of a branch associated with id (which could be a name or a branch) from a tree. Must be implemented for PreferBranchObjects tree types.

source
Phylo.API._getbranchnamesFunction
_getbranchnames(tree::AbstractTree)

Returns a vector of branch names for a OneTree tree. Either _getbranches() or _getbranchnames() must be implemented for any OneTree tree type.

source
Phylo.API._getchildrenFunction
_getchildren(tree::AbstractTree, node)
+_getchildren(tree::AbstractTree, nodename)

Return the child node(s) for this node. May be implemented for any rooted AbstractNode subtype.

source
Phylo.API._getconnectionsFunction
_getconnections(tree::AbstractTree, node::AbstractNode)

Returns all of the connections of a node. Must be implemented for any unrooted AbstractNode subtype, can be inferred from _getinbound and _getoutbounds for a rooted node.

source
Phylo.API._getinboundFunction
_getinbound(tree::AbstractTree, node::AbstractNode)

Get the inbound connection. Must be implemented for any rooted AbstractNode subtype.

source
Phylo.API._getleafnamesFunction
_getleafnames(::AbstractTree, ::TraversalOrder)

Returns the leaf names of a tree. May be implemented for any tree type (otherwise determined from _getnodenames() and _isleaf() functions).

source
Phylo.API._getleavesFunction
_getleaves(::AbstractTree)

Returns the leaves (tips) of a single tree. May be implemented for any OneTree type (otherwise determined from _getnodes() and _isleaf() functions).

source
Phylo.API._getnodeFunction
_getnode(::AbstractTree, id)

Returns the node or name associated with id (which could be a name or a node) from a tree. Must be implemented for any PreferNodeObjects tree and node label type.

source
Phylo.API._getnodenameFunction
_getnodename(::AbstractTree, id)

Returns the name of a node associated with id (which could be a name or a node) from a tree. Must be implemented for PreferNodeObjects tree types.

source
Phylo.API._getnodenamesFunction
_getnodenames(tree::AbstractTree{OneTree})

Returns an iterable collection of node names for a OneTree tree. Can be implemented for any OneTree tree type, especially PreferNodeObjects trees.

source
Phylo.API._getnodesFunction
_getnodes(tree::AbstractTree{OneTree}[, order::TraversalOrder])

Returns an interable collection of nodes for a OneTree tree. _getnodes(tree) must be implemented for a OneTree tree type as a base mechanisms for extracting the node list.

source
Phylo.API._getoutboundsFunction
_getoutbounds(tree::AbstractTree, node::AbstractNode)

Returns the outbound connections of a rooted node. Must be implemented for any rooted AbstractNode subtype.

source
Phylo.API._getparentFunction
_getparent(tree::AbstractTree, node)

Return the parent node for this node. Can be implemented for Rooted node types.

source
Phylo.API._getrootFunction
_getroot(::AbstractTree)

Returns the unique root of a rooted tree. May be implemented for any OneTree type (otherwise determined from _getroots()).

source
Phylo.API._getrootsMethod
_getroots(::AbstractTree)

Returns the root(s) of a tree. May be implemented for any OneTree type (otherwise determined from _getnodes() and _isroot() functions).

source
Phylo.API._getsiblingsFunction
_getsiblings(tree::AbstractTree, node::AbstractNode)

Returns all of the siblings (actually immediate connections) of a node. May be implemented for any AbstractNode subtype, can be inferred from _getparent and _getchildren for a rooted node or _getconnections for an unrooted node.

source
Phylo.API._gettreeFunction
_gettree(::Pair{Label, AbstractTree})
+_gettree(::AbstractTree, id)

Returns a tree - either itself if it is a single tree, or the single tree in a set with label id. Must be implemented for any ManyTrees type.

source
Phylo.API._gettreeinfoFunction
_gettreeinfo(tree::AbstractTree)
+_gettreeinfo(tree::AbstractTree, treename)

Returns the info data associated with the tree(s).

source
Phylo.API._gettreenameFunction
_gettreename(::AbstractTree)

Returns the name for a single tree. Should be implemented for any OneTree type where they have names.

source
Phylo.API._gettreenamesFunction
_gettreenames(::AbstractTree)

Returns the names for the trees. Can be implemented for any ManyTrees type.

source
Phylo.API._gettreesFunction
_gettrees(::AbstractTree)

Returns the trees in an object. Must be implemented for any ManyTrees type.

source
Phylo.API._hasbranchFunction
_hasbranch(tree::AbstractTree, node[name])

Does the tree contain this branch? Must be implemented for any PreferBranchObjects tree type with a branch label.

source
Phylo.API._hasinboundFunction
_hasinbound(tree::AbstractTree, node::AbstractNode)

Must be implemented for any AbstractNode subtype.

source
Phylo.API._hasnodeFunction
_hasnode(tree::AbstractTree, node[name])

Does the tree contain this node? Must be implemented for any PreferNodeObjects tree type with a node label.

source
Phylo.API._hasoutboundspaceFunction
_hasoutboundspace(tree::AbstractTree, node::AbstractNode)

Is there space for a new outbound connection on a node? Must be implemented if a node has a limit on the number of outbound connections (eg for a binary tree)

source
Phylo.API._hasspaceFunction
_hasspace(tree::AbstractTree, node::AbstractNode)

Is there space for a new connection on a node? Must be implemented if a node has a limit on the number of connections (eg for a binary tree)

source
Phylo.API._indegreeFunction
_indegree(tree::AbstractTree, node)

In degree of node. Can be implemented for rooted nodes, otherwise inferred from _hasinbound.

source
Phylo.API._invalidate!Function
_invalidate!(::AbstractTree, state)

Confirm that the tree is no longer necessarily valid, and remove cache information.

source
Phylo.API._isleafFunction
_isleaf(tree::AbstractTree, node)

Is the node a leaf? Does not need to be implemented for any node type – inferred from _outdegree or _degree - unless tree knows which nodes are leaves and not nodes.

source
Phylo.API._matchbranchnodetypeFunction
_matchbranchnodetype(::Type{<:AbstractTree},
                      ::Type{<:AbstractBranch},
-                     ::Type{<:AbstractNode})

Does this tree type prefer the branch and node types provided?

source
Phylo.API._matchbranchtypeFunction
_matchbranchtype(::Type{<:AbstractTree}, ::Type{<:AbstractBranch})

Does this tree type prefer the branch or branch label type provided?

source
Phylo.API._matchnodetypeFunction
_matchnodetype(::Type{<:AbstractTree{TT, RT, NL, N, B}}, ::Type{N})
-_matchnodetype(::Type{<:AbstractTree{TT, RT, NL, N, B}}, ::Type{NL})

Does this tree type prefer the node or node label type provided?

source
Phylo.API._nbranchesMethod
_nbranches(::AbstractTree)

Returns the number of branches in a single tree. May be implemented for any OneTree tree type (otherwise infers from _getbranches()).

source
Phylo.API._nleavesMethod
_nleaves(::AbstractTree)

Returns the number of leaves (tips) in a tree. May be implemented for any tree type (otherwise determined from the _getleafnames() function).

source
Phylo.API._nnodesMethod
_nnodes(::AbstractTree)

Returns the number of nodes (internal nodes and leaves) in a single tree. May be implemented for any OneTree tree type (otherwise infers from _getnodes()).

source
Phylo.API._nrootsFunction
_nroots(::AbstractTree)

Returns the number of roots (subtrees) in a OneTree tree. May be implemented for any ManyRoots type (otherwise infers from _getroots()).

source
Phylo.API._ntreesFunction
_ntrees(::AbstractTree)

Returns the number of trees in an object. Must be implemented for any ManyTrees type.

source
Phylo.API._preferbranchobjectsFunction
_preferbranchobjects(::Type{<:AbstractTree})

Does this tree or branch type prefer branches to be objects or names? Must be implemented for every branch type.

source
Phylo.API._prefernodeobjectsFunction
_prefernodeobjects(::Type{<:AbstractTree})

Does this tree or node type prefer nodes to be objects or names? Must be implemented for every node type.

source
Phylo.API._removeconnection!Function
_removeconnection!(tree::AbstractTree, node::AbstractNode, branch)

Remove a connection from an unrooted node. Must be implemented for any Unrooted AbstractNode subtype unless this happens when a branch is deleted.

source
Phylo.API._removeinbound!Function
_removeinbound!(tree::AbstractTree, node::AbstractNode, inbound)

Removes a branch from the input of a rooted node. Must be implemented for any rooted AbstractNode subtype unless this happens when a branch is deleted.

source
Phylo.API._removeoutbound!Function
_removeoutbound!(tree::AbstractTree, node::AbstractNode, branch)

Remove an outbound branch from a rooted node. Must be implemented for any AbstractNode subtype unless this happens when a branch is deleted.

source
Phylo.API._renamenode!Function
_renamenode!(tree::AbstractTree, oldnode[name], newname)

Renames a node in a tree. Optional - not implemented for most tree types.

source
Phylo.API._resetleaves!Function
_resetleaves!(::AbstractTree)

Fixes leaf naming after creation or deletion of nodes or branches. Must be implemented by tree types where this is handled separately.

source
Phylo.API._srcFunction
_src(tree, branch)

Return source node for a branch. Must be implemented for any rooted branch type.

source
Phylo.API._traversalFunction
_traversal(tree::AbstractTree, order::TraversalOrder, todo, sofar)

Return an iterable object containing nodes in given order - preorder, inorder, postorder or breadthfirst

source
Phylo.API._treenametypeFunction
_treenametype(::Type{AbstractTree})

Returns the label type for a tree type. Must be implemented for any tree type.

source
+ ::Type{<:AbstractNode})

Does this tree type prefer the branch and node types provided?

source
Phylo.API._matchbranchtypeFunction
_matchbranchtype(::Type{<:AbstractTree}, ::Type{<:AbstractBranch})

Does this tree type prefer the branch or branch label type provided?

source
Phylo.API._matchnodetypeFunction
_matchnodetype(::Type{<:AbstractTree{TT, RT, NL, N, B}}, ::Type{N})
+_matchnodetype(::Type{<:AbstractTree{TT, RT, NL, N, B}}, ::Type{NL})

Does this tree type prefer the node or node label type provided?

source
Phylo.API._matchtreenametypeMethod
_matchtreenametype(::Type{<:AbstractTree}, ::Type{X})

Does this tree type prefer the node or node label type provided?

source
Phylo.API._nbranchesMethod
_nbranches(::AbstractTree)

Returns the number of branches in a single tree. May be implemented for any OneTree tree type (otherwise infers from _getbranches()).

source
Phylo.API._newbranchlabelFunction
_newbranchlabel(tree::AbstractTree)

Returns a new unique branch name for a tree.

source
Phylo.API._newnodelabelFunction
_newnodelabel(tree::AbstractTree)

Returns a new unique node name for a tree.

source
Phylo.API._nleavesMethod
_nleaves(::AbstractTree)

Returns the number of leaves (tips) in a tree. May be implemented for any tree type (otherwise determined from the _getleafnames() function).

source
Phylo.API._nnodesMethod
_nnodes(::AbstractTree)

Returns the number of nodes (internal nodes and leaves) in a single tree. May be implemented for any OneTree tree type (otherwise infers from _getnodes()).

source
Phylo.API._nodedatatypeFunction
_nodedatatype(::Type{<:AbstractTree})

Returns the type of the node info data.

source
Phylo.API._nrootsFunction
_nroots(::AbstractTree)

Returns the number of roots (subtrees) in a OneTree tree. May be implemented for any ManyRoots type (otherwise infers from _getroots()).

source
Phylo.API._ntreesFunction
_ntrees(::AbstractTree)

Returns the number of trees in an object. Must be implemented for any ManyTrees type.

source
Phylo.API._outdegreeFunction
_outdegree(tree::AbstractTree, node::AbstractNode)

Out degree of node.

source
Phylo.API._preferbranchobjectsFunction
_preferbranchobjects(::Type{<:AbstractTree})

Does this tree or branch type prefer branches to be objects or names? Must be implemented for every branch type.

source
Phylo.API._prefernodeobjectsFunction
_prefernodeobjects(::Type{<:AbstractTree})

Does this tree or node type prefer nodes to be objects or names? Must be implemented for every node type.

source
Phylo.API._removeconnection!Function
_removeconnection!(tree::AbstractTree, node::AbstractNode, branch)

Remove a connection from an unrooted node. Must be implemented for any Unrooted AbstractNode subtype unless this happens when a branch is deleted.

source
Phylo.API._removeinbound!Function
_removeinbound!(tree::AbstractTree, node::AbstractNode, inbound)

Removes a branch from the input of a rooted node. Must be implemented for any rooted AbstractNode subtype unless this happens when a branch is deleted.

source
Phylo.API._removeoutbound!Function
_removeoutbound!(tree::AbstractTree, node::AbstractNode, branch)

Remove an outbound branch from a rooted node. Must be implemented for any AbstractNode subtype unless this happens when a branch is deleted.

source
Phylo.API._renamenode!Function
_renamenode!(tree::AbstractTree, oldnode[name], newname)

Renames a node in a tree. Optional - not implemented for most tree types.

source
Phylo.API._resetleaves!Function
_resetleaves!(::AbstractTree)

Fixes leaf naming after creation or deletion of nodes or branches. Must be implemented by tree types where this is handled separately.

source
Phylo.API._setheight!Method
_setheight!(::AbstractTree, nodename, value)
source
Phylo.API._setrootheight!Function
_setrootheight!(::AbstractTree, value)
source
Phylo.API._srcFunction
_src(tree, branch)

Return source node for a branch. Must be implemented for any rooted branch type.

source
Phylo.API._traversalFunction
_traversal(tree::AbstractTree, order::TraversalOrder, todo, sofar)

Return an iterable object containing nodes in given order - preorder, inorder, postorder or breadthfirst

source
Phylo.API._treenametypeFunction
_treenametype(::Type{AbstractTree})

Returns the label type for a tree type. Must be implemented for any tree type.

source
Phylo.API._validate!Function
_validate!(::AbstractTree)

Check whether the tree is internally valid.

source
diff --git a/dev/functionlist/index.html b/dev/functionlist/index.html index 73bcf940..f5dd9918 100644 --- a/dev/functionlist/index.html +++ b/dev/functionlist/index.html @@ -1,2 +1,2 @@ -List of functions · Phylo.jl

Function list

+List of functions · Phylo.jl

Function list

diff --git a/dev/index.html b/dev/index.html index 0dfed03d..d43734cd 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,2 +1,2 @@ -Home · Phylo.jl

Phylo

A package for creating and manipulating phylogenies

Phylo is a Julia package that provides functionality for generating phylogenetic trees. It plays well with the Diversity package, i.e. to calculate phylogenetic diversity. Both are currently under development, so please raise an issue if you find any problems.

This package is currently less featured than the best phylogenetics packages in R or Python. Contributors are very welcome!

+Home · Phylo.jl

Phylo

A package for creating and manipulating phylogenies

Phylo is a Julia package that provides functionality for generating phylogenetic trees. It plays well with the Diversity package, i.e. to calculate phylogenetic diversity. Both are currently under development, so please raise an issue if you find any problems.

This package is currently less featured than the best phylogenetics packages in R or Python. Contributors are very welcome!

diff --git a/dev/man/attributes/index.html b/dev/man/attributes/index.html index f009eb28..a15a736b 100644 --- a/dev/man/attributes/index.html +++ b/dev/man/attributes/index.html @@ -1,11 +1,11 @@ -Getting phylogeny attributes · Phylo.jl

Getting tree attributes

Methods on TreeSets

Phylo.ntreesFunction
ntrees(tree::AbstractTree)

Returns the number of trees in a tree object, 1 for a OneTree tree type, and the count of trees for a ManyTrees type.

source
Phylo.gettreeFunction
gettree(tree::AbstractTree, label)

Returns a single OneTree object tree corresponding to the label given.

source
Phylo.nrootsFunction
nroots(::AbstractTree)

Returns the number of roots in a tree. For OneTree types, Unrooted trees will return 0, OneRoot trees should return 1, and manyroots tree (ones with multiple subtrees) will return the number of subtrees. ManyTrees types will return a Dict of counts of the number of roots for each tree in the set.

source
Phylo.getrootsFunction
getroots(::AbstractTree)
-getroots(::AbstractTree, id)

Returns a vector containing the root(s) of a single (OneTree) tree or a set of (ManyTrees) trees.

source

Methods on Trees

Phylo.mrcaFunction
mrca(tree::AbstractTree, target)

Returns the node within tree that is the Most Recent Common Ancestor of the leaves (or internal nodes) defined by target. target can be an iterator over nodes or an AbstractArray of nodes. The return value has the same node type as the elements of target.

Examples

≡≡≡≡≡≡≡≡≡≡≡

julia> tree = open(parsenewick, Phylo.path("H1N1.newick")) RootedTree with 507 tips, 1013 nodes and 1012 branches. Leaf names are 227, 294, 295, 110, 390, ... [501 omitted] ... and 418

julia> tips = rand(collect(nodefilter(isleaf, tree)), 3) 3-element Vector{RecursiveNode{OneRoot, String, Dict{String, Any}, Dict{String, Any}, PolytomousBranching, Float64}}: leaf node '414' leaf node '232' leaf node '216'

julia> mrca(tree, tips) internal node 'Node 980'

source
Phylo.nodeheightsFunction
nodeheights(tree::Phylo.AbstractTree; onlyleaves = false, noleaves = false)

Returns an AxisArray of the height of all nodes in tree over the root node. onlyleaves and noleaves filter the nodes for leaves and internal nodes, respectively

source
Phylo.getleafnamesFunction
getleafnames(::AbstractTree[, ::TraversalOrder])

Retrieve the leaf names from the tree (in some specific order).

source
Phylo.getleavesFunction
getleaves(::AbstractTree[, ::TraversalOrder])

Retrieve the leaves from the tree.

source
Phylo.nleavesFunction
nleaves(::AbstractTree)

Returns the number of leaves (tips) in a tree.

source
Phylo.nnodesFunction
nnodes(::AbstractTree)

Returns the number of nodes of a single tree, or a Dict of numbers of nodes for multiple trees.

source
Phylo.ninternalFunction
ninternal(::AbstractTree)

Returns the number of internal nodes of a single tree, or a Dict of numbers of nodes for multiple trees.

source
Phylo.nbranchesFunction
nbranches(::AbstractTree)

Returns the number of branches of a single tree, or a Dict of numbers of branches for multiple trees.

source
Phylo.distanceFunction
distance(tree::AbstractTree, node1, node2)

Distance between two nodes on a tree

source
Phylo.distancesFunction
distances(tree::AbstractTree)

Pairwise distances between all leaf nodes on a tree

source
Phylo.heightstorootFunction
heightstoroot(tree::AbstractTree)

Height of all of the leaves of the tree above the root

source
Phylo.getrootFunction
getroot(::AbstractTree)

Returns the root of a single tree (must be only one tree for a ManyTrees tree).

source
Phylo.roottypeFunction
roottype(::Type{AbstractTree})
-roottype(::Type{AbstractElt})

Returns root type from a tree, node, branch or other element type.

source
Phylo.nodetypeFunction
nodetype(::Type{AbstractTree})

Returns type of nodes from a tree type.

source
Phylo.nodenametypeFunction
nodenametype(::Type{AbstractTree})
-nodenametype(::Type{AbstractElt})

Returns type of node names from a tree type.

source
Phylo.getnodenamesFunction
getnodenames(::AbstractTree[, ::TraversalOrder])

Return a vector of node names of a single tree (identified by id for a ManyTrees tree), or a Dict of vectors of node names for multiple trees.

source
Phylo.getnodenameFunction
getnodename(::AbstractTree, node)

Returns the node name associated with a node from a tree.

source
Phylo.hasnodeFunction
hasnode(tree::AbstractTree, node)

Returns whether a tree has a given node (or node name) or not.

source
Phylo.getnodeFunction
getnode(tree::AbstractTree, node[name])

Returns a node from a tree.

source
Phylo.getnodesFunction
getnodes(::AbstractTree[, ::TraversalOrder])

Returns the vector of nodes of a single tree, or a Dict of vectors of nodes for multiple trees.

source
Phylo.getinternalnodesFunction
getinternalnodes(t::AbstractTree)

Function to retrieve only the internal nodes from a tree, t, which does not include tips or root.

source
Phylo.getbranchnamesFunction
getbranchnames(tree::AbstractTree)

Return a vector of branch names of a single tree, or a Dict of vectors of branch names for multiple trees.

source
Phylo.getbranchnameFunction
getbranchname(::AbstractTree, branch)
-getbranchname(branch)

Returns the branch name associated with a branch from a tree. For some branch types, it will be able to extract the branch name without reference to the tree.

source
Phylo.hasbranchFunction
hasbranch(tree::AbstractTree, branch)
-hasbranch(tree::AbstractTree, source, dest)

Does tree have a branch branch or a branch from source to dest?

source
Phylo.getbranchFunction
getbranch(tree::AbstractTree, branch)
-getbranch(tree::AbstractTree, source, dest)

Returns a branch from a tree by name or by source and destination node.

source
Phylo.getbranchesFunction
getbranches(::AbstractTree)

Returns the vector of branches of a single tree, or a Dict of vectors of branches for multiple trees.

source
Phylo.gettreeinfoFunction
gettreeinfo(tree::AbstractTree)
-gettreeinfo(tree::AbstractTree, treename)

Returns the info data associated with the tree(s).

source
Phylo.validate!Function
validate!(tree::AbstractTree)

Validate the tree by making sure that it is connected up correctly.

source
Phylo.invalidate!Function
invalidate!(tree::AbstractTree, state = missing)

Confirm that the tree is no longer necessarily valid, and remove cache information.

source
Phylo.branchdimsFunction
branchdims(::Type{<: AbstractTree})

retrieve the dimensions of the branch lengths for the tree.

source
Phylo.treetypeFunction
treetype(::Type{AbstractTree})

Returns tree number (OneTree, ManyTrees) from a tree type.

source
Phylo.treesettypeFunction
treesettype(::Type{AbstractTree}, ::Type{LABEL} = String)

Returns type of a TreeSet containing a collection of trees, from those trees' type and the type of label used to identify trees.

source

Methods on Nodes

Phylo.isleafFunction
isleaf(tree::AbstractTree, node)

Is the node (referenced by name or node object) a leaf of the tree?

source
Phylo.isrootFunction
isroot(tree::AbstractTree, node)

Is the node (referenced by name or node object) a root of the tree?

source
Phylo.isinternalFunction
isinternal(tree::AbstractTree, node)

Is the node (referenced by name or node object) internal to the tree (neither root nor leaf)?

source
Phylo.isunattachedFunction
isunattached(tree::AbstractTree, node)

Is the node (referenced by name or node object) unattached (i.e. not connected to other nodes)?

source
Graphs.degreeFunction
degree(tree::AbstractTree, node)

Return the degree of a node including all connections.

source
Phylo.hasinboundFunction
hasinbound(tree::AbstractTree, node)

Does the node have an inbound connection?

source
Phylo.getinboundFunction
getinbound(tree::AbstractTree, node)

return the inbound branch to this node (returns name for node name, branch for node).

source
Phylo.getoutboundsFunction
getoutbounds(tree::AbstractTree, nodename)

Return the names of the outbound branches from this node.

source
Phylo.getconnectionsFunction
getconnections(tree::AbstractTree, node, exclude = [])

Returns all of the branches connected to a node.

source
Phylo.hasoutboundspaceFunction
hasoutboundspace(tree::AbstractTree, node)

Does the node have space for an[other] outbound connection?

source
Phylo.getleafinfoFunction
getleafinfo(::AbstractTree[, label])

retrieve the leaf info for a leaf of the tree.

source
Phylo.getnodedataFunction
getnodedata(::AbstractTree, node)

retrieve the node data for a node of the tree.

source
Phylo.setnodedata!Function
setnodedata!(::AbstractTree, node, label, value)
-setnodedata!(::AbstractTree, node, data)

Set the node data for a node of the tree.

source
Phylo.hasheightFunction
hasheight(tree::AbstractTree, node)

Does the node have a height defined?

source
Phylo.setheight!Function
setheight!(tree::AbstractTree, nodename, height)

Set the height of the node.

source
Phylo.getparentFunction
getparent(tree::AbstractTree, node)

Return [the name of] the parent node for this node [name]. Second method may not be implemented for some node types.

source
Phylo.getancestorsFunction
getancestors(tree::AbstractTree, node)

Return the name of all of the nodes that are ancestral to this node.

source
Phylo.getchildrenFunction
getchildren(tree::AbstractTree, node)

Return the [name(s) of] the child node(s) for this node [name].

source
Phylo.getdescendantsFunction
getdescendants(tree::AbstractTree, node)

Return the names of all of the nodes that descend from this node.

source
Phylo.getsiblingsFunction
getsiblings(tree::AbstractTree, node)

Returns all of the siblings of a node. Must be implemented for any unrooted AbstractNode subtype, can be inferred from _getparent and _getchildren for a rooted node.

source
Phylo.renamenode!Function
renamenode!(tree::AbstractTree, oldnode[name], newname)

Renames a node in a tree. Optional - not implemented for most tree types and returns false.

source

Methods on Branches

Graphs.srcFunction
src(tree::AbstractTree, branch)

Return the source node for this branch.

source
Graphs.dstFunction
dst(tree::AbstractTree, branch)

Return the destination node for this branch.

source
Phylo.connFunction
conn(tree::AbstractTree, branch, exclude)

Return the other node connected to branch that is not exclude.

source
Phylo.connsFunction
conns(tree::AbstractTree, branch)

Return the nodes connected to branch.

source
Phylo.haslengthFunction
haslength(tree::AbstractTree, branch)

Return whether the branch has a length.

source
Phylo.setbranchdata!Function
setbranchdata!(::AbstractTree, branch, label, value)
-setbranchdata!(::AbstractTree, branch, data)

Set the branch data for a branch of the tree.

source
+Getting phylogeny attributes · Phylo.jl

Getting tree attributes

Methods on TreeSets

Phylo.ntreesFunction
ntrees(tree::AbstractTree)

Returns the number of trees in a tree object, 1 for a OneTree tree type, and the count of trees for a ManyTrees type.

source
Phylo.gettreeFunction
gettree(tree::AbstractTree, label)

Returns a single OneTree object tree corresponding to the label given.

source
Phylo.nrootsFunction
nroots(::AbstractTree)

Returns the number of roots in a tree. For OneTree types, Unrooted trees will return 0, OneRoot trees should return 1, and manyroots tree (ones with multiple subtrees) will return the number of subtrees. ManyTrees types will return a Dict of counts of the number of roots for each tree in the set.

source
Phylo.getrootsFunction
getroots(::AbstractTree)
+getroots(::AbstractTree, id)

Returns a vector containing the root(s) of a single (OneTree) tree or a set of (ManyTrees) trees.

source

Methods on Trees

Phylo.mrcaFunction
mrca(tree::AbstractTree, target)

Returns the node within tree that is the Most Recent Common Ancestor of the leaves (or internal nodes) defined by target. target can be an iterator over nodes or an AbstractArray of nodes. The return value has the same node type as the elements of target.

Examples

≡≡≡≡≡≡≡≡≡≡≡

julia> tree = open(parsenewick, Phylo.path("H1N1.newick")) RootedTree with 507 tips, 1013 nodes and 1012 branches. Leaf names are 227, 294, 295, 110, 390, ... [501 omitted] ... and 418

julia> tips = rand(collect(nodefilter(isleaf, tree)), 3) 3-element Vector{RecursiveNode{OneRoot, String, Dict{String, Any}, Dict{String, Any}, PolytomousBranching, Float64}}: leaf node '414' leaf node '232' leaf node '216'

julia> mrca(tree, tips) internal node 'Node 980'

source
Phylo.nodeheightsFunction
nodeheights(tree::Phylo.AbstractTree; onlyleaves = false, noleaves = false)

Returns an AxisArray of the height of all nodes in tree over the root node. onlyleaves and noleaves filter the nodes for leaves and internal nodes, respectively

source
Phylo.getleafnamesFunction
getleafnames(::AbstractTree[, ::TraversalOrder])

Retrieve the leaf names from the tree (in some specific order).

source
Phylo.getleavesFunction
getleaves(::AbstractTree[, ::TraversalOrder])

Retrieve the leaves from the tree.

source
Phylo.nleavesFunction
nleaves(::AbstractTree)

Returns the number of leaves (tips) in a tree.

source
Phylo.nnodesFunction
nnodes(::AbstractTree)

Returns the number of nodes of a single tree, or a Dict of numbers of nodes for multiple trees.

source
Phylo.ninternalFunction
ninternal(::AbstractTree)

Returns the number of internal nodes of a single tree, or a Dict of numbers of nodes for multiple trees.

source
Phylo.nbranchesFunction
nbranches(::AbstractTree)

Returns the number of branches of a single tree, or a Dict of numbers of branches for multiple trees.

source
Phylo.distanceFunction
distance(tree::AbstractTree, node1, node2)

Distance between two nodes on a tree

source
Phylo.distancesFunction
distances(tree::AbstractTree)

Pairwise distances between all leaf nodes on a tree

source
Phylo.heightstorootFunction
heightstoroot(tree::AbstractTree)

Height of all of the leaves of the tree above the root

source
Phylo.getrootFunction
getroot(::AbstractTree)

Returns the root of a single tree (must be only one tree for a ManyTrees tree).

source
Phylo.roottypeFunction
roottype(::Type{AbstractTree})
+roottype(::Type{AbstractElt})

Returns root type from a tree, node, branch or other element type.

source
Phylo.nodetypeFunction
nodetype(::Type{AbstractTree})

Returns type of nodes from a tree type.

source
Phylo.nodenametypeFunction
nodenametype(::Type{AbstractTree})
+nodenametype(::Type{AbstractElt})

Returns type of node names from a tree type.

source
Phylo.getnodenamesFunction
getnodenames(::AbstractTree[, ::TraversalOrder])

Return a vector of node names of a single tree (identified by id for a ManyTrees tree), or a Dict of vectors of node names for multiple trees.

source
Phylo.getnodenameFunction
getnodename(::AbstractTree, node)

Returns the node name associated with a node from a tree.

source
Phylo.hasnodeFunction
hasnode(tree::AbstractTree, node)

Returns whether a tree has a given node (or node name) or not.

source
Phylo.getnodeFunction
getnode(tree::AbstractTree, node[name])

Returns a node from a tree.

source
Phylo.getnodesFunction
getnodes(::AbstractTree[, ::TraversalOrder])

Returns the vector of nodes of a single tree, or a Dict of vectors of nodes for multiple trees.

source
Phylo.getinternalnodesFunction
getinternalnodes(t::AbstractTree)

Function to retrieve only the internal nodes from a tree, t, which does not include tips or root.

source
Phylo.getbranchnamesFunction
getbranchnames(tree::AbstractTree)

Return a vector of branch names of a single tree, or a Dict of vectors of branch names for multiple trees.

source
Phylo.getbranchnameFunction
getbranchname(::AbstractTree, branch)
+getbranchname(branch)

Returns the branch name associated with a branch from a tree. For some branch types, it will be able to extract the branch name without reference to the tree.

source
Phylo.hasbranchFunction
hasbranch(tree::AbstractTree, branch)
+hasbranch(tree::AbstractTree, source, dest)

Does tree have a branch branch or a branch from source to dest?

source
Phylo.getbranchFunction
getbranch(tree::AbstractTree, branch)
+getbranch(tree::AbstractTree, source, dest)

Returns a branch from a tree by name or by source and destination node.

source
Phylo.getbranchesFunction
getbranches(::AbstractTree)

Returns the vector of branches of a single tree, or a Dict of vectors of branches for multiple trees.

source
Phylo.gettreeinfoFunction
gettreeinfo(tree::AbstractTree)
+gettreeinfo(tree::AbstractTree, treename)

Returns the info data associated with the tree(s).

source
Phylo.validate!Function
validate!(tree::AbstractTree)

Validate the tree by making sure that it is connected up correctly.

source
Phylo.invalidate!Function
invalidate!(tree::AbstractTree, state = missing)

Confirm that the tree is no longer necessarily valid, and remove cache information.

source
Phylo.branchdimsFunction
branchdims(::Type{<: AbstractTree})

retrieve the dimensions of the branch lengths for the tree.

source
Phylo.treetypeFunction
treetype(::Type{AbstractTree})

Returns tree number (OneTree, ManyTrees) from a tree type.

source
Phylo.treesettypeFunction
treesettype(::Type{AbstractTree}, ::Type{LABEL} = String)

Returns type of a TreeSet containing a collection of trees, from those trees' type and the type of label used to identify trees.

source

Methods on Nodes

Phylo.isleafFunction
isleaf(tree::AbstractTree, node)

Is the node (referenced by name or node object) a leaf of the tree?

source
Phylo.isrootFunction
isroot(tree::AbstractTree, node)

Is the node (referenced by name or node object) a root of the tree?

source
Phylo.isinternalFunction
isinternal(tree::AbstractTree, node)

Is the node (referenced by name or node object) internal to the tree (neither root nor leaf)?

source
Phylo.isunattachedFunction
isunattached(tree::AbstractTree, node)

Is the node (referenced by name or node object) unattached (i.e. not connected to other nodes)?

source
Graphs.degreeFunction
degree(tree::AbstractTree, node)

Return the degree of a node including all connections.

source
Phylo.hasinboundFunction
hasinbound(tree::AbstractTree, node)

Does the node have an inbound connection?

source
Phylo.getinboundFunction
getinbound(tree::AbstractTree, node)

return the inbound branch to this node (returns name for node name, branch for node).

source
Phylo.getoutboundsFunction
getoutbounds(tree::AbstractTree, nodename)

Return the names of the outbound branches from this node.

source
Phylo.getconnectionsFunction
getconnections(tree::AbstractTree, node, exclude = [])

Returns all of the branches connected to a node.

source
Phylo.hasoutboundspaceFunction
hasoutboundspace(tree::AbstractTree, node)

Does the node have space for an[other] outbound connection?

source
Phylo.getleafinfoFunction
getleafinfo(::AbstractTree[, label])

retrieve the leaf info for a leaf of the tree.

source
Phylo.getnodedataFunction
getnodedata(::AbstractTree, node)

retrieve the node data for a node of the tree.

source
Phylo.setnodedata!Function
setnodedata!(::AbstractTree, node, label, value)
+setnodedata!(::AbstractTree, node, data)

Set the node data for a node of the tree.

source
Phylo.hasheightFunction
hasheight(tree::AbstractTree, node)

Does the node have a height defined?

source
Phylo.setheight!Function
setheight!(tree::AbstractTree, nodename, height)

Set the height of the node.

source
Phylo.getparentFunction
getparent(tree::AbstractTree, node)

Return [the name of] the parent node for this node [name]. Second method may not be implemented for some node types.

source
Phylo.getancestorsFunction
getancestors(tree::AbstractTree, node)

Return the name of all of the nodes that are ancestral to this node.

source
Phylo.getchildrenFunction
getchildren(tree::AbstractTree, node)

Return the [name(s) of] the child node(s) for this node [name].

source
Phylo.getdescendantsFunction
getdescendants(tree::AbstractTree, node)

Return the names of all of the nodes that descend from this node.

source
Phylo.getsiblingsFunction
getsiblings(tree::AbstractTree, node)

Returns all of the siblings of a node. Must be implemented for any unrooted AbstractNode subtype, can be inferred from _getparent and _getchildren for a rooted node.

source
Phylo.renamenode!Function
renamenode!(tree::AbstractTree, oldnode[name], newname)

Renames a node in a tree. Optional - not implemented for most tree types and returns false.

source

Methods on Branches

Graphs.srcFunction
src(tree::AbstractTree, branch)

Return the source node for this branch.

source
Graphs.dstFunction
dst(tree::AbstractTree, branch)

Return the destination node for this branch.

source
Phylo.connFunction
conn(tree::AbstractTree, branch, exclude)

Return the other node connected to branch that is not exclude.

source
Phylo.connsFunction
conns(tree::AbstractTree, branch)

Return the nodes connected to branch.

source
Phylo.haslengthFunction
haslength(tree::AbstractTree, branch)

Return whether the branch has a length.

source
Phylo.setbranchdata!Function
setbranchdata!(::AbstractTree, branch, label, value)
+setbranchdata!(::AbstractTree, branch, data)

Set the branch data for a branch of the tree.

source
diff --git a/dev/man/io/index.html b/dev/man/io/index.html index 85151038..1f47f372 100644 --- a/dev/man/io/index.html +++ b/dev/man/io/index.html @@ -31,9 +31,9 @@ nu = Nonultrametric(5); tree = rand(nu)
RootedTree with 5 tips and 1 root. Leaf names are tip 1, tip 2, tip 3, tip 4 and tip 5
 
-9 nodes: [RecursiveNode{OneRoot} 'tip 1', a leaf with an incoming connection (branch 9), RecursiveNode{OneRoot} 'tip 2', a leaf with an incoming connection (branch 12), RecursiveNode{OneRoot} 'tip 3', a leaf with an incoming connection (branch 11), RecursiveNode{OneRoot} 'tip 4', a leaf with an incoming connection (branch 13), RecursiveNode{OneRoot} 'tip 5', a leaf with an incoming connection (branch 10), RecursiveNode{OneRoot} 'Node 6', an internal node with 1 inbound and 2 outbound connections (branches 16 and [9, 10]), RecursiveNode{OneRoot} 'Node 7', an internal node with 1 inbound and 2 outbound connections (branches 14 and [11, 12]), RecursiveNode{OneRoot} 'Node 8', an internal node with 1 inbound and 2 outbound connections (branches 15 and [13, 14]) and RecursiveNode{OneRoot} 'Node 9', a root node with 2 outbound connections (branches [15, 16])]
+9 nodes: [RecursiveNode{OneRoot} 'tip 1', a leaf with an incoming connection (branch 9), RecursiveNode{OneRoot} 'tip 2', a leaf with an incoming connection (branch 10), RecursiveNode{OneRoot} 'tip 3', a leaf with an incoming connection (branch 14), RecursiveNode{OneRoot} 'tip 4', a leaf with an incoming connection (branch 11), RecursiveNode{OneRoot} 'tip 5', a leaf with an incoming connection (branch 12), RecursiveNode{OneRoot} 'Node 6', an internal node with 1 inbound and 2 outbound connections (branches 13 and [9, 10]), RecursiveNode{OneRoot} 'Node 7', an internal node with 1 inbound and 2 outbound connections (branches 16 and [11, 12]), RecursiveNode{OneRoot} 'Node 8', an internal node with 1 inbound and 2 outbound connections (branches 15 and [13, 14]) and RecursiveNode{OneRoot} 'Node 9', a root node with 2 outbound connections (branches [15, 16])]
 
-8 branches: [RecursiveBranch{OneRoot} 9, from node 'Node 6' to node 'tip 1' (length 0.985238742511545), RecursiveBranch{OneRoot} 10, from node 'Node 6' to node 'tip 5' (length 0.15403718795839533), RecursiveBranch{OneRoot} 11, from node 'Node 7' to node 'tip 3' (length 0.5018242847054258), RecursiveBranch{OneRoot} 12, from node 'Node 7' to node 'tip 2' (length 0.3272629273359313), RecursiveBranch{OneRoot} 13, from node 'Node 8' to node 'tip 4' (length 0.4560888940796744), RecursiveBranch{OneRoot} 14, from node 'Node 8' to node 'Node 7' (length 0.021133147948011695), RecursiveBranch{OneRoot} 15, from node 'Node 9' to node 'Node 8' (length 0.7547850922824354) and RecursiveBranch{OneRoot} 16, from node 'Node 9' to node 'Node 6' (length 0.1344631953328495)]
+8 branches: [RecursiveBranch{OneRoot} 9, from node 'Node 6' to node 'tip 1' (length 0.5009447576476818), RecursiveBranch{OneRoot} 10, from node 'Node 6' to node 'tip 2' (length 0.13948096693046147), RecursiveBranch{OneRoot} 11, from node 'Node 7' to node 'tip 4' (length 0.6058619528875548), RecursiveBranch{OneRoot} 12, from node 'Node 7' to node 'tip 5' (length 0.2275263659602687), RecursiveBranch{OneRoot} 13, from node 'Node 8' to node 'Node 6' (length 0.20824041995593265), RecursiveBranch{OneRoot} 14, from node 'Node 8' to node 'tip 3' (length 0.5817893080331016), RecursiveBranch{OneRoot} 15, from node 'Node 9' to node 'Node 8' (length 0.5964326069173088) and RecursiveBranch{OneRoot} 16, from node 'Node 9' to node 'Node 7' (length 0.36930899393857025)]
 
 Node records: "tip 1" => Dict{String, Any}() ... "Node 9" => Dict{String, Any}()
 

Or two trees

trees = rand(nu, ["Tree 1", "Tree 2"])
TreeSet{String, OneRoot, String, RecursiveNode{OneRoot, String, Dict{String, Any}, Dict{String, Any}, PolytomousBranching, Float64}, RecursiveBranch{OneRoot, String, Dict{String, Any}, Dict{String, Any}, PolytomousBranching, Float64}, RootedTree} with 2 tree(s), each with 5 tips.
@@ -77,16 +77,16 @@
 Rooted; includes branch lengths.
 
 R> if (all.equal(rt, jt)) "no damage in translation"
-[1] "no damage in translation"
Phylo.parsenewickFunction
parsenewick(io::IOBuffer, ::Type{TREE}) where TREE <: AbstractTree

Parse an IOBuffer containing a newick tree and convert into a phylogenetic tree of type TREE <: AbstractTree

source
parsenewick(io::String, ::Type{TREE}) where TREE <: AbstractTree

Parse a String containing a newick tree and convert into a phylogenetic tree of type TREE <: AbstractTree

source
parsenewick(io::IOStream, ::Type{TREE}) where TREE <: AbstractTree

Parse an IOStream containing a newick tree and convert into a phylogenetic tree of type TREE <: AbstractTree

source
parsenewick(inp)

Parse some input containing a newick tree and convert into a phylogenetic tree of type RootedTree

source
Phylo.parsenexusFunction
parsenexus(io::IOBuffer, ::Type{TREE}) where TREE <: AbstractTree

Parse an IOBuffer containing a nexus tree and convert into a phylogenetic tree of type TREE <: AbstractTree

source
parsenexus(io::IOStream, ::Type{TREE}) where TREE <: AbstractTree

Parse an IOStream containing a nexus tree and convert into a phylogenetic tree of type TREE <: AbstractTree

source
parsenexus(inp)

Parse some input containing a nexus tree and convert into a phylogenetic tree of type RootedTree

source
Phylo.NonultrametricType
Nonultrametric{T <: AbstractTree,
+[1] "no damage in translation"
Phylo.parsenewickFunction
parsenewick(io::IOBuffer, ::Type{TREE}) where TREE <: AbstractTree

Parse an IOBuffer containing a newick tree and convert into a phylogenetic tree of type TREE <: AbstractTree

source
parsenewick(io::String, ::Type{TREE}) where TREE <: AbstractTree

Parse a String containing a newick tree and convert into a phylogenetic tree of type TREE <: AbstractTree

source
parsenewick(io::IOStream, ::Type{TREE}) where TREE <: AbstractTree

Parse an IOStream containing a newick tree and convert into a phylogenetic tree of type TREE <: AbstractTree

source
parsenewick(inp)

Parse some input containing a newick tree and convert into a phylogenetic tree of type RootedTree

source
Phylo.parsenexusFunction
parsenexus(io::IOBuffer, ::Type{TREE}) where TREE <: AbstractTree

Parse an IOBuffer containing a nexus tree and convert into a phylogenetic tree of type TREE <: AbstractTree

source
parsenexus(io::IOStream, ::Type{TREE}) where TREE <: AbstractTree

Parse an IOStream containing a nexus tree and convert into a phylogenetic tree of type TREE <: AbstractTree

source
parsenexus(inp)

Parse some input containing a nexus tree and convert into a phylogenetic tree of type RootedTree

source
Phylo.NonultrametricType
Nonultrametric{T <: AbstractTree,
                SAMP <: Sampleable}(n::Int,
                                    sampleable::SAMP = Exponential())
 Nonultrametric{T <: AbstractTree,
                SAMP <: Sampleable}(tiplabels::Vector{String},
-                                   sampleable::SAMP = Exponential())

The sampler for non-ultrametric phylogenetic trees of size n or with tip labels tiplabels. Generate random trees by calling rand().

source
Phylo.UltrametricType
Ultrametric{T <: AbstractTree,
+                                   sampleable::SAMP = Exponential())

The sampler for non-ultrametric phylogenetic trees of size n or with tip labels tiplabels. Generate random trees by calling rand().

source
Phylo.UltrametricType
Ultrametric{T <: AbstractTree,
             SAMP <: Sampleable,
             LenUnits <: Number}(n::Int,
                                 sampleable::SAMP = Exponential())
 Ultrametric{T <: AbstractTree,
             SAMP <: Sampleable,
             LenUnits <: Number}(tiplabels::Vector{String},
-                                sampleable::SAMP = Exponential())

The sampler for ultrametric phylogenetic trees of size n or with tip labels tiplabels. Generate random trees by calling rand().

source
Phylo.NewickType
Newick{T}

Type to specify newick format for input or output. Parameterised optionally (default Nothing) by T to allow a dictionary to specify which nodes to export and how to map their names during export.

source
+ sampleable::SAMP = Exponential())

The sampler for ultrametric phylogenetic trees of size n or with tip labels tiplabels. Generate random trees by calling rand().

source
Phylo.NewickType
Newick{T}

Type to specify newick format for input or output. Parameterised optionally (default Nothing) by T to allow a dictionary to specify which nodes to export and how to map their names during export.

source
Phylo.NexusType
Nexus

Type to specify nexus format for input or output.

source
diff --git a/dev/man/manipulating/index.html b/dev/man/manipulating/index.html index f643aafc..23356514 100644 --- a/dev/man/manipulating/index.html +++ b/dev/man/manipulating/index.html @@ -1,6 +1,6 @@ Manipulating and building phylogenies · Phylo.jl

Building and manipulating trees

TODO: examples here are needed

Phylo.createbranch!Function
createbranch!(tree::AbstractTree, src, dst[, len::Number];
-              data)

Add a branch from src to dst on tree with optional length and data. source and destination can be either nodes or nodenames.

source
Phylo.deletebranch!Function
deletebranch!(tree::AbstractTree, branch)
-deletebranch!(tree::AbstractTree, src, dst)

Delete the branch branch from tree, or branch connecting src node to dst node.

source
Phylo.createnode!Function
createnode!(tree::AbstractTree[, nodename]; data)

Create a node on a tree with optional node info.

source
Phylo.createnodes!Function
createnodes!(tree::AbstractTree, count::Integer)
+              data)

Add a branch from src to dst on tree with optional length and data. source and destination can be either nodes or nodenames.

source
Phylo.deletebranch!Function
deletebranch!(tree::AbstractTree, branch)
+deletebranch!(tree::AbstractTree, src, dst)

Delete the branch branch from tree, or branch connecting src node to dst node.

source
Phylo.createnode!Function
createnode!(tree::AbstractTree[, nodename]; data)

Create a node on a tree with optional node info.

source
Phylo.createnodes!Function
createnodes!(tree::AbstractTree, count::Integer)
 createnodes!(tree::AbstractTree, nodenames)
-createnodes!(tree::AbstractTree, nodedict)

Add a number of nodes, a vector with given names, or a Dict with node names and associated node info to a tree.

source
Phylo.droptips!Function
droptips!(tree::AbstractTree{OneTree}, tips)

Function to drop tips from a phylogenetic tree tree, which are found in the vector of tips or tip names, tips.

source
Phylo.keeptips!Function
keeptips!(tree::AbstractTree{OneTree}, tips)

Function to keep only the tips in a phylogenetic tree, tree, that are found in the vector of tips or tip names, tips.

source
+createnodes!(tree::AbstractTree, nodedict)

Add a number of nodes, a vector with given names, or a Dict with node names and associated node info to a tree.

source
Phylo.deletenode!Function
deletenode!(tree::AbstractTree, node)

Delete a node (or a name) from a tree

source
Phylo.droptips!Function
droptips!(tree::AbstractTree{OneTree}, tips)

Function to drop tips from a phylogenetic tree tree, which are found in the vector of tips or tip names, tips.

source
Phylo.keeptips!Function
keeptips!(tree::AbstractTree{OneTree}, tips)

Function to keep only the tips in a phylogenetic tree, tree, that are found in the vector of tips or tip names, tips.

source
diff --git a/dev/man/modelling/index.html b/dev/man/modelling/index.html index 7cc8a40c..7de4e1b3 100644 --- a/dev/man/modelling/index.html +++ b/dev/man/modelling/index.html @@ -1,2 +1,2 @@ -Modelling traits · Phylo.jl

Modelling traits on trees

Phylo.BrownianTraitType
BrownianTrait{T <: AbstractTree, N <: Number}

A continuous trait evolved on a phylogenetic tree. This is a Sampleable type, so a random trait can be created using rand(). The trait to be evolved can be any continuous numeric type, including Unitful types for instance, and in the simplest case is determined by the third argument to the constructor start:

function BrownianTrait(tree::AbstractTree, trait::String, start::Number = 0.0; σ² = missing, σ = missing, f::Function = identity)

Note that when Unitful is being used, either here or in branch lengths, σ/σ² keyword argument units must be appropriate. The final keyword argument, f, is a function to transform the evolved gaussian trait into its true value. By default this is the identity function, but can, for instance, be abs to force a positive value on the trait, or more complex functions as required, such as a transformation to turn a continuous variable into a discrete trait

source
Phylo.DiscreteTraitType
DiscreteTrait{T <: AbstractTree, E <: Enum}

A discrete trait evolved on a phylogenetic tree. This is a Sampleable type, so a random trait can be created using rand(dt). The trait to be evolved must be an Enum (generally created using @enum), and is the second argument to the constructor:

function DiscreteTrait(tree::AbstractTree, ttype::Type{<:Enum}, transition_matrix::AbstractMatrix{Float64}, trait::String)

The transition matrix holds transition rates from row to column (so row sums must be zero), and the transition probabilities in a branch are calculated as exp(transition_matrix .* branch_length).

source
Phylo.SymmetricDiscreteTraitType
SymmetricDiscreteTrait{T <: AbstractTree, E <: Enum}

The simplest possible discrete trait evolved on a phylogenetic tree. This is a Sampleable type, so a random trait can be created using rand(sdt). The trait to be evolved must be an Enum (generally created using @enum), and is the second argument to the constructor:

function DiscreteTrait(tree::AbstractTree, ttype::Type{<:Enum}, transition_rate::Number, trait::String)

The transition matrix holds transition rates from row to column (so row sums must be zero), and the transition probabilities in a branch are calculated as exp(transition_matrix .* branch_length).

source
+Modelling traits · Phylo.jl

Modelling traits on trees

Phylo.BrownianTraitType
BrownianTrait{T <: AbstractTree, N <: Number}

A continuous trait evolved on a phylogenetic tree. This is a Sampleable type, so a random trait can be created using rand(). The trait to be evolved can be any continuous numeric type, including Unitful types for instance, and in the simplest case is determined by the third argument to the constructor start:

function BrownianTrait(tree::AbstractTree, trait::String, start::Number = 0.0; σ² = missing, σ = missing, f::Function = identity)

Note that when Unitful is being used, either here or in branch lengths, σ/σ² keyword argument units must be appropriate. The final keyword argument, f, is a function to transform the evolved gaussian trait into its true value. By default this is the identity function, but can, for instance, be abs to force a positive value on the trait, or more complex functions as required, such as a transformation to turn a continuous variable into a discrete trait

source
Phylo.DiscreteTraitType
DiscreteTrait{T <: AbstractTree, E <: Enum}

A discrete trait evolved on a phylogenetic tree. This is a Sampleable type, so a random trait can be created using rand(dt). The trait to be evolved must be an Enum (generally created using @enum), and is the second argument to the constructor:

function DiscreteTrait(tree::AbstractTree, ttype::Type{<:Enum}, transition_matrix::AbstractMatrix{Float64}, trait::String)

The transition matrix holds transition rates from row to column (so row sums must be zero), and the transition probabilities in a branch are calculated as exp(transition_matrix .* branch_length).

source
Phylo.SymmetricDiscreteTraitType
SymmetricDiscreteTrait{T <: AbstractTree, E <: Enum}

The simplest possible discrete trait evolved on a phylogenetic tree. This is a Sampleable type, so a random trait can be created using rand(sdt). The trait to be evolved must be an Enum (generally created using @enum), and is the second argument to the constructor:

function DiscreteTrait(tree::AbstractTree, ttype::Type{<:Enum}, transition_rate::Number, trait::String)

The transition matrix holds transition rates from row to column (so row sums must be zero), and the transition probabilities in a branch are calculated as exp(transition_matrix .* branch_length).

source
diff --git a/dev/man/plotting/4312ec6a.svg b/dev/man/plotting/39f4bbdb.svg similarity index 53% rename from dev/man/plotting/4312ec6a.svg rename to dev/man/plotting/39f4bbdb.svg index 7a217a57..574c39d7 100644 --- a/dev/man/plotting/4312ec6a.svg +++ b/dev/man/plotting/39f4bbdb.svg @@ -1,779 +1,779 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + diff --git a/dev/man/plotting/32dab42e.svg b/dev/man/plotting/43294057.svg similarity index 88% rename from dev/man/plotting/32dab42e.svg rename to dev/man/plotting/43294057.svg index 42094f8d..6e31bb55 100644 --- a/dev/man/plotting/32dab42e.svg +++ b/dev/man/plotting/43294057.svg @@ -1,270 +1,270 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/man/plotting/361eda63.svg b/dev/man/plotting/5503aec4.svg similarity index 87% rename from dev/man/plotting/361eda63.svg rename to dev/man/plotting/5503aec4.svg index 472bab4b..cfc66884 100644 --- a/dev/man/plotting/361eda63.svg +++ b/dev/man/plotting/5503aec4.svg @@ -1,395 +1,395 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/man/plotting/32821470.svg b/dev/man/plotting/72c19f32.svg similarity index 66% rename from dev/man/plotting/32821470.svg rename to dev/man/plotting/72c19f32.svg index 3b75970a..3556c388 100644 --- a/dev/man/plotting/32821470.svg +++ b/dev/man/plotting/72c19f32.svg @@ -1,520 +1,520 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/man/plotting/63b98c28.svg b/dev/man/plotting/9ae19ecf.svg similarity index 66% rename from dev/man/plotting/63b98c28.svg rename to dev/man/plotting/9ae19ecf.svg index a2e757a3..9a04842a 100644 --- a/dev/man/plotting/63b98c28.svg +++ b/dev/man/plotting/9ae19ecf.svg @@ -1,1824 +1,1824 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + diff --git a/dev/man/plotting/43c17df5.svg b/dev/man/plotting/c51db35c.svg similarity index 88% rename from dev/man/plotting/43c17df5.svg rename to dev/man/plotting/c51db35c.svg index e894f940..4f42adca 100644 --- a/dev/man/plotting/43c17df5.svg +++ b/dev/man/plotting/c51db35c.svg @@ -1,270 +1,270 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/man/plotting/57c9eb7a.svg b/dev/man/plotting/cefa1453.svg similarity index 64% rename from dev/man/plotting/57c9eb7a.svg rename to dev/man/plotting/cefa1453.svg index 926ab211..909190ea 100644 --- a/dev/man/plotting/57c9eb7a.svg +++ b/dev/man/plotting/cefa1453.svg @@ -1,526 +1,526 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/man/plotting/863fac09.svg b/dev/man/plotting/ef4647e0.svg similarity index 69% rename from dev/man/plotting/863fac09.svg rename to dev/man/plotting/ef4647e0.svg index fbc27452..5792d6c6 100644 --- a/dev/man/plotting/863fac09.svg +++ b/dev/man/plotting/ef4647e0.svg @@ -1,270 +1,270 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/man/plotting/index.html b/dev/man/plotting/index.html index 2c83b04e..3e081de2 100644 --- a/dev/man/plotting/index.html +++ b/dev/man/plotting/index.html @@ -2,19 +2,19 @@ Plotting · Phylo.jl

Plotting phylogenetic trees

Phylo defines recipes for all AbstractTrees, allowing them to be plotted with Plots.jl.

Keywords

It adds these keywords to the ones initially supported by Plots.jl:

  • treetype: choosing :fan or :dendrogram determines the shape of the tree
  • marker_group: applies the group keyword to node markers
  • line_group: applies the group keyword to branch lines
  • showtips: true (the default) shows the leaf names
  • tipfont: a tuple defining the font to use for leaf names (default is (7,)),

which sets the font size to 7 - for font definitions see Plots annotation fonts

Example plots

For this example, we will use the phylogeny of all extant hummingbird species.

Read the tree and plot it using two different treetypes. The default is :dendrogram

using Phylo, Plots
 default(linecolor = :black, size = (400, 400)) # looks nicer with black lines
 hummers = open(parsenewick, Phylo.path("hummingbirds.tree"))
-plot(hummers, size = (400, 600), showtips = false)
Example block output

For larger trees, the :fan treetype may work better

plot(hummers, treetype = :fan)
Example block output

Sorting trees for plotting

Many phylogenies look more aesthetically pleasing if the descendants from each node are sorted in order of their size. This is called ladderize in some other packages.

sort!(hummers, rev = true)
-plot(hummers, treetype = :fan)
Example block output

Coloring branches or nodes by a variable

It is common in evolutionary studies to color the branches or node markers with the value of some variable. Plots already offers the keyword attributes marker_z and line_z for these uses, and they also work on Phylo objects.

We can pass either

  • a Vector with the same number of elements as there are

branches / internal nodes, where the values follow a depthfirst order (because the tree is plotted in depthfirst order);

  • a Dict of node => value, with the value to be plotted for each node

(skipping nodes not in the Dict).

To demonstrate, let's start by defining a custom function for evolving a trait on the phylogeny according to Brownian motion, using the utility function map_depthfirst

evolve(tree) = map_depthfirst((val, node) -> val + randn(), 0., tree, Float64)
+plot(hummers, size = (400, 600), showtips = false)
Example block output

For larger trees, the :fan treetype may work better

plot(hummers, treetype = :fan)
Example block output

Sorting trees for plotting

Many phylogenies look more aesthetically pleasing if the descendants from each node are sorted in order of their size. This is called ladderize in some other packages.

sort!(hummers, rev = true)
+plot(hummers, treetype = :fan)
Example block output

Coloring branches or nodes by a variable

It is common in evolutionary studies to color the branches or node markers with the value of some variable. Plots already offers the keyword attributes marker_z and line_z for these uses, and they also work on Phylo objects.

We can pass either

  • a Vector with the same number of elements as there are

branches / internal nodes, where the values follow a depthfirst order (because the tree is plotted in depthfirst order);

  • a Dict of node => value, with the value to be plotted for each node

(skipping nodes not in the Dict).

To demonstrate, let's start by defining a custom function for evolving a trait on the phylogeny according to Brownian motion, using the utility function map_depthfirst

evolve(tree) = map_depthfirst((val, node) -> val + randn(), 0., tree, Float64)
 trait = evolve(hummers)
-plot(hummers, treetype = :fan, line_z = trait, linecolor = :RdYlBu, linewidth = 5, showtips = false)
Example block output

The inbuilt facilities for sampling traits on trees on Phylo returns a Node => value Dict, which can also be passed to marker_z

brownsampler = BrownianTrait(hummers, "Trait")
+plot(hummers, treetype = :fan, line_z = trait, linecolor = :RdYlBu, linewidth = 5, showtips = false)
Example block output

The inbuilt facilities for sampling traits on trees on Phylo returns a Node => value Dict, which can also be passed to marker_z

brownsampler = BrownianTrait(hummers, "Trait")
 plot(hummers,
      showtips = false, marker_z = rand(brownsampler),
-     linewidth = 2, markercolor = :RdYlBu, size = (400, 600))
Example block output

We can also use the map_depthfirst utility function to highlight the clade descending from, e.g., Node 248. Here, the recursive function creates a vector of colors which will all be orange after encountering Node 248 but black before

clade_color = map_depthfirst((val, node) -> node == "Node 248" ? :orange : val, :black, hummers)
-plot(hummers, linecolor = clade_color, showtips = false, linewidth = 2, size = (400, 600))
Example block output

The Plots attributes related to markers (markersize, markershape etc.) will put markers on the internal nodes (or on both internal and tip nodes if a longer) vector is passed). The series_attributes keyword is also supported and behaves the same way

plot(hummers,
+     linewidth = 2, markercolor = :RdYlBu, size = (400, 600))
Example block output

We can also use the map_depthfirst utility function to highlight the clade descending from, e.g., Node 248. Here, the recursive function creates a vector of colors which will all be orange after encountering Node 248 but black before

clade_color = map_depthfirst((val, node) -> node == "Node 248" ? :orange : val, :black, hummers)
+plot(hummers, linecolor = clade_color, showtips = false, linewidth = 2, size = (400, 600))
Example block output

The Plots attributes related to markers (markersize, markershape etc.) will put markers on the internal nodes (or on both internal and tip nodes if a longer) vector is passed). The series_attributes keyword is also supported and behaves the same way

plot(hummers,
      size = (400, 800),
      linecolor = :orange, linewidth = 5,
      markersize = 10, markercolor = :steelblue, markerstrokecolor = :white,
      series_annotations = text.(1:nnodes(hummers), 5, :center, :center, :white),
-     tipfont = (4,))
Example block output

The marker_group and line_group keywords allow plotting discrete values onto nodes or branches within the phylogeny.

Let's randomly evolve a discrete trait for temperature preference on the tree, using rand! to add the modelled values to the tree's list of node data. In addition to taking a Vector or a Dict, marker_group also accepts the name of internal node data.

## evolve the trait and add it to the tree
+     tipfont = (4,))
Example block output

The marker_group and line_group keywords allow plotting discrete values onto nodes or branches within the phylogeny.

Let's randomly evolve a discrete trait for temperature preference on the tree, using rand! to add the modelled values to the tree's list of node data. In addition to taking a Vector or a Dict, marker_group also accepts the name of internal node data.

## evolve the trait and add it to the tree
 using Random
 @enum TemperatureTrait lowTempPref midTempPref highTempPref
 tempsampler = SymmetricDiscreteTrait(hummers, TemperatureTrait, 0.4, "Temperature")
@@ -24,4 +24,4 @@
 plot(hummers, showtips = false,
    marker_group = "Temperature",
     legend = :topleft, msc = :white, treetype = :fan,
-    c = [:red :blue :green])
Example block output
Phylo.map_depthfirstFunction
map_depthfirst(FUN, start, tree, eltype = nothing)

Apply FUN to each node in tree in depth-first order, and return the result. FUN must take two arguments, val and node, where val is the result of applying FUN to the previous node, and node is the current node. start specifies the initial value of val, and eltype specifies the type of the return value of FUN.

Examples

≡≡≡≡≡≡≡≡≡≡≡ Define a function to evolve a trait on the tree according to Brownian motion

julia> evolve(tree) = map_depthfirst((val, node) -> val + randn(), 0., tree, Float64)

source
Base.sortFunction
sort(::AbstractTree; rev = false)

Copies a tree and sorts its branches. See sort! for further details.

source
Base.sort!Function
sort!(::AbstractTree; rev = false)

Sorts the branches descending from each node by total number of descendants. This creates a clearer tree for plotting. The process is also called "ladderizing" the tree. Use rev=true to reverse the sorting order.

source
+ c = [:red :blue :green])Example block output
Phylo.map_depthfirstFunction
map_depthfirst(FUN, start, tree, eltype = nothing)

Apply FUN to each node in tree in depth-first order, and return the result. FUN must take two arguments, val and node, where val is the result of applying FUN to the previous node, and node is the current node. start specifies the initial value of val, and eltype specifies the type of the return value of FUN.

Examples

≡≡≡≡≡≡≡≡≡≡≡ Define a function to evolve a trait on the tree according to Brownian motion

julia> evolve(tree) = map_depthfirst((val, node) -> val + randn(), 0., tree, Float64)

source
Base.sortFunction
sort(::AbstractTree; rev = false)

Copies a tree and sorts its branches. See sort! for further details.

source
Base.sort!Function
sort!(::AbstractTree; rev = false)

Sorts the branches descending from each node by total number of descendants. This creates a clearer tree for plotting. The process is also called "ladderizing" the tree. Use rev=true to reverse the sorting order.

source
diff --git a/dev/man/routes/index.html b/dev/man/routes/index.html index 5fb9baa3..0771419e 100644 --- a/dev/man/routes/index.html +++ b/dev/man/routes/index.html @@ -1,2 +1,2 @@ -Routes along the tree · Phylo.jl

Routes along the tree

Phylo.branchhistoryFunction
branchhistory(tree::AbstractTree, node)

Find the branch route between a node on a tree and its root

source
Phylo.branchfutureFunction
branchfuture(tree::AbstractTree, node)

Find the branches between a node on a tree and its leaves

source
Phylo.branchrouteFunction
branchroute(tree::AbstractTree, node1, node2)

Find the branch route between two nodes on a tree

source
Phylo.nodehistoryFunction
nodehistory(tree::AbstractTree, node)

Find the node route between a node on a tree and its root

source
Phylo.nodefutureFunction
nodefuture(tree::AbstractTree, node)

Find the nodes between a node on a tree and its leaves

source
Phylo.noderouteFunction
noderoute(tree::AbstractTree, node1, node2)

Find the node route between two nodes on a tree

source
+Routes along the tree · Phylo.jl

Routes along the tree

Phylo.branchhistoryFunction
branchhistory(tree::AbstractTree, node)

Find the branch route between a node on a tree and its root

source
Phylo.branchfutureFunction
branchfuture(tree::AbstractTree, node)

Find the branches between a node on a tree and its leaves

source
Phylo.branchrouteFunction
branchroute(tree::AbstractTree, node1, node2)

Find the branch route between two nodes on a tree

source
Phylo.nodehistoryFunction
nodehistory(tree::AbstractTree, node)

Find the node route between a node on a tree and its root

source
Phylo.nodefutureFunction
nodefuture(tree::AbstractTree, node)

Find the nodes between a node on a tree and its leaves

source
Phylo.noderouteFunction
noderoute(tree::AbstractTree, node1, node2)

Find the node route between two nodes on a tree

source
diff --git a/dev/man/traversal/index.html b/dev/man/traversal/index.html index 76b313f6..23c513ab 100644 --- a/dev/man/traversal/index.html +++ b/dev/man/traversal/index.html @@ -17,18 +17,18 @@ collect(trees)
2-element Vector{RootedTree}:
  RootedTree with 5 tips and 1 root. Leaf names are tip 1, tip 2, tip 3, tip 4 and tip 5
 
-9 nodes: [RecursiveNode{OneRoot} 'tip 1', a leaf with an incoming connection (branch 9), RecursiveNode{OneRoot} 'tip 2', a leaf with an incoming connection (branch 11), RecursiveNode{OneRoot} 'tip 3', a leaf with an incoming connection (branch 10), RecursiveNode{OneRoot} 'tip 4', a leaf with an incoming connection (branch 15), RecursiveNode{OneRoot} 'tip 5', a leaf with an incoming connection (branch 14), RecursiveNode{OneRoot} 'Node 6', an internal node with 1 inbound and 2 outbound connections (branches 12 and [9, 10]), RecursiveNode{OneRoot} 'Node 7', an internal node with 1 inbound and 2 outbound connections (branches 13 and [11, 12]), RecursiveNode{OneRoot} 'Node 8', an internal node with 1 inbound and 2 outbound connections (branches 16 and [13, 14]) and RecursiveNode{OneRoot} 'Node 9', a root node with 2 outbound connections (branches [15, 16])]
+9 nodes: [RecursiveNode{OneRoot} 'tip 1', a leaf with an incoming connection (branch 13), RecursiveNode{OneRoot} 'tip 2', a leaf with an incoming connection (branch 11), RecursiveNode{OneRoot} 'tip 3', a leaf with an incoming connection (branch 9), RecursiveNode{OneRoot} 'tip 4', a leaf with an incoming connection (branch 14), RecursiveNode{OneRoot} 'tip 5', a leaf with an incoming connection (branch 10), RecursiveNode{OneRoot} 'Node 6', an internal node with 1 inbound and 2 outbound connections (branches 12 and [9, 10]), RecursiveNode{OneRoot} 'Node 7', an internal node with 1 inbound and 2 outbound connections (branches 15 and [11, 12]), RecursiveNode{OneRoot} 'Node 8', an internal node with 1 inbound and 2 outbound connections (branches 16 and [13, 14]) and RecursiveNode{OneRoot} 'Node 9', a root node with 2 outbound connections (branches [15, 16])]
 
-8 branches: [RecursiveBranch{OneRoot} 9, from node 'Node 6' to node 'tip 1' (length 0.9489281903884312), RecursiveBranch{OneRoot} 10, from node 'Node 6' to node 'tip 3' (length 1.0475757159350059), RecursiveBranch{OneRoot} 11, from node 'Node 7' to node 'tip 2' (length 0.1793605355944515), RecursiveBranch{OneRoot} 12, from node 'Node 7' to node 'Node 6' (length 0.8031924062866718), RecursiveBranch{OneRoot} 13, from node 'Node 8' to node 'Node 7' (length 0.08109237020375487), RecursiveBranch{OneRoot} 14, from node 'Node 8' to node 'tip 5' (length 0.3209155276483441), RecursiveBranch{OneRoot} 15, from node 'Node 9' to node 'tip 4' (length 0.2733906840995988) and RecursiveBranch{OneRoot} 16, from node 'Node 9' to node 'Node 8' (length 0.09504185578739033)]
+8 branches: [RecursiveBranch{OneRoot} 9, from node 'Node 6' to node 'tip 3' (length 0.5252935877061007), RecursiveBranch{OneRoot} 10, from node 'Node 6' to node 'tip 5' (length 0.3739041863549761), RecursiveBranch{OneRoot} 11, from node 'Node 7' to node 'tip 2' (length 0.15078046094830827), RecursiveBranch{OneRoot} 12, from node 'Node 7' to node 'Node 6' (length 0.2819065352322141), RecursiveBranch{OneRoot} 13, from node 'Node 8' to node 'tip 1' (length 0.1424326900606495), RecursiveBranch{OneRoot} 14, from node 'Node 8' to node 'tip 4' (length 0.4313922791759587), RecursiveBranch{OneRoot} 15, from node 'Node 9' to node 'Node 7' (length 0.44334106825587855) and RecursiveBranch{OneRoot} 16, from node 'Node 9' to node 'Node 8' (length 0.7411802602609708)]
 
 Node records: "tip 1" => Dict{String, Any}() ... "Node 9" => Dict{String, Any}()
 
  RootedTree with 5 tips and 1 root. Leaf names are tip 1, tip 2, tip 3, tip 4 and tip 5
 
-9 nodes: [RecursiveNode{OneRoot} 'tip 1', a leaf with an incoming connection (branch 9), RecursiveNode{OneRoot} 'tip 2', a leaf with an incoming connection (branch 11), RecursiveNode{OneRoot} 'tip 3', a leaf with an incoming connection (branch 10), RecursiveNode{OneRoot} 'tip 4', a leaf with an incoming connection (branch 15), RecursiveNode{OneRoot} 'tip 5', a leaf with an incoming connection (branch 14), RecursiveNode{OneRoot} 'Node 6', an internal node with 1 inbound and 2 outbound connections (branches 12 and [9, 10]), RecursiveNode{OneRoot} 'Node 7', an internal node with 1 inbound and 2 outbound connections (branches 13 and [11, 12]), RecursiveNode{OneRoot} 'Node 8', an internal node with 1 inbound and 2 outbound connections (branches 16 and [13, 14]) and RecursiveNode{OneRoot} 'Node 9', a root node with 2 outbound connections (branches [15, 16])]
+9 nodes: [RecursiveNode{OneRoot} 'tip 1', a leaf with an incoming connection (branch 13), RecursiveNode{OneRoot} 'tip 2', a leaf with an incoming connection (branch 11), RecursiveNode{OneRoot} 'tip 3', a leaf with an incoming connection (branch 9), RecursiveNode{OneRoot} 'tip 4', a leaf with an incoming connection (branch 14), RecursiveNode{OneRoot} 'tip 5', a leaf with an incoming connection (branch 10), RecursiveNode{OneRoot} 'Node 6', an internal node with 1 inbound and 2 outbound connections (branches 12 and [9, 10]), RecursiveNode{OneRoot} 'Node 7', an internal node with 1 inbound and 2 outbound connections (branches 15 and [11, 12]), RecursiveNode{OneRoot} 'Node 8', an internal node with 1 inbound and 2 outbound connections (branches 16 and [13, 14]) and RecursiveNode{OneRoot} 'Node 9', a root node with 2 outbound connections (branches [15, 16])]
 
-8 branches: [RecursiveBranch{OneRoot} 9, from node 'Node 6' to node 'tip 1' (length 0.9489281903884312), RecursiveBranch{OneRoot} 10, from node 'Node 6' to node 'tip 3' (length 1.0475757159350059), RecursiveBranch{OneRoot} 11, from node 'Node 7' to node 'tip 2' (length 0.1793605355944515), RecursiveBranch{OneRoot} 12, from node 'Node 7' to node 'Node 6' (length 0.8031924062866718), RecursiveBranch{OneRoot} 13, from node 'Node 8' to node 'Node 7' (length 0.08109237020375487), RecursiveBranch{OneRoot} 14, from node 'Node 8' to node 'tip 5' (length 0.3209155276483441), RecursiveBranch{OneRoot} 15, from node 'Node 9' to node 'tip 4' (length 0.2733906840995988) and RecursiveBranch{OneRoot} 16, from node 'Node 9' to node 'Node 8' (length 0.09504185578739033)]
+8 branches: [RecursiveBranch{OneRoot} 9, from node 'Node 6' to node 'tip 3' (length 0.5252935877061007), RecursiveBranch{OneRoot} 10, from node 'Node 6' to node 'tip 5' (length 0.3739041863549761), RecursiveBranch{OneRoot} 11, from node 'Node 7' to node 'tip 2' (length 0.15078046094830827), RecursiveBranch{OneRoot} 12, from node 'Node 7' to node 'Node 6' (length 0.2819065352322141), RecursiveBranch{OneRoot} 13, from node 'Node 8' to node 'tip 1' (length 0.1424326900606495), RecursiveBranch{OneRoot} 14, from node 'Node 8' to node 'tip 4' (length 0.4313922791759587), RecursiveBranch{OneRoot} 15, from node 'Node 9' to node 'Node 7' (length 0.44334106825587855) and RecursiveBranch{OneRoot} 16, from node 'Node 9' to node 'Node 8' (length 0.7411802602609708)]
 
 Node records: "tip 1" => Dict{String, Any}() ... "Node 9" => Dict{String, Any}()
-
Phylo.nodeiterFunction
nodeiter(tree::AbstractTree)

Returns an iterator over the nodes of any tree.

source
Phylo.nodefilterFunction
nodefilter(filterfn::Function, tree::AbstractTree)

Returns an iterator over the nodes of any tree, where the AbstractNode is filtered by the function filterfn.

source
Phylo.nodenameiterFunction
nodenameiter(tree::AbstractTree)

Returns an iterator over the names of the nodes of any tree.

source
Phylo.nodenamefilterFunction
nodenamefilter(filterfn::Function, tree::AbstractTree)

Returns an iterator over the nodenames of any tree, where the AbstractNode itself is filtered by the function filterfn.

source
Phylo.branchiterFunction
branchiter(tree::AbstractTree)

Returns an iterator over the branches of any tree.

source
Phylo.branchfilterFunction
branchfilter(filterfn::Function, tree::AbstractTree)

Returns an iterator over the branches of any tree, where the AbstractBranch is filtered by the function filterfn.

source
Phylo.branchnameiterFunction
branchnameiter(tree::AbstractTree)

Returns an iterator over the names of branches of any tree.

source
Phylo.branchnamefilterFunction
branchnamefilter(filterfn::Function, tree::AbstractTree)

Returns an iterator over the names of the branches of any tree, where the AbstractBranch is filtered by the function filterfn.

source
Phylo.traversalFunction
traversal(::AbstractTree, ::TraversalOrder)
-traversal(::AbstractTree, ::TraversalOrder, init)

Return an iterable object for a tree containing nodes in given order - anyorder, preorder, inorder, postorder or breadthfirst - optionally starting from init.

source
+
Phylo.nodeiterFunction
nodeiter(tree::AbstractTree)

Returns an iterator over the nodes of any tree.

source
Phylo.nodefilterFunction
nodefilter(filterfn::Function, tree::AbstractTree)

Returns an iterator over the nodes of any tree, where the AbstractNode is filtered by the function filterfn.

source
Phylo.nodenameiterFunction
nodenameiter(tree::AbstractTree)

Returns an iterator over the names of the nodes of any tree.

source
Phylo.nodenamefilterFunction
nodenamefilter(filterfn::Function, tree::AbstractTree)

Returns an iterator over the nodenames of any tree, where the AbstractNode itself is filtered by the function filterfn.

source
Phylo.branchiterFunction
branchiter(tree::AbstractTree)

Returns an iterator over the branches of any tree.

source
Phylo.branchfilterFunction
branchfilter(filterfn::Function, tree::AbstractTree)

Returns an iterator over the branches of any tree, where the AbstractBranch is filtered by the function filterfn.

source
Phylo.branchnameiterFunction
branchnameiter(tree::AbstractTree)

Returns an iterator over the names of branches of any tree.

source
Phylo.branchnamefilterFunction
branchnamefilter(filterfn::Function, tree::AbstractTree)

Returns an iterator over the names of the branches of any tree, where the AbstractBranch is filtered by the function filterfn.

source
Phylo.traversalFunction
traversal(::AbstractTree, ::TraversalOrder)
+traversal(::AbstractTree, ::TraversalOrder, init)

Return an iterable object for a tree containing nodes in given order - anyorder, preorder, inorder, postorder or breadthfirst - optionally starting from init.

source
diff --git a/dev/man/treetypes/index.html b/dev/man/treetypes/index.html index e3f7c887..0f78b7ec 100644 --- a/dev/man/treetypes/index.html +++ b/dev/man/treetypes/index.html @@ -1,4 +1,4 @@ -Phylogeny data types · Phylo.jl

Modules and data types

Modules

Phylo.PhyloModule
Phylo package

The Phylo package provides some simple phylogenetics types (e.g. NamedTree) to interface to the Diversity package for measuring phylogenetic diversity. It also provides an interface to R for copying trees to and from that language and can read newick and nexus tree files (including TreeSets that contain multiple trees).

Finally it also provides a standard abstract interface to phylogenetic trees, by defining AbstractNode, AbstractBranch and AbstractTree supertypes, and methods to interface to them. It also provides (through the Phylo.API submodule) methods to (re)define to write your own phylogenetic type in a way that will interact cleanly with other phylogenetic packages.

source

Tree sets

Tree types

This package offers a number of different types of tree, each optimised for a specific usage

Phylo.RecursiveTreeType
struct RecursiveTree <: AbstractTree

A phylogenetic tree type containing RecursiveElts as both nodes and branches, allowing navigation of the tree using only the node and branch elements.

source
Phylo.LinkTreeType
struct LinkTree <: AbstractTree

A phylogenetic tree type containing LinkNodes and LinkBranches

source
Phylo.PolytomousTreeType
PolytomousTree

Phylogenetic tree object with polytomous branching, and known leaves and per node data

source

Node and Branch types

Phylo.RecursiveEltType
struct RecursiveElt <: AbstractElt

A type for branches or nodes in a RecursiveTree, allowing navigation of the tree without using the tree object itself.

source
Phylo.LinkNodeType
struct LinkNode <: AbstractNode

A node type that is connected by LinkBranches in a LinkTree

source
Phylo.NodeType
struct Node <: AbstractNode

A node of potentially polytomous phylogenetic tree

source
Phylo.LinkBranchType
struct LinkBranch <: AbstractBranch

A branch type that connects LinkNodes in a LinkTree

source
Phylo.BranchType
Branch
+Phylogeny data types · Phylo.jl

Modules and data types

Modules

Phylo.PhyloModule
Phylo package

The Phylo package provides some simple phylogenetics types (e.g. NamedTree) to interface to the Diversity package for measuring phylogenetic diversity. It also provides an interface to R for copying trees to and from that language and can read newick and nexus tree files (including TreeSets that contain multiple trees).

Finally it also provides a standard abstract interface to phylogenetic trees, by defining AbstractNode, AbstractBranch and AbstractTree supertypes, and methods to interface to them. It also provides (through the Phylo.API submodule) methods to (re)define to write your own phylogenetic type in a way that will interact cleanly with other phylogenetic packages.

source

Tree sets

Tree types

This package offers a number of different types of tree, each optimised for a specific usage

Phylo.RecursiveTreeType
struct RecursiveTree <: AbstractTree

A phylogenetic tree type containing RecursiveElts as both nodes and branches, allowing navigation of the tree using only the node and branch elements.

source
Phylo.LinkTreeType
struct LinkTree <: AbstractTree

A phylogenetic tree type containing LinkNodes and LinkBranches

source
Phylo.PolytomousTreeType
PolytomousTree

Phylogenetic tree object with polytomous branching, and known leaves and per node data

source

Node and Branch types

Phylo.RecursiveEltType
struct RecursiveElt <: AbstractElt

A type for branches or nodes in a RecursiveTree, allowing navigation of the tree without using the tree object itself.

source
Phylo.LinkNodeType
struct LinkNode <: AbstractNode

A node type that is connected by LinkBranches in a LinkTree

source
Phylo.NodeType
struct Node <: AbstractNode

A node of potentially polytomous phylogenetic tree

source
Phylo.LinkBranchType
struct LinkBranch <: AbstractBranch

A branch type that connects LinkNodes in a LinkTree

source
Phylo.BranchType
Branch
 
-A branch connecting two AbstractNodes of a phylogenetic tree
source

Iterator types

+A branch connecting two AbstractNodes of a phylogenetic tree
source

Iterator types

diff --git a/dev/objects.inv b/dev/objects.inv index 16810082..bfedddd8 100644 Binary files a/dev/objects.inv and b/dev/objects.inv differ diff --git a/dev/tutorial/index.html b/dev/tutorial/index.html index ebac92d1..aba40a38 100644 --- a/dev/tutorial/index.html +++ b/dev/tutorial/index.html @@ -1,2 +1,2 @@ -Tutorial / Quick start · Phylo.jl
+Tutorial / Quick start · Phylo.jl