Program: 50487
Project: 50487
Buggy source:
@Test public void testAverage(){
  final Random randomEngine=new Random();
  final DifferentialExpressionCalculator deCalc=new DifferentialExpressionCalculator(){
    @Override public double getNormalizedExpressionValue(    final String sample,    final NormalizationMethod method,    final MutableString elementId){
      if (sample.startsWith("String_Node_Str")) {
        return 2 * Math.abs(randomEngine.nextDouble());
      }
 else {
        return Math.abs(randomEngine.nextDouble());
      }
    }
  }
;
  deCalc.defineElement("String_Node_Str");
  deCalc.defineElement("String_Node_Str");
  deCalc.defineGroup("String_Node_Str");
  deCalc.defineGroup("String_Node_Str");
  final int numReplicates=20000;
  deCalc.reserve(2,numReplicates * 2);
  for (int i=0; i < numReplicates; i++) {
    deCalc.associateSampleToGroup("String_Node_Str" + i,"String_Node_Str");
    deCalc.associateSampleToGroup("String_Node_Str" + i,"String_Node_Str");
  }
  final DifferentialExpressionInfo info=new DifferentialExpressionInfo("String_Node_Str");
  final DifferentialExpressionResults results=new DifferentialExpressionResults();
  final AverageCalculator averageCalculator=new AverageCalculator(results);
  results.add(info);
  final NormalizationMethod normalizationMethod=new AlignedCountNormalization();
  averageCalculator.evaluate(deCalc,normalizationMethod,results,info,"String_Node_Str","String_Node_Str");
  assertEquals("String_Node_Str",1d,results.getStatistic(info,averageCalculator.getStatisticId("String_Node_Str","String_Node_Str",normalizationMethod)),.1);
  assertEquals("String_Node_Str",0.5d,results.getStatistic(info,averageCalculator.getStatisticId("String_Node_Str","String_Node_Str",normalizationMethod)),.1);
  System.out.println(results);
  try {
    results.write(new PrintWriter("String_Node_Str"),'\t',deCalc.getElementLabelToElementTypeMap());
  }
 catch (  FileNotFoundException e) {
    fail(e.getMessage());
  }
}

Fixed version (ground truth):
@Test public void testAverage() throws IOException {
  final Random randomEngine=new Random();
  final DifferentialExpressionCalculator deCalc=new DifferentialExpressionCalculator(){
    @Override public double getNormalizedExpressionValue(    final String sample,    final NormalizationMethod method,    final MutableString elementId){
      if (sample.startsWith("String_Node_Str")) {
        return 2 * Math.abs(randomEngine.nextDouble());
      }
 else {
        return Math.abs(randomEngine.nextDouble());
      }
    }
  }
;
  deCalc.defineElement("String_Node_Str");
  deCalc.defineElement("String_Node_Str");
  deCalc.defineGroup("String_Node_Str");
  deCalc.defineGroup("String_Node_Str");
  final int numReplicates=20000;
  deCalc.reserve(2,numReplicates * 2);
  for (int i=0; i < numReplicates; i++) {
    deCalc.associateSampleToGroup("String_Node_Str" + i,"String_Node_Str");
    deCalc.associateSampleToGroup("String_Node_Str" + i,"String_Node_Str");
  }
  final DifferentialExpressionInfo info=new DifferentialExpressionInfo("String_Node_Str");
  final DifferentialExpressionResults results=new DifferentialExpressionResults();
  final AverageCalculator averageCalculator=new AverageCalculator(results);
  results.add(info);
  final NormalizationMethod normalizationMethod=new AlignedCountNormalization();
  averageCalculator.evaluate(deCalc,normalizationMethod,results,info,"String_Node_Str","String_Node_Str");
  assertEquals("String_Node_Str",1d,results.getStatistic(info,averageCalculator.getStatisticId("String_Node_Str","String_Node_Str",normalizationMethod)),.1);
  assertEquals("String_Node_Str",0.5d,results.getStatistic(info,averageCalculator.getStatisticId("String_Node_Str","String_Node_Str",normalizationMethod)),.1);
  System.out.println(results);
  results.write(new PrintWriter("String_Node_Str"),'\t',deCalc);
}