Program: 169262
Project: 169262
Buggy source:
public void simulate(double insertionRate,double delRate,double subRate) throws Exception {
  double errorRate=insertionRate + delRate + subRate;
  double insertionPercentage=insertionRate / errorRate;
  double deletionPercentage=delRate / errorRate;
  double subPercentage=subRate / errorRate;
  if (errorRate < 0 || errorRate > 1) {
    System.err.println("String_Node_Str");
    System.exit(1);
  }
  System.err.println("String_Node_Str");
  FastaData data=null;
  String[] sequences=null;
  if (this.reference != null) {
    data=new FastaData(this.reference);
    data.enqueueFullFile();
    Sequence[] dataSeq=data.toArray();
    sequences=new String[dataSeq.length];
    for (int i=0; i < dataSeq.length; i++) {
      sequences[i]=dataSeq[i].getString().toUpperCase().replace("String_Node_Str","String_Node_Str");
    }
  }
  System.err.println("String_Node_Str");
  for (int i=0; i < this.totalTrials; i++) {
    if (i % 1000 == 0) {
      System.err.println("String_Node_Str" + i + "String_Node_Str"+ this.totalTrials);
    }
    int sequenceLength=(int)this.requestedLength;
    int firstPos=0;
    String sequence=null;
    int seqID=0;
    if (this.reference != null) {
      sequence=null;
      while (sequence == null || sequence.length() < 4 * sequenceLength) {
        seqID=generator.nextInt(sequences.length);
        sequence=sequences[seqID];
      }
      firstPos=generator.nextInt(sequence.length());
    }
 else {
      sequence=buildRandomSequence(sequenceLength * 4);
    }
    StringBuilder firstAdj=new StringBuilder();
    StringBuilder errors=new StringBuilder();
    String firstSeq=getSequence(sequenceLength,firstPos,sequence,errorRate,firstAdj,errors,insertionPercentage,deletionPercentage,subPercentage,false);
    int offset=(int)((requestedLength * 2) - this.overlap);
    int secondPos=(firstPos + offset) % sequence.length();
    String secondSeq=getSequence(sequenceLength,secondPos,sequence,errorRate,firstAdj,errors,insertionPercentage,deletionPercentage,subPercentage,true);
    if (verbose) {
      System.err.println("String_Node_Str" + firstPos + "String_Node_Str"+ sequence.length()+ "String_Node_Str"+ secondPos+ "String_Node_Str"+ offset);
      System.err.println("String_Node_Str" + seqID + "String_Node_Str"+ firstPos+ "String_Node_Str"+ firstSeq);
      System.err.println("String_Node_Str" + seqID + "String_Node_Str"+ secondPos+ "String_Node_Str"+ secondSeq);
    }
    if (firstSeq.length() != secondSeq.length() || firstSeq.length() != requestedLength) {
      System.err.println("String_Node_Str" + firstSeq.length() + "String_Node_Str"+ secondSeq.length()+ "String_Node_Str"+ requestedLength);
      System.exit(1);
    }
    this.sharedJaccard.add(compareKmers(firstSeq,secondSeq));
    this.sharedMerCounts.add(this.sharedCount);
    if (this.reference != null) {
      sequence=null;
      int secondSeqID=0;
      while (sequence == null || sequence.length() < 2 * sequenceLength) {
        secondSeqID=generator.nextInt(sequences.length);
        sequence=sequences[secondSeqID];
      }
      secondPos=generator.nextInt(sequence.length());
      while (seqID == secondSeqID && Utils.getRangeOverlap(firstPos,firstPos + sequenceLength,secondPos,secondPos + sequenceLength) > 0) {
        secondPos=generator.nextInt(sequence.length());
      }
      secondSeq=getSequence(sequenceLength,secondPos,sequence,errorRate,firstAdj,errors,insertionPercentage,deletionPercentage,subPercentage,true);
    }
 else {
      secondPos=0;
      secondSeq=buildRandomSequence(sequenceLength);
    }
    if (firstSeq.length() != secondSeq.length() || firstSeq.length() != requestedLength) {
      System.err.println("String_Node_Str" + firstSeq.length());
      System.exit(1);
    }
    this.randomJaccard.add(compareKmers(firstSeq,secondSeq));
    this.randomMerCounts.add(this.sharedCount);
  }
  if (this.randomJaccard.size() != this.randomMerCounts.size() || this.sharedJaccard.size() != this.sharedMerCounts.size() || this.sharedJaccard.size() != this.randomJaccard.size()) {
    System.err.println("String_Node_Str");
  }
  for (int i=0; i < this.totalTrials; i++) {
    System.out.println(this.sharedMerCounts.get(i) + "String_Node_Str" + this.sharedJaccard.get(i)+ "String_Node_Str"+ this.randomMerCounts.get(i)+ "String_Node_Str"+ this.randomJaccard.get(i));
  }
  System.out.print("String_Node_Str");
  outputStats(this.sharedMerCounts,System.out);
  System.out.println();
  System.out.print("String_Node_Str");
  outputStats(this.sharedJaccard,System.out);
  System.out.println();
  System.out.print("String_Node_Str");
  outputStats(this.randomMerCounts,System.out);
  System.out.println();
  System.out.print("String_Node_Str");
  outputStats(this.randomJaccard,System.out);
  System.out.println();
}

Fixed version (ground truth):
public void simulate(double insertionRate,double delRate,double subRate) throws Exception {
  double errorRate=insertionRate + delRate + subRate;
  double insertionPercentage=insertionRate / errorRate;
  double deletionPercentage=delRate / errorRate;
  double subPercentage=subRate / errorRate;
  if (errorRate < 0 || errorRate > 1) {
    System.err.println("String_Node_Str");
    System.exit(1);
  }
  System.err.println("String_Node_Str");
  FastaData data=null;
  String[] sequences=null;
  if (this.reference != null) {
    data=new FastaData(this.reference);
    data.enqueueFullFile();
    Sequence[] dataSeq=data.toArray();
    sequences=new String[dataSeq.length];
    for (int i=0; i < dataSeq.length; i++) {
      sequences[i]=dataSeq[i].getString().toUpperCase().replace("String_Node_Str","String_Node_Str");
    }
  }
  System.err.println("String_Node_Str");
  for (int i=0; i < this.totalTrials; i++) {
    if (i % 1000 == 0) {
      System.err.println("String_Node_Str" + i + "String_Node_Str"+ this.totalTrials);
    }
    int sequenceLength=(int)this.requestedLength;
    int firstPos=0;
    String sequence=null;
    int seqID=0;
    if (this.reference != null) {
      sequence=null;
      while (sequence == null || sequence.length() < 4 * sequenceLength) {
        seqID=generator.nextInt(sequences.length);
        sequence=sequences[seqID];
      }
      firstPos=generator.nextInt(sequence.length());
    }
 else {
      sequence=buildRandomSequence(sequenceLength * 4);
    }
    StringBuilder firstAdj=new StringBuilder();
    StringBuilder errors=new StringBuilder();
    String firstSeq=getSequence(sequenceLength,firstPos,sequence,errorRate,firstAdj,errors,insertionPercentage,deletionPercentage,subPercentage,false);
    int offset=(int)((this.requestedLength * 2) - this.overlap);
    int secondPos=(firstPos + offset) % sequence.length();
    String secondSeq=getSequence(sequenceLength,secondPos,sequence,errorRate,firstAdj,errors,insertionPercentage,deletionPercentage,subPercentage,true);
    if (this.verbose) {
      System.err.println("String_Node_Str" + firstPos + "String_Node_Str"+ sequence.length()+ "String_Node_Str"+ secondPos+ "String_Node_Str"+ offset);
      System.err.println("String_Node_Str" + seqID + "String_Node_Str"+ firstPos+ "String_Node_Str"+ firstSeq);
      System.err.println("String_Node_Str" + seqID + "String_Node_Str"+ secondPos+ "String_Node_Str"+ secondSeq);
    }
    if (firstSeq.length() != secondSeq.length() || firstSeq.length() != this.requestedLength) {
      System.err.println("String_Node_Str" + firstSeq.length() + "String_Node_Str"+ secondSeq.length()+ "String_Node_Str"+ this.requestedLength);
      System.exit(1);
    }
    this.sharedJaccard.add(compareKmers(firstSeq,secondSeq));
    this.sharedMerCounts.add(this.sharedCount);
    if (this.reference != null) {
      sequence=null;
      int secondSeqID=0;
      while (sequence == null || sequence.length() < 2 * sequenceLength) {
        secondSeqID=generator.nextInt(sequences.length);
        sequence=sequences[secondSeqID];
      }
      secondPos=generator.nextInt(sequence.length());
      while (seqID == secondSeqID && Utils.getRangeOverlap(firstPos,firstPos + sequenceLength,secondPos,secondPos + sequenceLength) > 0) {
        secondPos=generator.nextInt(sequence.length());
      }
      secondSeq=getSequence(sequenceLength,secondPos,sequence,errorRate,firstAdj,errors,insertionPercentage,deletionPercentage,subPercentage,true);
    }
 else {
      secondPos=0;
      secondSeq=buildRandomSequence(sequenceLength);
    }
    if (firstSeq.length() != secondSeq.length() || firstSeq.length() != this.requestedLength) {
      System.err.println("String_Node_Str" + firstSeq.length());
      System.exit(1);
    }
    this.randomJaccard.add(compareKmers(firstSeq,secondSeq));
    this.randomMerCounts.add(this.sharedCount);
  }
  if (this.randomJaccard.size() != this.randomMerCounts.size() || this.sharedJaccard.size() != this.sharedMerCounts.size() || this.sharedJaccard.size() != this.randomJaccard.size()) {
    System.err.println("String_Node_Str");
  }
  for (int i=0; i < this.totalTrials; i++) {
    System.out.println(this.sharedMerCounts.get(i) + "String_Node_Str" + this.sharedJaccard.get(i)+ "String_Node_Str"+ this.randomMerCounts.get(i)+ "String_Node_Str"+ this.randomJaccard.get(i));
  }
  System.out.print("String_Node_Str");
  outputStats(this.sharedMerCounts,System.out);
  System.out.println();
  System.out.print("String_Node_Str");
  outputStats(this.sharedJaccard,System.out);
  System.out.println();
  System.out.print("String_Node_Str");
  outputStats(this.randomMerCounts,System.out);
  System.out.println();
  System.out.print("String_Node_Str");
  outputStats(this.randomJaccard,System.out);
  System.out.println();
}