Documentation
¶
Overview ¶
Package gotree implements a simple library for handling phylogenetic trees in go
Index ¶
- Constants
- func CommonEdges(edges1 []*Edge, edges2 []*Edge, tipEdges bool) (tree1 int, common int, err error)
- func Compare(refTree *Tree, compTrees <-chan Trees, tips, comparetreeidentical bool, ...) (<-chan BipartitionStats, error)
- func NewNodeIndex(t *Tree) *nodeIndex
- type BipartitionStats
- type Edge
- func (e *Edge) Bitset() *bitset.BitSet
- func (e *Edge) DumpBitSet() string
- func (e *Edge) FindEdge(edges []*Edge) (*Edge, error)
- func (e *Edge) Id() int
- func (e *Edge) Left() *Node
- func (e *Edge) Length() float64
- func (e *Edge) LengthString() string
- func (e *Edge) Locality(maxdist int, cutoff float64) (float64, float64, float64, bool, bool)
- func (e *Edge) Name(rooted bool) (nodename string)
- func (e *Edge) NeigborEdges(maxdist int) []*Edge
- func (e *Edge) NumTipsLeft() (int, error)
- func (e *Edge) NumTipsRight() (int, error)
- func (e *Edge) PValue() float64
- func (e *Edge) Right() *Node
- func (e *Edge) SameBipartition(e2 *Edge) bool
- func (e *Edge) SetId(id int)
- func (e *Edge) SetLength(length float64)
- func (e *Edge) SetPValue(pval float64)
- func (e *Edge) SetSupport(support float64)
- func (e *Edge) Support() float64
- func (e *Edge) SupportString() string
- func (e *Edge) TipPresent(id uint) bool
- func (e *Edge) ToStatsString() string
- func (e *Edge) TopoDepth() (int, error)
- type EdgeIndex
- type EdgeIndexInfo
- type EdgeKey
- type KeyValue
- type Node
- func (n *Node) AddComment(comment string)
- func (n *Node) ClearComments()
- func (n *Node) Comments() []string
- func (n *Node) CommentsString() string
- func (n *Node) Depth() (int, error)
- func (n *Node) EdgeIndex(e *Edge) (int, error)
- func (n *Node) Edges() []*Edge
- func (n *Node) Id() int
- func (n *Node) Name() string
- func (n *Node) Neigh() []*Node
- func (n *Node) Newick(parent *Node, newick *bytes.Buffer)
- func (n *Node) Nneigh() int
- func (n *Node) NodeIndex(next *Node) (int, error)
- func (n *Node) Parent() (*Node, error)
- func (n *Node) ParentEdge() (*Edge, error)
- func (n *Node) SetDepth(depth int)
- func (n *Node) SetId(id int)
- func (n *Node) SetName(name string)
- func (n *Node) Tip() bool
- type NodeIndex
- type Quartet
- type QuartetSet
- type Tree
- func BipartitionTree(leftTips []string, rightTips []string) (*Tree, error)
- func Consensus(trees <-chan Trees, cutoff float64) (*Tree, error)
- func EdgeTree(t *Tree, e *Edge, alltips []string) *Tree
- func NewTree() *Tree
- func RandomBalancedBinaryTree(depth int, rooted bool) (*Tree, error)
- func RandomCaterpillarBinaryTree(nbtips int, rooted bool) (*Tree, error)
- func RandomUniformBinaryTree(nbtips int, rooted bool) (*Tree, error)
- func RandomYuleBinaryTree(nbtips int, rooted bool) (*Tree, error)
- func StarTree(nbtips int) (*Tree, error)
- func StarTreeFromName(names ...string) (*Tree, error)
- func StarTreeFromTree(t *Tree) (*Tree, error)
- func (t *Tree) AddBipartition(n *Node, edges []*Edge, length, support float64) (*Edge, error)
- func (t *Tree) AllTipNames() []string
- func (t *Tree) Annotate(names map[string][]string) error
- func (t *Tree) ClearBitSets() error
- func (t *Tree) ClearComments()
- func (t *Tree) ClearLengths()
- func (t *Tree) ClearPvalues()
- func (t *Tree) ClearSupports()
- func (t *Tree) Clone() *Tree
- func (t *Tree) CollapseLowSupport(support float64)
- func (t *Tree) CollapseShortBranches(length float64)
- func (t *Tree) CollapseTopoDepth(mindepthThreshold, maxdepthThreshold int) error
- func (t *Tree) CollessIndex() (colless int)
- func (t *Tree) CommonEdges(t2 *Tree, tipEdges bool) (tree1 int, common int, err error)
- func (t *Tree) CompareTipIndexes(t2 *Tree) error
- func (t *Tree) ComputeDepths()
- func (t *Tree) ConnectNodes(parent *Node, child *Node) *Edge
- func (t *Tree) CopyEdge(e *Edge, copy *Edge)
- func (t *Tree) CopyNode(n *Node) *Node
- func (t *Tree) DeepestEdge() (maxedge *Edge)
- func (t *Tree) Edges() []*Edge
- func (t *Tree) ExistsTip(name string) (bool, error)
- func (t *Tree) GraftTipOnEdge(n *Node, e *Edge) (*Edge, *Edge, *Node, error)
- func (t *Tree) IndexQuartets(specific bool) *hashmap.HashMap
- func (t *Tree) InternalEdges() []*Edge
- func (t *Tree) LeastCommonAncestorRecur(current *Node, prev *Node, tipIndex map[string]*Node) (*Node, []*Edge, int, int, bool, error)
- func (t *Tree) LeastCommonAncestorRooted(nodeindex *nodeIndex, tips ...string) (*Node, []*Edge, bool, error)
- func (t *Tree) LeastCommonAncestorUnrooted(nodeindex *nodeIndex, tips ...string) (*Node, []*Edge, bool, error)
- func (t *Tree) MeanBranchLength() float64
- func (t *Tree) MeanSupport() float64
- func (t *Tree) MedianSupport() float64
- func (t *Tree) Merge(t2 *Tree) error
- func (t *Tree) NbCherries() (nbcherries int)
- func (t *Tree) NbTips() (int, error)
- func (t *Tree) NewEdge() *Edge
- func (t *Tree) NewNode() *Node
- func (t *Tree) Newick() string
- func (t *Tree) Nexus() string
- func (t *Tree) Nodes() []*Node
- func (t *Tree) Quartets(specific bool, it func(q *Quartet))
- func (t *Tree) ReinitIndexes()
- func (t *Tree) RemoveEdges(edges ...*Edge)
- func (t *Tree) RemoveSingleNodes()
- func (t *Tree) RemoveTips(revert bool, names ...string) error
- func (t *Tree) Rename(namemap map[string]string) error
- func (t *Tree) ReorderEdges(n *Node, prev *Node, reversed *[]*Edge) error
- func (t *Tree) Reroot(n *Node) error
- func (t *Tree) RerootFirst() error
- func (t *Tree) RerootMidPoint() error
- func (t *Tree) RerootOutGroup(tips ...string) error
- func (t *Tree) Resolve()
- func (t *Tree) Root() *Node
- func (t *Tree) Rooted() bool
- func (t *Tree) SackinIndex() (sackin int)
- func (t *Tree) SelectNodes(re string) ([]*Node, error)
- func (t *Tree) SetRoot(r *Node)
- func (t *Tree) ShuffleTips()
- func (t *Tree) SortedTips() []string
- func (t *Tree) String() string
- func (t *Tree) SubTree(n *Node) *Tree
- func (t *Tree) SumBranchLengths() float64
- func (t *Tree) TipEdges() []*Edge
- func (t *Tree) TipIndex(name string) (uint, error)
- func (t *Tree) Tips() []*Node
- func (t *Tree) ToDistanceMatrix() [][]float64
- func (t *Tree) UnRoot()
- func (t *Tree) UpdateBitSet() error
- func (t *Tree) UpdateTipIndex()
- type Trees
Constants ¶
const ( NIL_SUPPORT = -1.0 NIL_LENGTH = -1.0 NIL_PVALUE = -1.0 NIL_ID = -1.0 )
const ( QUARTET_EQUALS = iota QUARTET_CONFLICT QUARTET_DIFF )
const MaxInt = int(^uint(0) >> 1)
const (
NIL_DEPTH = -1
)
Variables ¶
This section is empty.
Functions ¶
func CommonEdges ¶
This function compares 2 trees and output the number of edges in common It does not check if the trees have different sets of tip names, but just compare the bitsets If applied on two tree with the same number of tips with different names, it will give results anyway It assumes that functions
tree.UpdateTipIndex() tree.ClearBitSets() tree.UpdateBitSet()
If tipedges is false: does not take into account tip edges Have been called before, otherwise will output an error
func Compare ¶ added in v0.2.0
func Compare(refTree *Tree, compTrees <-chan Trees, tips, comparetreeidentical bool, cpus int) (<-chan BipartitionStats, error)
This function compares bipartitions of a reference tree with a set of trees given in the input channel.
If tips is true, then comparison includes external branches. If comparetreeidentical is true, does not compute the exact number of common and specific branches, but just put sametree=true or sametree=false in the stat channel. This function returns almost immediately because computation is done in several go routines in background. The function returns a Channel which will contain bipartition statistics computed so far. This channel is closed at the end of the computations, so you can iterate over this channel in order to wait for the end of computations. It First Initializes bitsets of the reference tree
func NewNodeIndex ¶
func NewNodeIndex(t *Tree) *nodeIndex
Types ¶
type BipartitionStats ¶ added in v0.2.0
type BipartitionStats struct {
Id int // Identifier of the tree analyzed
Tree1 int // Number of bipartitions specific to the first tree
Tree2 int // Number of bipartitions specific to the second tree
Common int // Number of common bipartitions specific to the second tree
Sametree bool // True if the trees are identical
Err error // Wether an error occured or not in the computation
}
Type for channel of tree stats
type Edge ¶
type Edge struct {
// contains filtered or unexported fields
}
func MaxLengthPath ¶ added in v0.1.6
Take as argument the node from which we want to get the farthest tip (longest possible path) It returns the path (slice of edges), and the sum of branch lengths of this path Returns an error if a branch has no length
func (*Edge) DumpBitSet ¶
Returns a string representing the bitset (bipartition) defined by this edge
func (*Edge) FindEdge ¶
Return the given edge in the array of edges comparing bitsets fields Return nil if not found
func (*Edge) LengthString ¶ added in v0.2.1
func (*Edge) Locality ¶ added in v0.1.8
Returns the average difference and the max difference in support between the current edge and its neighbors The neighbors are defined by the branches with length of the path separating the branches < d cutoff: Cutoff to consider hx=true or hy=true hx=true if exists a neighbor branch with suppt > cutoff hy=true if the current branch has suppt > cutoff */ Returns (avg diff, min diff, max diff, hx, hy)
func (*Edge) Name ¶ added in v0.2.1
If rooted, the output clade name is the name of the descendent node.
if not rooted, then the clade name is the name of the node on the lightest side
func (*Edge) NeigborEdges ¶ added in v0.1.8
Returns the neighbors of the given edge. Neighbors are defined as branches separated of given branch by a path whose length < maxdist
func (*Edge) NumTipsLeft ¶ added in v0.2.3
Number of tips on the right side of the bipartition Used by "TopoDepth" function for example
func (*Edge) NumTipsRight ¶ added in v0.2.3
Number of tips on the right side of the bipartition Used by "TopoDepth" function for example
func (*Edge) SameBipartition ¶
Returns true if this edge defines the same biparition of the tips than the edge in argument
func (*Edge) SetSupport ¶
func (*Edge) SupportString ¶ added in v0.2.1
func (*Edge) TipPresent ¶
Tests wether the tip with index id in the bitset is Set or not The index corresponds to tree.Tipindex(tipname)
func (*Edge) ToStatsString ¶ added in v0.1.3
Returns a string containing informations about the edge:
Tab delimited: 1 - length 2 - support 3 - istip? 4 - depth 5 - topo depth 6 - name of node if any
type EdgeIndex ¶
type EdgeIndex struct {
// contains filtered or unexported fields
}
func NewEdgeIndex ¶
Initializes an Edge Count Index
func (*EdgeIndex) AddEdgeCount ¶
Increment edge count for an edge if it already exists in the map Otherwise adds it with count 1
func (*EdgeIndex) BitSets ¶ added in v0.1.2
Returns all the Bipartitions of the index (bitset) with their counts That have a count included in ]min,max]. If min==Max==1 : [1] Keys of the index
func (*EdgeIndex) PutEdgeValue ¶
Adds the edge in the map, with given value If the edge already exists in the index The old value is erased
type EdgeIndexInfo ¶ added in v0.1.2
type EdgeKey ¶ added in v0.1.4
type EdgeKey struct {
// contains filtered or unexported fields
}
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func (*Node) AddComment ¶
func (*Node) ClearComments ¶ added in v0.2.3
func (n *Node) ClearComments()
func (*Node) CommentsString ¶ added in v0.2.3
func (*Node) Parent ¶
Retrieve the parent node If several parents: Error Parent is defined as the node n2 connected to n by an edge e with e.left == n2 and e.right == n
func (*Node) ParentEdge ¶
Retrieve the Edge going to Parent node If several parents: Error Parent is defined as the node n2 connected to n by an edge e with e.left == n2 and e.right == n
type Quartet ¶ added in v0.1.4
type Quartet struct {
/** Indexes of the taxa in the node index
t1 t3
\ /
-----
/ \
t2 t4
*/
T1, T2, T3, T4 uint
}
* Structure representing a "quartets"
func (*Quartet) Compare ¶ added in v0.1.4
Compares the first quartet
(q1,q2)(q3,q4) With the second quartet (q5,q6)(q7,q8)
Returns:
- QUARTET_EQUALS if they have the same taxa and the same topology
- QUARTET_CONFLICT if they have the same taxa and different topology
- QUARTET_DIFF if they have different taxa
type QuartetSet ¶ added in v0.1.4
type QuartetSet struct {
// contains filtered or unexported fields
}
* Structure representing a "quartets set" Actually X sets of taxa defined by a bipartition (Maybe multifurcated) The enumeration of all the quartets is done by the "Quartets" function
func NewQuartetSet ¶ added in v0.1.4
func NewQuartetSet() *QuartetSet
* Initializes a new empty quartet with 4 sets of taxa
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
func BipartitionTree ¶ added in v0.2.1
* Builds a single edge tree, given left taxa and right taxa \ / -*---*- / \
func Consensus ¶ added in v0.1.2
Builds the consensus of trees given in the input channel. If the cutoff is 0.5 : The majority rule consensus is computed If tht cutoff is 1 : The strict consensus is computed In the output consensus tree: 1) Branch supports are computed as the proportion of trees in which the bipartition is present 2) Branch lengths are computed as the average length of the same branch over all the trees where it is present There can be errors if: * The cutoff <0.5 or >1 * The tip names are different in the different trees * Incompatible bipartition are generated to build the consensus (It should not happen since cutoff should be >=0.5)
func EdgeTree ¶ added in v0.1.4
* Builds a tree whose only internal edge is the given edge e The two internal nodes are multifurcated \ / -*---*- / \ alltips is the slice containing all tip names of the tree if nil, it will be recomputed
func RandomBalancedBinaryTree ¶ added in v0.1.6
Creates a Random Balanced Binary tree. Does it recursively until the given depth is attained. Root is at depth 0. So a depth "d" will generate a tree with 2^(d) tips. depth : Depth of the balanced binary tree rooted: if true, generates a rooted tree branch length: follow an exponential distribution with param lambda=1/0.1
func RandomCaterpillarBinaryTree ¶ added in v0.2.3
Creates a Random Caterpilar tree by adding new tips to the last added terminal edge of the tree. nbtips : Number of tips of the random binary tree to create rooted: if true, generates a rooted tree branch length: follow an exponential distribution with param lambda=1/0.1
func RandomUniformBinaryTree ¶ added in v0.1.5
Creates a Random uniform Binary tree by successively adding new tips to a random edge of the tree. nbtips : Number of tips of the random binary tree to create rooted: if true, generates a rooted tree branch length: follow an exponential distribution with param lambda=1/0.1
func RandomYuleBinaryTree ¶ added in v0.1.5
Creates a Random Yule tree by successively adding new tips to random terminal edges of the tree. nbtips : Number of tips of the random binary tree to create rooted: if true, generates a rooted tree branch lengths: follow an exponential distribution with param lambda=1/0.1
func StarTree ¶ added in v0.1.2
Creates a Star tree with nbtips tips. Since there is only one possible labelled tree, no need of randomness. nbtips : Number of tips of the star tree. Branch lengths are all set to 1.0
func StarTreeFromName ¶ added in v0.1.2
Creates a star tree using tipnames in argument Since there is only one possible labelled tree, no need of randomness. Branch lengths are all set to 1.0
func StarTreeFromTree ¶ added in v0.1.2
Creates a Star tree with the same tips as the tree in argument Lengths of branches in the star trees are the same as lengths of terminal edges of the input tree
func (*Tree) AddBipartition ¶ added in v0.1.2
This function adds a bipartition at the given node and the given edges Immagine a star tree with central node n,
1 | |
6----n-----2
/|\ / | \ e5 e4 e3
if we call AddBipartition(n,{e3,e4,e5}) we end with:
1 | |
6----n-----2
|
|
n2
/|\
/ | \
e5 e4 e3
func (*Tree) AllTipNames ¶
Returns all the tip name in the tree Starts with n==nil (root)
func (*Tree) Annotate ¶ added in v0.1.9
Annotates internal branches of a tree with given data Takes a map with - key: name of internal branch - value: names of taxa => It will take the lca of taxa and annotate it => Output tree won't have bootstrap support at the branches anymore => Considers the tree as rooted (even if multifurcation at root)!
func (*Tree) ClearBitSets ¶
func (*Tree) ClearComments ¶ added in v0.2.3
func (t *Tree) ClearComments()
Clears comments associated to all nodes and tips of the tree
func (*Tree) ClearLengths ¶ added in v0.1.5
func (t *Tree) ClearLengths()
Clears length (set to NIL_LENGTH) of all branches of the tree
func (*Tree) ClearPvalues ¶ added in v0.1.8
func (t *Tree) ClearPvalues()
Clears pvalues associated with supports (set to NIL_PVALUE) of all branches of the tree
func (*Tree) ClearSupports ¶ added in v0.1.5
func (t *Tree) ClearSupports()
Clears support (set to NIL_SUPPORT) of all branches of the tree
func (*Tree) CollapseLowSupport ¶ added in v0.1.5
Collapses (removes) the branches having support < support threshold && support != NIL_SUPPORT (exists)
func (*Tree) CollapseShortBranches ¶
Collapses (removes) the branches having length <= length threshold
func (*Tree) CollapseTopoDepth ¶ added in v0.1.9
Collapses (removes) the branches having their depth d (# taxa on the lightest side of the bipartition) mindepththreshold<=d<=maxdepththreshold
func (*Tree) CollessIndex ¶ added in v0.2.3
This functions computes the colless index of a rooted tree As Sum over nodes v of |S(left(V))-S(right(V))|. With Sleft(V) : Size of the left sublcade of V and Sright(V) size the right subclade of V. If the tree is unrooted, then it takes as starting point the deepest edge of the tree. If multifurcations : then the index of node V will be (Smax(V)-Smin(V)) With Smax(V) : Size of the largest subclade of V and Smin(V) size the smallest subclade of V.
func (*Tree) CommonEdges ¶
This function compares 2 trees and output the number of edges in common If the trees have different sets of tip names, returns an error It assumes that functions
tree.UpdateTipIndex() tree.ClearBitSets() tree.UpdateBitSet()
If tipedges is false: does not take into account tip edges Have been called before, otherwise will output an error
func (*Tree) CompareTipIndexes ¶
This function compares the tip name indexes of 2 trees If the tipindexes have the same size (!=0) and have the same set of tip names, The returns nil, otherwise returns an error
func (*Tree) ComputeDepths ¶
func (t *Tree) ComputeDepths()
func (*Tree) DeepestEdge ¶ added in v0.2.3
Returns the deepest edge of the tree (considered unrooted) in terms of number of tips on the light side of it.
func (*Tree) ExistsTip ¶
Return true if the tip with given name exists in the tree May return an error if tip index has not been initialized With UpdateTipIndex
func (*Tree) GraftTipOnEdge ¶
This function graft the Node n at the middle of the Edge e It divides the branch lenght by 2 It returns the added edges and the added nodes
func (*Tree) IndexQuartets ¶ added in v0.1.4
func (*Tree) InternalEdges ¶ added in v0.1.13
Returns all internal edges of the tree (do it recursively)
func (*Tree) LeastCommonAncestorRecur ¶ added in v0.2.1
func (t *Tree) LeastCommonAncestorRecur(current *Node, prev *Node, tipIndex map[string]*Node) (*Node, []*Edge, int, int, bool, error)
Returns for a given node ...
func (*Tree) LeastCommonAncestorRooted ¶ added in v0.2.1
func (t *Tree) LeastCommonAncestorRooted(nodeindex *nodeIndex, tips ...string) (*Node, []*Edge, bool, error)
Given a set of tip names
returns the node that is the common ancestor of them and the edges that connects this node to the subtree => Considers the tree as Rooted returned boolean value is true if the group is monophyletic
func (*Tree) LeastCommonAncestorUnrooted ¶ added in v0.1.2
func (t *Tree) LeastCommonAncestorUnrooted(nodeindex *nodeIndex, tips ...string) (*Node, []*Edge, bool, error)
Given a set of tip names
returns the node that is the common ancestor of them and the edges that connects this node to the subtree => Considers the tree as unrooted
e2---1 ----a|
| e1---2 | ---3
----|
| ---4 | ---5
----|
---6
LeastCommonAncestorUnrooted(1,2) returns a,e1,e2,true returned boolean value is true if the group is monophyletic
func (*Tree) MeanBranchLength ¶ added in v0.2.3
func (*Tree) MeanSupport ¶
func (*Tree) MedianSupport ¶
func (*Tree) Merge ¶ added in v0.2.3
Merges Two rooted trees t and t2 in t by adding a new root node with two children Corresponding to the roots of the 2 trees. If one of the tree is not rooted, returns an error Tip set must be different between the two trees, otherwise returns an error it is advised not to use t2 after the merge, since it may conflict with t Edges connecting new root with old roots have length of 1.0
func (*Tree) NbCherries ¶ added in v0.2.3
func (*Tree) Quartets ¶ added in v0.1.4
* Iterate over all the quartets of the tree, edge by edge (t1,t2)(t3,t4) specific: If true gives the specific quartets
b0 b2 \ / left-----right / \ b1 b3
Else gives all the quartets
b0-|\ /|-b2
| >-----< |
b1-|/ \|-b3
func (*Tree) ReinitIndexes ¶ added in v0.2.2
func (t *Tree) ReinitIndexes()
This Function initializes or reinitializes memory consuming structures: - bitset indexes - Tipindex - And computes node depths
func (*Tree) RemoveEdges ¶
Removes branches from the tree if they are not tip edges And if they do not connects the root of a rooted tree Merges the 2 nodes and creates multifurcations At the end, bitsets should not need to be updated
func (*Tree) RemoveSingleNodes ¶ added in v0.2.2
func (t *Tree) RemoveSingleNodes()
Remove Edges for which the left node has a unique child: Example: t1 t1
/ /
n0--n1--n2 => n0--n2
\ \ t2 t2
Will remove edge n1-n2 and keep node n2 informations (name, etc.) It adds n1-n2 length to n0-n1 (if any) and keeps n0-n1 support (if any) Useful for cleaning ncbi taxonomy for example. Not necessary for trees imported from newick files because the parser would complain about such trees
func (*Tree) RemoveTips ¶
Removes a set of tips from the tree, from tip names
func (*Tree) Rename ¶
This function renames nodes of the tree based on the map in argument If a name in the map does not exist in the tree, then returns an error If a node/tip in the tree does not have a name in the map: OK After rename, tip index is updated, as well as bitsets of the edges
func (*Tree) ReorderEdges ¶ added in v0.2.3
This function reorders the edges of a tree in order to always have left-edge-right with left node being parent of right node with respect to the given root node Important even for unrooted trees Useful mainly after a reroot Updates "reversed" edge slice, edges that have been reversed
func (*Tree) Reroot ¶
This function takes a node and reroot the tree on that node It reorients edges left-edge-right : see ReorderEdges The node must be one of the tree nodes, otherwise it returns an error
func (*Tree) RerootFirst ¶
This function takes the first node having 3 neighbors and reroot the tree on this node
func (*Tree) RerootMidPoint ¶ added in v0.1.6
func (*Tree) RerootOutGroup ¶ added in v0.1.5
This function first unroot the input tree and reroot it using the outgroup in argument if the outgroup is not monophyletic, it will take all the descendant of the LCA. An error is triggered if the LCA is multifurcated, and several branches are possible for the placement of the root. If the outgroup includes a tip that is not present in the tree, this tip will not be taken into account for the reroot.
func (*Tree) Resolve ¶ added in v0.1.9
func (t *Tree) Resolve()
Resolves multifurcating nodes (>3 neighbors) If any node has more than 3 neighbors : Resolve neighbors randomly by adding 0 length branches until it has 3 neighbors
func (*Tree) SackinIndex ¶ added in v0.2.3
This functions computes the Sackin index of a rooted tree As the sum of all tip depths. If the tree is unrooted, then it takes as starting point the deepest edge of the tree. No problems with multifurcations.
func (*Tree) SelectNodes ¶ added in v0.2.0
Returns the list of nodes having a name matching the given regexp May return an error if the regexp is malformed. In this case, returns an empty (not nil) slice of nodes.
func (*Tree) ShuffleTips ¶
func (t *Tree) ShuffleTips()
This function shuffles the tips of the tree and recompute tipindex and bitsets
func (*Tree) SortedTips ¶ added in v0.1.13
Tips, sorted by their order in the bitsets
func (*Tree) SubTree ¶ added in v0.2.0
Assumes that the tree is rooted. Otherwise, will take the pseudo root implied by the initial newick file
func (*Tree) SumBranchLengths ¶
func (*Tree) TipIndex ¶
Return the tip index if the tip with given name exists in the tree May return an error if tip index has not been initialized With UpdateTipIndex or if the tip does not exist
func (*Tree) ToDistanceMatrix ¶ added in v0.1.7
Computes and returns the distance (sum of branch lengths) between all pairs of tips in the tree
func (*Tree) UpdateBitSet ¶
Updates bitsets of all edges in the tree Assumes that the hashmap tip name : index is initialized with UpdateTipIndex function
func (*Tree) UpdateTipIndex ¶
func (t *Tree) UpdateTipIndex()
Updates the tipindex which maps tip names To index in the bitsets Bitset indexes correspond to the position of the tip in the alphabetically ordered tip name list