Program: 50447
Project: 50447
Buggy source:
@Test public void testParalell(){
  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.nextGaussian());
      }
 else {
        return Math.abs(randomEngine.nextGaussian());
      }
    }
    @Override public int getOverlapCount(    final String sample,    final MutableString elementId){
      final NormalizationMethod normalizationMethod=new AlignedCountNormalization();
      return (int)(getNormalizedExpressionValue(sample,normalizationMethod,elementId) * 100);
    }
  }
;
  deCalc.setRunInParallel(true);
  deCalc.defineElement("String_Node_Str");
  deCalc.defineElement("String_Node_Str");
  deCalc.defineGroup("String_Node_Str");
  deCalc.defineGroup("String_Node_Str");
  final int numReplicates=2000;
  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");
  }
  for (  final String sampleId : deCalc.samples()) {
    final MutableString id1=new MutableString("String_Node_Str");
    final MutableString id2=new MutableString("String_Node_Str");
    deCalc.observe(sampleId,"String_Node_Str",deCalc.getOverlapCount(sampleId,id1));
    deCalc.observe(sampleId,"String_Node_Str",deCalc.getOverlapCount(sampleId,id2));
  }
  DifferentialExpressionResults list=new DifferentialExpressionResults();
  DifferentialExpressionInfo info1=new DifferentialExpressionInfo("String_Node_Str");
  DifferentialExpressionInfo info2=new DifferentialExpressionInfo("String_Node_Str");
  final FoldChangeCalculator foldChange=new FoldChangeCalculator(list);
  final AverageCalculator average=new AverageCalculator(list);
  final TTestCalculator tTest=new TTestCalculator(list);
  final FisherExactRCalculator fisher=new FisherExactRCalculator(list);
  final NormalizationMethod normalizationMethod=new AlignedCountNormalization();
  list.add(info1);
  list.add(info2);
  list=foldChange.evaluate(deCalc,normalizationMethod,list,"String_Node_Str","String_Node_Str");
  list=average.evaluate(deCalc,normalizationMethod,list,"String_Node_Str","String_Node_Str");
  list=tTest.evaluate(deCalc,normalizationMethod,list,"String_Node_Str","String_Node_Str");
  list=fisher.evaluate(deCalc,normalizationMethod,list,"String_Node_Str","String_Node_Str");
  final MutableString foldChangeIndex=foldChange.statisticIds.get(0);
  final DifferentialExpressionInfo info=list.get(0);
  assertEquals("String_Node_Str",1.4139327824612316d,list.getStatistic(info,foldChangeIndex),.1);
  assertTrue("String_Node_Str",list.getStatistic(info1,tTest.statisticIds.get(0)) < 0.01);
  assertTrue("String_Node_Str",list.getStatistic(info1,fisher.statisticIds.get(0)) > 0.05);
}

Fixed version (ground truth):
@Test public void testParalell(){
  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.nextGaussian());
      }
 else {
        return Math.abs(randomEngine.nextGaussian());
      }
    }
    @Override public int getOverlapCount(    final String sample,    final MutableString elementId){
      final NormalizationMethod normalizationMethod=new AlignedCountNormalization();
      return (int)(getNormalizedExpressionValue(sample,normalizationMethod,elementId) * 100);
    }
  }
;
  deCalc.setRunInParallel(true);
  deCalc.defineElement("String_Node_Str");
  deCalc.defineElement("String_Node_Str");
  deCalc.defineGroup("String_Node_Str");
  deCalc.defineGroup("String_Node_Str");
  final int numReplicates=2000;
  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");
  }
  for (  final String sampleId : deCalc.samples()) {
    final MutableString id1=new MutableString("String_Node_Str");
    final MutableString id2=new MutableString("String_Node_Str");
    deCalc.observe(sampleId,"String_Node_Str",deCalc.getOverlapCount(sampleId,id1));
    deCalc.observe(sampleId,"String_Node_Str",deCalc.getOverlapCount(sampleId,id2));
  }
  DifferentialExpressionResults list=new DifferentialExpressionResults();
  DifferentialExpressionInfo info1=new DifferentialExpressionInfo("String_Node_Str");
  DifferentialExpressionInfo info2=new DifferentialExpressionInfo("String_Node_Str");
  final FoldChangeCalculator foldChange=new FoldChangeCalculator(list);
  final AverageCalculator average=new AverageCalculator(list);
  final TTestCalculator tTest=new TTestCalculator(list);
  final FisherExactRCalculator fisher=new FisherExactRCalculator(list);
  final NormalizationMethod normalizationMethod=new AlignedCountNormalization();
  list.add(info1);
  list.add(info2);
  list=foldChange.evaluate(deCalc,normalizationMethod,list,"String_Node_Str","String_Node_Str");
  list=average.evaluate(deCalc,normalizationMethod,list,"String_Node_Str","String_Node_Str");
  list=tTest.evaluate(deCalc,normalizationMethod,list,"String_Node_Str","String_Node_Str");
  list=fisher.evaluate(deCalc,normalizationMethod,list,"String_Node_Str","String_Node_Str");
  final MutableString foldChangeIndex=foldChange.statisticIds.get(0);
  final DifferentialExpressionInfo info=list.get(0);
  assertEquals("String_Node_Str",1.4139327824612316d,list.getStatistic(info,foldChangeIndex),.1);
  assertTrue("String_Node_Str",list.getStatistic(info1,tTest.statisticIds.get(0)) < 0.01);
}