Program: 169228
Project: 169228
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");
  String[] sequences=null;
  if (this.reference != null) {
    FastaData data=new FastaData(this.reference,0);
    data.enqueueFullFile();
    sequences=new String[data.getNumberProcessed()];
    int i=0;
    while (!data.isEmpty())     sequences[i++]=data.dequeue().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 % 100 == 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);
    if (this.kmer < 0) {
      System.out.println("String_Node_Str" + i + "String_Node_Str"+ seqID+ "String_Node_Str"+ (firstPos + sequenceLength));
      System.out.println(Utils.convertToFasta(firstSeq));
      continue;
    }
    int offset=(int)((this.requestedLength * 2) - this.overlap);
    int secondPos=(firstPos + offset) % sequence.length();
    String secondSeq=getSequence(sequenceLength,secondPos,sequence,(this.halfError ? 0 : errorRate),firstAdj,errors,(this.halfError ? 0 : insertionPercentage),(this.halfError ? 0 : deletionPercentage),(this.halfError ? 0 : 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.sharedMinHash.add(compareMinHash(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,(this.halfError ? 0 : errorRate),firstAdj,errors,(this.halfError ? 0 : insertionPercentage),(this.halfError ? 0 : deletionPercentage),(this.halfError ? 0 : 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.randomMinHash.add(compareMinHash(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");
  }
  if (this.sharedMerCounts.size() == 0) {
    return;
  }
  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.sharedMinHash.get(i)+ "String_Node_Str"+ this.randomMerCounts.get(i)+ "String_Node_Str"+ this.randomJaccard.get(i)+ "String_Node_Str"+ this.randomMinHash.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.sharedMinHash,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();
  System.out.print("String_Node_Str");
  outputStats(this.randomMinHash,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");
  String[] sequences=null;
  if (this.reference != null) {
    FastaData data=new FastaData(this.reference,0);
    data.enqueueFullFile();
    sequences=new String[data.getNumberProcessed()];
    int i=0;
    while (!data.isEmpty())     sequences[i++]=data.dequeue().getSquenceString().toUpperCase().replace("String_Node_Str","String_Node_Str");
  }
  System.err.println("String_Node_Str");
  for (int i=0; i < this.totalTrials; i++) {
    if (i % 100 == 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);
    if (this.kmer < 0) {
      System.out.println("String_Node_Str" + i + "String_Node_Str"+ seqID+ "String_Node_Str"+ (firstPos + sequenceLength));
      System.out.println(Utils.convertToFasta(firstSeq));
      continue;
    }
    int offset=(int)((this.requestedLength * 2) - this.overlap);
    int secondPos=(firstPos + offset) % sequence.length();
    String secondSeq=getSequence(sequenceLength,secondPos,sequence,(this.halfError ? 0 : errorRate),firstAdj,errors,(this.halfError ? 0 : insertionPercentage),(this.halfError ? 0 : deletionPercentage),(this.halfError ? 0 : 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.sharedMinHash.add(compareMinHash(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,(this.halfError ? 0 : errorRate),firstAdj,errors,(this.halfError ? 0 : insertionPercentage),(this.halfError ? 0 : deletionPercentage),(this.halfError ? 0 : 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.randomMinHash.add(compareMinHash(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");
  }
  if (this.sharedMerCounts.size() == 0) {
    return;
  }
  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.sharedMinHash.get(i)+ "String_Node_Str"+ this.randomMerCounts.get(i)+ "String_Node_Str"+ this.randomJaccard.get(i)+ "String_Node_Str"+ this.randomMinHash.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.sharedMinHash,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();
  System.out.print("String_Node_Str");
  outputStats(this.randomMinHash,System.out);
  System.out.println();
}