Program: 50436
Project: 50436
Buggy source:
public void processPositions(int referenceIndex,int position,ObjectArrayList<IterateSortedAlignmentsListImpl.PositionBaseInfo> list){
  int sumVariantCounts=0;
  for (int i=0; i < numberOfGroups; i++) {
    refCounts[i]=0;
    variantsCount[i]=0;
    distinctReadIndexCount[i]=0;
    averageVariantQualityScore[i]=0;
  }
  if (list != null) {
    IntSet distinctReadIndices=new IntArraySet();
    for (    IterateSortedAlignmentsListImpl.PositionBaseInfo info : list) {
      final int groupIndex=readerIndexToGroupIndex[info.readerIndex];
      refCounts[groupIndex]+=info.matchesReference ? 1 : 0;
      variantsCount[groupIndex]+=info.matchesReference ? 0 : 1;
      if (!info.matchesReference) {
        sumVariantCounts+=1;
        averageVariantQualityScore[groupIndex]+=info.qualityScore;
      }
      distinctReadIndices.add(info.readIndex);
    }
    for (int groupIndex=0; groupIndex < numberOfGroups; groupIndex++) {
      averageVariantQualityScore[groupIndex]/=variantsCount[groupIndex];
      distinctReadIndexCount[groupIndex]=distinctReadIndices.size();
    }
    if (distinctReadIndices.size() >= thresholdDistinctReadIndices && sumVariantCounts > minimumVariationSupport) {
      int groupIndexA=0;
      int groupIndexB=1;
      if (!isWithinStartFlap(referenceIndex,position)) {
        CharSequence currentReferenceId=this.getReferenceId(referenceIndex);
        statWriter.setValue(refIdColumnIndex,currentReferenceId);
        statWriter.setValue(positionColumnIndex,position + 1);
        if (deAnalyzer.eval("String_Node_Str")) {
          final double denominator=(double)refCounts[groupIndexA] * (double)variantsCount[groupIndexB];
          double oddsRatio=denominator == 0 ? 1 : ((double)refCounts[groupIndexB] * (double)variantsCount[groupIndexA]) / denominator;
          double fisherP=Double.NaN;
          boolean ok=checkCounts();
          if (ok) {
            fisherP=fisherRInstalled ? FisherExactRCalculator.getFisherPValue(refCounts[groupIndexB],variantsCount[groupIndexB],refCounts[groupIndexA],variantsCount[groupIndexA]) : Double.NaN;
          }
 else {
            System.err.printf("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",currentReferenceId,referenceIndex,position + 1,refCounts[groupIndexB],variantsCount[groupIndexB],refCounts[groupIndexA],variantsCount[groupIndexA]);
          }
          statWriter.setValue(oddsRatioColumnIndex,oddsRatio);
          statWriter.setValue(fisherExactPValueColumnIndex,fisherP);
        }
        for (int groupIndex=0; groupIndex < numberOfGroups; groupIndex++) {
          statWriter.setValue(refCounts[groupIndex],"String_Node_Str",groups[groupIndex]);
          statWriter.setValue(variantsCount[groupIndex],"String_Node_Str",groups[groupIndex]);
          statWriter.setValue(distinctReadIndexCount[groupIndex],"String_Node_Str",groups[groupIndex]);
          statWriter.setValue(averageVariantQualityScore[groupIndex],"String_Node_Str",groups[groupIndex]);
          if (deAnalyzer.eval("String_Node_Str")) {
            statWriter.setValue(estimateWithinGroupDiscoveryPalue(position,groupIndex,list,variantsCount,refCounts),"String_Node_Str",groups[groupIndex]);
          }
          summarizeVariations(statWriter,list,groupIndex);
        }
        statWriter.writeRecord();
      }
    }
  }
}

Fixed version (ground truth):
public void processPositions(int referenceIndex,int position,ObjectArrayList<IterateSortedAlignmentsListImpl.PositionBaseInfo> list){
  int sumVariantCounts=0;
  for (int i=0; i < numberOfGroups; i++) {
    refCounts[i]=0;
    variantsCount[i]=0;
    distinctReadIndexCount[i]=0;
    averageVariantQualityScore[i]=0;
  }
  if (list != null) {
    IntSet distinctReadIndices=new IntArraySet();
    for (    IterateSortedAlignmentsListImpl.PositionBaseInfo info : list) {
      final int groupIndex=readerIndexToGroupIndex[info.readerIndex];
      refCounts[groupIndex]+=info.matchesReference ? 1 : 0;
      variantsCount[groupIndex]+=info.matchesReference ? 0 : 1;
      if (!info.matchesReference) {
        sumVariantCounts+=1;
        averageVariantQualityScore[groupIndex]+=info.qualityScore;
        distinctReadIndices.add(info.readIndex);
      }
    }
    for (int groupIndex=0; groupIndex < numberOfGroups; groupIndex++) {
      averageVariantQualityScore[groupIndex]/=variantsCount[groupIndex];
      distinctReadIndexCount[groupIndex]=distinctReadIndices.size();
    }
    if (distinctReadIndices.size() >= thresholdDistinctReadIndices && sumVariantCounts > minimumVariationSupport) {
      int groupIndexA=0;
      int groupIndexB=1;
      if (!isWithinStartFlap(referenceIndex,position)) {
        CharSequence currentReferenceId=this.getReferenceId(referenceIndex);
        statWriter.setValue(refIdColumnIndex,currentReferenceId);
        statWriter.setValue(positionColumnIndex,position + 1);
        if (deAnalyzer.eval("String_Node_Str")) {
          final double denominator=(double)refCounts[groupIndexA] * (double)variantsCount[groupIndexB];
          double oddsRatio=denominator == 0 ? 1 : ((double)refCounts[groupIndexB] * (double)variantsCount[groupIndexA]) / denominator;
          double fisherP=Double.NaN;
          boolean ok=checkCounts();
          if (ok) {
            fisherP=fisherRInstalled ? FisherExactRCalculator.getFisherPValue(refCounts[groupIndexB],variantsCount[groupIndexB],refCounts[groupIndexA],variantsCount[groupIndexA]) : Double.NaN;
          }
 else {
            System.err.printf("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",currentReferenceId,referenceIndex,position + 1,refCounts[groupIndexB],variantsCount[groupIndexB],refCounts[groupIndexA],variantsCount[groupIndexA]);
          }
          statWriter.setValue(oddsRatioColumnIndex,oddsRatio);
          statWriter.setValue(fisherExactPValueColumnIndex,fisherP);
        }
        for (int groupIndex=0; groupIndex < numberOfGroups; groupIndex++) {
          statWriter.setValue(refCounts[groupIndex],"String_Node_Str",groups[groupIndex]);
          statWriter.setValue(variantsCount[groupIndex],"String_Node_Str",groups[groupIndex]);
          statWriter.setValue(distinctReadIndexCount[groupIndex],"String_Node_Str",groups[groupIndex]);
          statWriter.setValue(averageVariantQualityScore[groupIndex],"String_Node_Str",groups[groupIndex]);
          if (deAnalyzer.eval("String_Node_Str")) {
            statWriter.setValue(estimateWithinGroupDiscoveryPalue(position,groupIndex,list,variantsCount,refCounts),"String_Node_Str",groups[groupIndex]);
          }
          summarizeVariations(statWriter,list,groupIndex);
        }
        statWriter.writeRecord();
      }
    }
  }
}