Documentation
¶
Overview ¶
Package containing all structs and functions related to graph-like data structures used in CAMUS such as quartets, networks, and trees
Index ¶
- Constants
- Variables
- func GetChildren(node *tree.Node) []*tree.Node
- func MapIDsFromConstTree(gtre, tre *tree.Tree) ([]int16, error)
- func QSetToString(qSet map[Quartet]uint32, tre *tree.Tree) string
- func QuartetsFromTree(tre, constTree *tree.Tree) (map[Quartet]uint32, error)
- type Branch
- type Network
- type Quartet
- type TreeData
- func (td *TreeData) Clone() *TreeData
- func (td *TreeData) InLeafset(n1ID, n2ID uint16) bool
- func (td *TreeData) LCA(n1ID, n2ID int) int
- func (td *TreeData) LeafsetAsString(n *tree.Node) string
- func (td *TreeData) NumQuartet(q Quartet) uint32
- func (td *TreeData) Quartets(nid int) []Quartet
- func (td *TreeData) Sibling(node *tree.Node) *tree.Node
- func (td *TreeData) TipToNodeID(idx uint16) int
- func (td *TreeData) TotalNumQuartets() uint32
- func (td *TreeData) TotalNumUniqueQuartets() uint32
- func (td *TreeData) Under(n1ID, n2ID int) bool
- func (td *TreeData) Verify()
Constants ¶
const ( Ui = iota // index of u and w in reticulation array Wi )
const ( NilQuartet = 0 NTaxa = 4 Qtopo1 = uint8(0b1100) // three quartet topologies Qtopo2 = uint8(0b1010) Qtopo3 = uint8(0b0110) // Possible results for quartet comparison Qneq = iota // quartets equal Qeq // quartets not equal Qdiff // quartets on different taxa set )
Variables ¶
var ( ErrTipNameMismatch = errors.New("tip name mismatch! maybe the gene tree and constraint tree labels don't match?") ErrInvalidQuartet = errors.New("invalid newick for quartet") )
Functions ¶
Types ¶
type Network ¶
type Network struct {
NetTree *tree.Tree // tree from extended newick
Reticulations map[string]Branch // reticulation branches
}
func MakeNetwork ¶
Makes extended newick network out of newick tree and branch data computed by the CAMUS algorithm
type Quartet ¶
type Quartet uint64
func NewQuartet ¶
Generates quartet from four leaf newick tree (only used for testing)
func QuartetFromTreeQ ¶
Create quartet from gotree *tree.Quartet
func (Quartet) AllQuartets ¶ added in v0.5.0
func (*Quartet) Compare ¶
Compares two quartets (currently unused). There are three possible results:
- Qdiff (they contain different taxa)
- Qneq (they have a different topology)
- Qeq (they have the same topology)
type TreeData ¶
type TreeData struct {
tree.Tree
Children [][]*tree.Node // Children for each node
IdToNodes []*tree.Node // Mapping between id and node pointer
Depths []int // Distance from all nodes to the root
NumLeavesBelow []uint64 // Number of leaves below node
NLeaves int // Number of leaves
// contains filtered or unexported fields
}
Expanded tree struct containing necessary preprocessed data
func MakeTreeData ¶
Preprocess tree data and makes TreeData struct. Pass nil for qCounts if you don't need quartets.
func (*TreeData) LeafsetAsString ¶
Returns leafset as string for printing/testing
func (*TreeData) NumQuartet ¶
Get count of quartets with a particular topology
func (*TreeData) TipToNodeID ¶ added in v0.6.0
func (*TreeData) TotalNumQuartets ¶
returns total number of quartets (all topologies)