statalign.postprocess.plugins.contree
Class CTMain

java.lang.Object
  extended by statalign.postprocess.plugins.contree.CTMain

public class CTMain
extends java.lang.Object

The main thread for calculating consensus trees and networks. Note that networks is dependent on the initial tree...

Author:
wood, eiriksson

Constructor Summary
CTMain()
          Initialise the class
 
Method Summary
 void addNewTree(TreeNode root)
          Add a new tree to the hash table
 void addTestSplit(java.util.BitSet partition)
          FOR TESTING ONLY Add a single split to the hash table
 void addTestTree(java.util.ArrayList<java.util.BitSet> splits)
          FOR TESTING ONLY Add a tree to the hash table
 CTree constructMajorityTree()
          Constructs the majorityTree.
 CNetwork constructNetwork(CTree tree)
          Constructs the network beginning with the consensus tree and then calls the network drawing function to calculate positions
 void CopyNode(java.util.ArrayList<CNetworkNode> nodesToCopy, CNetworkSplit splitToAdd, CNetwork network, java.util.ArrayList<CNetworkEdge> incompatibleEdges)
          Copy the list of nodes that need copying when adding a new split into a network.
 double getResPercentage()
           
 long getSeed()
           
 void InitialiseNetworkTester(int noOfTestTaxa, int noOfTestSamples)
          FOR TESTING ONLY Function called to initialise the Network Tester hash table & rest of CTMain
 void initialize(TreeNode root, int noOfSamples)
          Initialise a CTMain before usage with a first tree, going through and setting up the hash table etc.
static void main(java.lang.String[] args)
           
 void printConfig()
          Print some configuration information
 void printDetails(CTree tree, CNetwork network)
          FOR TESTING ONLY Print details from the network - call after it has been constructed!
static java.lang.String[] readTreesFromFile(java.lang.String fileName, int n)
           
 void setResPercentage(double resPercentage)
           
 void setSeed(long seed)
           
 CNetworkNode TaxonRefToNode(int taxonRef, CNetwork network)
          Find the taxon node in the network.
 void updateInterestThreshold()
          Simply update our interest threshold
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CTMain

public CTMain()
Initialise the class

Method Detail

printConfig

public void printConfig()
Print some configuration information


initialize

public void initialize(TreeNode root,
                       int noOfSamples)
Initialise a CTMain before usage with a first tree, going through and setting up the hash table etc.

Parameters:
root - Root of the initial tree to initialise with
noOfSamples - Current number of samples taken

updateInterestThreshold

public void updateInterestThreshold()
Simply update our interest threshold


addNewTree

public void addNewTree(TreeNode root)
Add a new tree to the hash table

Parameters:
root - Root of new tree to add

constructMajorityTree

public CTree constructMajorityTree()
Constructs the majorityTree. Used to make Network so remember to call this first!


constructNetwork

public CNetwork constructNetwork(CTree tree)
Constructs the network beginning with the consensus tree and then calls the network drawing function to calculate positions

Parameters:
tree - Consensus tree already calculated

CopyNode

public void CopyNode(java.util.ArrayList<CNetworkNode> nodesToCopy,
                     CNetworkSplit splitToAdd,
                     CNetwork network,
                     java.util.ArrayList<CNetworkEdge> incompatibleEdges)
Copy the list of nodes that need copying when adding a new split into a network.

Parameters:
nodesToCopy - ArrayList of nodes in the network that need to be copied
network - Network we are working in
incompatibleEdges - Edges that are in the path that joins up the nodes that are being copied
splitToAdd - Split that we are currently adding in by copying these nodes

TaxonRefToNode

public CNetworkNode TaxonRefToNode(int taxonRef,
                                   CNetwork network)
Find the taxon node in the network.

Parameters:
network - The network to find the taxon in
taxonRef - Integer representation of taxon in the TaxaMap

readTreesFromFile

public static java.lang.String[] readTreesFromFile(java.lang.String fileName,
                                                   int n)
                                            throws java.io.IOException
Throws:
java.io.IOException

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Throws:
java.io.IOException

getResPercentage

public double getResPercentage()

setResPercentage

public void setResPercentage(double resPercentage)

getSeed

public long getSeed()

setSeed

public void setSeed(long seed)

InitialiseNetworkTester

public void InitialiseNetworkTester(int noOfTestTaxa,
                                    int noOfTestSamples)
FOR TESTING ONLY Function called to initialise the Network Tester hash table & rest of CTMain

Parameters:
noOfTestTaxa - Number of taxa
noOfTestSamples - number of trees input

addTestTree

public void addTestTree(java.util.ArrayList<java.util.BitSet> splits)
FOR TESTING ONLY Add a tree to the hash table

Parameters:
splits - Tree to add consisting of an arraylist of BitSet splits

addTestSplit

public void addTestSplit(java.util.BitSet partition)
FOR TESTING ONLY Add a single split to the hash table

Parameters:
partition - BitSet split to add

printDetails

public void printDetails(CTree tree,
                         CNetwork network)
FOR TESTING ONLY Print details from the network - call after it has been constructed!

Parameters:
tree - Standard consensus tree
network - The network