Program: 80631
Project: 80631
Buggy source:
/** 
 * iterate over the original sequence, create map file records for each block of sequence (each block consists of identical events, e.g. insertion, or no-change), append records to sb
 * @param sb output string
 * @param chr_name name of haploid perturbed sequence
 * @param ref_seq name of original sequence
 * @param genome flags for each position of the original sequence
 * @param ins_seq recording positions of all insertions (here insertions are broader than typical definition)
 */
private void makePosMap(StringBuilder sb,String chr_name,Sequence ref_seq,byte[] genome,Hashtable<Integer,FlexSeq> ins_seq){
  boolean[] ins_flag=new boolean[genome.length];
  Enumeration<Integer> enm=ins_seq.keys();
  while (enm.hasMoreElements()) {
    Integer key=enm.nextElement();
    ins_flag[key - 1]=true;
  }
  host_ref_idx hf_idx=new host_ref_idx();
  hf_idx.host_idx=1;
  hf_idx.ref_idx=1;
  map_rec curr_rec=new_curr_rec(sb,0,chr_name,ref_seq.getName(),hf_idx,genome,ins_flag,ins_seq);
  for (int idx=1; idx < genome.length; idx++) {
    boolean same_block=true;
switch (curr_rec.feature) {
case "String_Node_Str":
      if (genome[idx] != DELETED_BASE) {
        same_block=false;
      }
 else       if (ins_flag[idx]) {
        same_block=false;
      }
    break;
case "String_Node_Str":
  if (genome[idx] == DELETED_BASE) {
    same_block=false;
  }
 else   if (ins_flag[idx]) {
    same_block=false;
  }
break;
default :
same_block=false;
break;
}
if (same_block) {
curr_rec.len++;
}
 else {
adjust_idx(curr_rec,hf_idx);
sb.append(curr_rec);
sb.append('\n');
curr_rec=new_curr_rec(sb,idx,chr_name,ref_seq.getName(),hf_idx,genome,ins_flag,ins_seq);
}
}
sb.append(curr_rec);
sb.append('\n');
}

Fixed version (ground truth):
/** 
 * iterate over the original sequence, create map file records for each block of sequence (each block consists of identical events, e.g. insertion, or no-change), append records to stringBuilder. For details about map file format, look into the comments below.
 * @param sb output string
 * @param chr_name name of haploid perturbed sequence
 * @param ref_seq name of original sequence
 * @param genome flags for each position of the original sequence
 * @param ins_seq recording positions of all insertions (here insertions are broader than typical definition)
 */
private void makePosMap(StringBuilder sb,String chr_name,Sequence ref_seq,byte[] genome,Hashtable<Integer,FlexSeq> ins_seq){
  boolean[] ins_flag=new boolean[genome.length];
  Enumeration<Integer> enm=ins_seq.keys();
  while (enm.hasMoreElements()) {
    Integer key=enm.nextElement();
    ins_flag[key - 1]=true;
  }
  host_ref_idx hf_idx=new host_ref_idx();
  hf_idx.host_idx=1;
  hf_idx.ref_idx=1;
  map_rec curr_rec=new_curr_rec(sb,0,chr_name,ref_seq.getName(),hf_idx,genome,ins_flag,ins_seq);
  for (int idx=1; idx < genome.length; idx++) {
    boolean same_block=true;
switch (curr_rec.feature) {
case "String_Node_Str":
      if (genome[idx] != DELETED_BASE) {
        same_block=false;
      }
 else       if (ins_flag[idx]) {
        same_block=false;
      }
    break;
case "String_Node_Str":
  if (genome[idx] == DELETED_BASE) {
    same_block=false;
  }
 else   if (ins_flag[idx]) {
    same_block=false;
  }
break;
default :
same_block=false;
break;
}
if (same_block) {
curr_rec.len++;
}
 else {
adjust_idx(curr_rec,hf_idx);
sb.append(curr_rec);
sb.append('\n');
curr_rec=new_curr_rec(sb,idx,chr_name,ref_seq.getName(),hf_idx,genome,ins_flag,ins_seq);
}
}
sb.append(curr_rec);
sb.append('\n');
}