Example #1
0
 /**
  * Initialise a CTMain before usage with a first tree, going through and setting up the hash table
  * etc.
  *
  * @param root Root of the initial tree to initialise with
  * @param noOfSamples Current number of samples taken
  */
 public void initialize(TreeNode root, int noOfSamples) {
   // Parameter initialisation
   this.noOfSamples = noOfSamples;
   noOfTrees = 0;
   // TaxaMap initialisation
   List<TreeNode> leaves = root.getLeaves();
   noOfTaxa = leaves.size();
   // Hash initialisation
   hashUtils = new HashUtils();
   hashUtils.initialize(noOfTaxa, noOfSamples, C, seed);
   hashTable = new HashTable(hashUtils.m1);
   // Taxamap initialisation
   taxa = new TaxaMap(noOfTaxa);
   for (int i = 0; i < leaves.size(); i++) {
     taxa.put(leaves.get(i).name, i);
   }
   leafEdgeLengths = new double[noOfTaxa];
   // Adds a single star partition, once and for all.
   BitSet star = new BitSet(noOfTaxa);
   star.flip(0, noOfTaxa);
   HashEntry entry = new HashEntry(-1, star, 0.0d);
   entry.count = noOfSamples + 1;
   partitions.add(entry);
   // Majority threshold initialisation
   updateInterestThreshold();
 }