Program: 16512
Project: 16512
Buggy source:
/** 
 * Aligns two chains of groups, where the first parent is representing the list of amino acids as obtained from the SEQRES records, and the second parent represents the groups obtained from the ATOM records (and containing the actual ATOM information). This does the actual alignment and if a group can be mapped to a position in the SEQRES then the corresponding position is replaced with the group that contains the atoms.
 * @param seqRes
 * @param atomRes
 * @return true if no match has been found
 */
private boolean alignProteinChains(List<Group> seqRes,List<Group> atomRes){
  Map<Integer,Integer> seqresIndexPosition=new HashMap<Integer,Integer>();
  Map<Integer,Integer> atomIndexPosition=new HashMap<Integer,Integer>();
  String seq1=getFullAtomSequence(seqRes,seqresIndexPosition,false);
  String seq2=getFullAtomSequence(atomRes,atomIndexPosition,false);
  logger.debug("String_Node_Str" + seq1.length() + "String_Node_Str"+ seq1);
  logger.debug("String_Node_Str" + seq2.length() + "String_Node_Str"+ seq2);
  ProteinSequence s1;
  ProteinSequence s2;
  try {
    s1=new ProteinSequence(seq1);
    s2=new ProteinSequence(seq2);
  }
 catch (  CompoundNotFoundException e) {
    logger.warn("String_Node_Str",e.getMessage());
    return true;
  }
  SubstitutionMatrix<AminoAcidCompound> matrix=SubstitutionMatrixHelper.getBlosum65();
  GapPenalty penalty=new SimpleGapPenalty(8,1);
  PairwiseSequenceAligner<ProteinSequence,AminoAcidCompound> smithWaterman=Alignments.getPairwiseAligner(s1,s2,PairwiseSequenceAlignerType.LOCAL,penalty,matrix);
  SequencePair<ProteinSequence,AminoAcidCompound> pair=smithWaterman.getPair();
  if (pair == null) {
    logger.warn("String_Node_Str");
    logger.warn("String_Node_Str");
    logger.warn(seq1);
    logger.warn(seq2);
    return true;
  }
  logger.debug("String_Node_Str" + pair.toString(100));
  boolean noMatchFound=mapChains(seqRes,atomRes,pair,seqresIndexPosition,atomIndexPosition);
  return noMatchFound;
}

Fixed version (ground truth):
/** 
 * Aligns two chains of groups, where the first parent is representing the list of amino acids as obtained from the SEQRES records, and the second parent represents the groups obtained from the ATOM records (and containing the actual ATOM information). This does the actual alignment and if a group can be mapped to a position in the SEQRES then the corresponding position is replaced with the group that contains the atoms.
 * @param seqRes
 * @param atomRes
 * @return true if no match has been found
 */
private boolean alignProteinChains(List<Group> seqRes,List<Group> atomRes){
  Map<Integer,Integer> seqresIndexPosition=new HashMap<Integer,Integer>();
  Map<Integer,Integer> atomIndexPosition=new HashMap<Integer,Integer>();
  String seq1=getFullAtomSequence(seqRes,seqresIndexPosition,false);
  String seq2=getFullAtomSequence(atomRes,atomIndexPosition,false);
  logger.debug("String_Node_Str" + seq1.length() + "String_Node_Str"+ seq1);
  logger.debug("String_Node_Str" + seq2.length() + "String_Node_Str"+ seq2);
  ProteinSequence s1;
  ProteinSequence s2;
  try {
    s1=new ProteinSequence(seq1);
    s2=new ProteinSequence(seq2);
  }
 catch (  CompoundNotFoundException e) {
    logger.warn("String_Node_Str",e.getMessage());
    return true;
  }
  SubstitutionMatrix<AminoAcidCompound> matrix=SubstitutionMatrixHelper.getBlosum65();
  GapPenalty penalty=new SimpleGapPenalty(8,1);
  PairwiseSequenceAligner<ProteinSequence,AminoAcidCompound> smithWaterman=Alignments.getPairwiseAligner(s1,s2,PairwiseSequenceAlignerType.LOCAL,penalty,matrix);
  SequencePair<ProteinSequence,AminoAcidCompound> pair=smithWaterman.getPair();
  if (pair == null || pair.getLength() == 0) {
    logger.warn("String_Node_Str");
    logger.warn("String_Node_Str");
    logger.warn(seq1);
    logger.warn(seq2);
    return true;
  }
  logger.debug("String_Node_Str" + pair.toString(100));
  boolean noMatchFound=mapChains(seqRes,atomRes,pair,seqresIndexPosition,atomIndexPosition);
  return noMatchFound;
}