Documentation ¶
Overview ¶
Package expandedTree contains structs and functions that build and utilize information in a binary tree format that can be used for genome simulation and reconstruction
Index ¶
- func AssignFastas(root *ETree, fastaFilename string)
- func PopulateSubstitutionMatrices(node *ETree, unitMatrix [][]float64, unitBranchLength float64)
- func SetUp(root *ETree, prevNode *ETree)
- func ToMap(root *ETree) map[string]*ETree
- func ToNewickFile(filename string, root *ETree)
- func ToNewickString(node *ETree) string
- type ETree
- func CopyTree(tree *ETree) *ETree
- func FindNodeName(node *ETree, findMe string) *ETree
- func GetBranch(node *ETree) []*ETree
- func GetLeaves(node *ETree) []*ETree
- func GetTree(node *ETree) []*ETree
- func ReadNewick(filename string) (*ETree, error)
- func ReadTree(newickFilename string, fastasFilename string) (*ETree, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssignFastas ¶
AssignFastas takes a root node and the name of a fasta file. The function will assign fasta sequences to all the nodes in the tree if the names are identical.
func PopulateSubstitutionMatrices ¶ added in v1.0.1
PopulateSubstitutionMatrices initializes the SubstitutionMatrix field of every node in an input newick tree if the provided node is the root node. The substitution matrix for each branch is based on a known unitMatrix [][]float64, which is the substitution matrix S measured (often empirically) over a unitBranchLength float64. Thus, for a branch of length t, the substitution matrix is S^{t / unitBranchLength}
func SetUp ¶
SetUp takes a pointer to a node, root, and a "previous" node and sets the "Up" pointer of root to point to prevNode.
func ToMap ¶ added in v1.0.1
ToMap creates a map[string]*Etree, mapping each node's name to the *ETree struct.
func ToNewickFile ¶ added in v1.0.1
ToNewickFile writes a newick tree to a filename from a specified root.
func ToNewickString ¶ added in v1.0.1
ToNewickString converts a *ETree to a Newick-format string.
Types ¶
type ETree ¶
type ETree struct { Name string BranchLength float64 // This is the branch length between this node and Up. OnlyTopology bool Fasta *fasta.Fasta // Contains the sequence associated with this node. Fasta.Name should equal Name. State int // corresponds to a base Stored []float64 // a list of probabilities for each base at any given site of the genome Scrap float64 Left *ETree Right *ETree Up *ETree // The immediate ancestral node. DescendentBasePresent bool // True if any descendent nodes have a base, in a specific position BasePresent bool // True if this node has a base (A, C, G, T, or N). False if this node has dna.Gap. SubstitutionMatrix [][]float64 // for custom substitution matrices. This is a 4x4 substitution matrices for nucleotides. }
ETree is a struct that represents a node in a binary tree, and has additional fields for simulation and reconstruction.
func CopyTree ¶
CopyTree takes a root node and returns a pointer to the root node of a copy of the entire tree.
func FindNodeName ¶
FindNodeName takes a root node the name of the node we are searching for if the name is found at the root or below, a pointer to that node is the return value, and nil otherwise.
func ReadNewick ¶
ReadNewick takes a filename of a tree in newick format and returns a pointer to the root node.