Program: 125158
Project: 125158
Buggy source:
/** 
 * Computes and adds partitions from the input set (ASTRAL-I) Also, adds extra bipartitions using ASTRAL-II heuristics. Takes care of multi-individual dataset subsampling.
 */
@Override public void formSetX(AbstractInference<Tripartition> inf){
  WQInference inference=(WQInference)inf;
  int haveMissing=preProcess(inference);
  SpeciesMapper spm=GlobalMaps.taxonNameMap.getSpeciesIdMapper();
  calculateDistances();
  if (haveMissing > 0) {
    completeGeneTrees();
  }
 else {
    this.completedGeeneTrees=this.originalInompleteGeneTrees;
  }
  System.err.println("String_Node_Str");
  int firstRoundSampling=10;
  int secondRoundSampling=2;
  System.err.println("String_Node_Str" + firstRoundSampling + "String_Node_Str");
  ArrayList<SingleIndividualSample> firstRoundSamples=new ArrayList<SingleIndividualSample>();
  for (int r=0; r < firstRoundSampling; r++) {
    System.err.println("String_Node_Str" + "String_Node_Str" + r + "String_Node_Str");
    SingleIndividualSample taxonSample=new SingleIndividualSample(spm,this.similarityMatrix);
    firstRoundSamples.add(taxonSample);
  }
  int K=5;
  int arraySize=this.completedGeeneTrees.size();
  List<List<Tree>> allGreedies=new ArrayList<List<Tree>>(arraySize);
  int i=1;
  for (  Tree gt : this.completedGeeneTrees) {
    System.err.println("String_Node_Str" + i + "String_Node_Str");
    ArrayList<Tree> firstRoundSampleTrees=new ArrayList<Tree>();
    for (    SingleIndividualSample sample : firstRoundSamples) {
      Tree contractedTree=sample.contractTree(gt);
      firstRoundSampleTrees.add(contractedTree);
    }
    System.err.println("String_Node_Str");
    ArrayList<Tree> greedies=new ArrayList<Tree>();
    for (int r=0; r < secondRoundSampling; r++) {
      Collections.shuffle(firstRoundSampleTrees,GlobalMaps.random);
      List<Tree> sample=firstRoundSampleTrees.subList(0,K);
      greedies.add(Utils.greedyConsensus(sample,false,GlobalMaps.taxonNameMap.getSpeciesIdMapper().getSTTaxonIdentifier(),true));
    }
    allGreedies.add(greedies);
    i++;
  }
  ArrayList<Tree> greedyCandidates=new ArrayList<Tree>();
  for (  List<Tree> l : allGreedies) {
    greedyCandidates.add(l.get(GlobalMaps.random.nextInt(l.size())));
  }
  Tree allGenesGreedy=Utils.greedyConsensus(greedyCandidates,false,GlobalMaps.taxonNameMap.getSpeciesIdMapper().getSTTaxonIdentifier(),true);
  resolveByUPGMA((MutableTree)allGenesGreedy,GlobalMaps.taxonNameMap.getSpeciesIdMapper().getSTTaxonIdentifier(),this.speciesSimilarityMatrix);
  for (  List<Tree> l : allGreedies) {
    for (    Tree gr : l) {
      addBipartitionsFromSignleIndTreesToX(gr,allGenesGreedy,GlobalMaps.taxonNameMap.getSpeciesIdMapper().getSTTaxonIdentifier());
      System.err.println("String_Node_Str" + clusters.getClusterCount());
    }
  }
  if (inference.getAddExtra() != 0) {
    for (int l=0; l < secondRoundSampling; l++) {
      ArrayList<Tree> genes=new ArrayList<Tree>();
      for (int j=0; j < allGreedies.size(); j++) {
        genes.add(allGreedies.get(j).get(l));
      }
      System.err.println("String_Node_Str" + inference.getAddExtra() + "String_Node_Str");
      this.addExtraBipartitionByHeuristics(genes,GlobalMaps.taxonNameMap.getSpeciesIdMapper().getSTTaxonIdentifier(),this.speciesSimilarityMatrix);
      System.err.println("String_Node_Str" + clusters.getClusterCount());
    }
  }
}

Fixed version (ground truth):
/** 
 * Computes and adds partitions from the input set (ASTRAL-I) Also, adds extra bipartitions using ASTRAL-II heuristics. Takes care of multi-individual dataset subsampling.
 */
@Override public void formSetX(AbstractInference<Tripartition> inf){
  WQInference inference=(WQInference)inf;
  int haveMissing=preProcess(inference);
  SpeciesMapper spm=GlobalMaps.taxonNameMap.getSpeciesIdMapper();
  calculateDistances();
  if (haveMissing > 0) {
    completeGeneTrees();
  }
 else {
    this.completedGeeneTrees=this.originalInompleteGeneTrees;
  }
  System.err.println("String_Node_Str");
  int firstRoundSampling=200;
  int secondRoundSampling=2;
  System.err.println("String_Node_Str" + firstRoundSampling + "String_Node_Str");
  ArrayList<SingleIndividualSample> firstRoundSamples=new ArrayList<SingleIndividualSample>();
  for (int r=0; r < firstRoundSampling; r++) {
    System.err.println("String_Node_Str" + "String_Node_Str" + r + "String_Node_Str");
    SingleIndividualSample taxonSample=new SingleIndividualSample(spm,this.similarityMatrix);
    firstRoundSamples.add(taxonSample);
  }
  int K=100;
  int arraySize=this.completedGeeneTrees.size();
  List<List<Tree>> allGreedies=new ArrayList<List<Tree>>(arraySize);
  int i=1;
  for (  Tree gt : this.completedGeeneTrees) {
    System.err.println("String_Node_Str" + i + "String_Node_Str");
    ArrayList<Tree> firstRoundSampleTrees=new ArrayList<Tree>();
    for (    SingleIndividualSample sample : firstRoundSamples) {
      Tree contractedTree=sample.contractTree(gt);
      firstRoundSampleTrees.add(contractedTree);
    }
    System.err.println("String_Node_Str");
    ArrayList<Tree> greedies=new ArrayList<Tree>();
    for (int r=0; r < secondRoundSampling; r++) {
      Collections.shuffle(firstRoundSampleTrees,GlobalMaps.random);
      List<Tree> sample=firstRoundSampleTrees.subList(0,K);
      greedies.add(Utils.greedyConsensus(sample,false,GlobalMaps.taxonNameMap.getSpeciesIdMapper().getSTTaxonIdentifier(),true));
    }
    allGreedies.add(greedies);
    i++;
  }
  ArrayList<Tree> greedyCandidates=new ArrayList<Tree>();
  for (  List<Tree> l : allGreedies) {
    greedyCandidates.add(l.get(GlobalMaps.random.nextInt(l.size())));
  }
  Tree allGenesGreedy=Utils.greedyConsensus(greedyCandidates,false,GlobalMaps.taxonNameMap.getSpeciesIdMapper().getSTTaxonIdentifier(),true);
  resolveByUPGMA((MutableTree)allGenesGreedy,GlobalMaps.taxonNameMap.getSpeciesIdMapper().getSTTaxonIdentifier(),this.speciesSimilarityMatrix);
  for (  List<Tree> l : allGreedies) {
    for (    Tree gr : l) {
      addBipartitionsFromSignleIndTreesToX(gr,allGenesGreedy,GlobalMaps.taxonNameMap.getSpeciesIdMapper().getSTTaxonIdentifier());
      System.err.println("String_Node_Str" + clusters.getClusterCount());
    }
  }
  if (inference.getAddExtra() != 0) {
    for (int l=0; l < secondRoundSampling; l++) {
      ArrayList<Tree> genes=new ArrayList<Tree>();
      for (int j=0; j < allGreedies.size(); j++) {
        genes.add(allGreedies.get(j).get(l));
      }
      System.err.println("String_Node_Str" + inference.getAddExtra() + "String_Node_Str");
      this.addExtraBipartitionByHeuristics(genes,GlobalMaps.taxonNameMap.getSpeciesIdMapper().getSTTaxonIdentifier(),this.speciesSimilarityMatrix);
      System.err.println("String_Node_Str" + clusters.getClusterCount());
    }
  }
}