Safe Haskell | None |
---|
- data NewickTree a
- = NTLeaf a !Label
- | NTInterior a [NewickTree a]
- type DefDecor = (Maybe Int, BranchLen)
- data StandardDecor = StandardDecor {
- branchLen :: BranchLen
- bootStrap :: Maybe Int
- subtreeWeight :: Int
- sortedLabels :: [Label]
- type AnnotatedTree = NewickTree StandardDecor
- data FullTree a = FullTree {
- treename :: TreeName
- labelTable :: LabelTable
- nwtree :: NewickTree a
- data ClustMode
- = BinThem
- | ClusterThem { }
- type TreeName = String
- data NumTaxa
- displayDefaultTree :: FullTree DefDecor -> Doc
- displayStrippedTree :: FullTree a -> Doc
- treeSize :: NewickTree a -> Int
- numLeaves :: NewickTree a -> Int
- liftFT :: (NewickTree t -> NewickTree a) -> FullTree t -> FullTree a
- get_dec :: NewickTree t -> t
- set_dec :: b -> NewickTree a -> NewickTree b
- get_children :: NewickTree t -> [NewickTree t]
- map_labels :: (Label -> Label) -> NewickTree a -> NewickTree a
- all_labels :: NewickTree t -> [Label]
- foldIsomorphicTrees :: ([a] -> b) -> [NewickTree a] -> NewickTree b
- avg_branchlen :: HasBranchLen a => [NewickTree a] -> Double
- get_bootstraps :: NewickTree StandardDecor -> [Int]
- data PhyBinConfig = PBC {
- verbose :: Bool
- num_taxa :: NumTaxa
- name_hack :: String -> String
- output_dir :: String
- inputs :: [String]
- do_graph :: Bool
- do_draw :: Bool
- clust_mode :: ClustMode
- highlights :: [FilePath]
- show_trees_in_dendro :: Bool
- show_interior_consensus :: Bool
- rfmode :: WhichRFMode
- preprune_labels :: Maybe [String]
- print_rfmatrix :: Bool
- dist_thresh :: Maybe Int
- branch_collapse_thresh :: Maybe Double
- bootstrap_collapse_thresh :: Maybe Int
- default_phybin_config :: PhyBinConfig
- data WhichRFMode
- = HashRF
- | TolerantNaive
- type Label = Int
- type LabelTable = Map Label String
- class HasBranchLen a where
- getBranchLen :: a -> BranchLen
Tree and tree decoration types
data NewickTree a Source
Even though the Newick format allows it, here we ignore interior node labels. (They are not commonly used.)
Note that these trees are rooted. The normalize
function ensures that a
single, canonical rooted representation is chosen.
NTLeaf a !Label | |
NTInterior a [NewickTree a] |
Functor NewickTree | |
Foldable NewickTree | |
Eq a => Eq (NewickTree a) | |
Ord a => Ord (NewickTree a) | |
Show a => Show (NewickTree a) | |
Pretty dec => Pretty (NewickTree dec) |
type DefDecor = (Maybe Int, BranchLen)Source
The barebones default decorator for NewickTrees contains BOOTSTRAP and BRANCHLENGTH. The bootstrap values, if present, will range in [0..100]
data StandardDecor Source
The standard decoration includes everything in DefDecor
plus
some extra cached data:
- branch length from parent to this node (2) bootstrap values for the node
- subtree weights for future use (defined as number of LEAVES, not counting intermediate nodes) (4) sorted lists of labels for symmetry breaking
StandardDecor | |
|
type AnnotatedTree = NewickTree StandardDecorSource
Additionally includes some scratch data that is used by the binning algorithm.
A common type of tree contains the standard decorator and also a table for restoring the human-readable node names.
FullTree | |
|
How many taxa should we expect in the incoming dataset?
Tree operations
displayDefaultTree :: FullTree DefDecor -> DocSource
Display a tree WITH the bootstrap and branch lengths. This prints in NEWICK format.
displayStrippedTree :: FullTree a -> DocSource
The same, except with no bootstrap or branch lengths. Any tree annotations ignored.
treeSize :: NewickTree a -> IntSource
How many nodes (leaves and interior) are contained in a NewickTree?
numLeaves :: NewickTree a -> IntSource
This counts only leaf nodes, which should include all taxa.
liftFT :: (NewickTree t -> NewickTree a) -> FullTree t -> FullTree aSource
get_dec :: NewickTree t -> tSource
set_dec :: b -> NewickTree a -> NewickTree bSource
get_children :: NewickTree t -> [NewickTree t]Source
map_labels :: (Label -> Label) -> NewickTree a -> NewickTree aSource
Apply a function to all the *labels* (leaf names) in a tree.
all_labels :: NewickTree t -> [Label]Source
Return all the labels contained in the tree.
foldIsomorphicTrees :: ([a] -> b) -> [NewickTree a] -> NewickTree bSource
This function allows one to collapse multiple trees while looking only at the horizontal slice of all the annotations *at a given position* in the tree.
Isomorphic must apply both to the shape and the name labels or it is an error to apply this function.
Utilities specific to StandardDecor:
avg_branchlen :: HasBranchLen a => [NewickTree a] -> DoubleSource
Average branch length across all branches in all all trees.
get_bootstraps :: NewickTree StandardDecor -> [Int]Source
Retrieve all the bootstraps values actually present in a tree.
Command line config options
data PhyBinConfig Source
Due to the number of configuration options for the driver, we pack them into a record.
PBC | |
|
default_phybin_config :: PhyBinConfigSource
The default phybin configuration.
data WhichRFMode Source
Supported modes for computing RFDistance.
General helpers
Labels are inexpensive unique integers. The table is necessary for converting them back.
type LabelTable = Map Label StringSource
Map labels back onto meaningful names.
Experimenting with abstracting decoration operations
class HasBranchLen a whereSource
getBranchLen :: a -> BranchLenSource