Program: 16939
Project: 16939
Buggy source:
/** 
 * map the seqres groups to the atomRes chain. updates the atomRes chain object with the mapped data seqRes chain shuold not be needed after this and atomRes should be continued to be used.
 * @param atomRes
 * @param seqRes
 * @throws StructureException 
 */
public void mapSeqresRecords(Chain atomRes,Chain seqRes) throws StructureException {
  List<Group> seqResGroups=seqRes.getAtomGroups();
  List<Group> atmResGroups=atomRes.getAtomGroups();
  if (DEBUG) {
    System.err.println("String_Node_Str" + atomRes.getChainID() + "String_Node_Str"+ atmResGroups.size()+ "String_Node_Str"+ seqRes.getChainID()+ "String_Node_Str"+ seqResGroups.size()+ "String_Node_Str");
  }
  boolean simpleMatchSuccessful=trySimpleMatch(seqResGroups,atmResGroups);
  if (simpleMatchSuccessful) {
    atomRes.setSeqResGroups(seqResGroups);
    return;
  }
  if (seqRes.getAtomGroups(GroupType.AMINOACID).size() < 1) {
    if (seqRes.getAtomGroups(GroupType.NUCLEOTIDE).size() > 1) {
      if (DEBUG) {
        System.out.println("String_Node_Str" + seqRes.getChainID() + "String_Node_Str");
      }
      align2NucleotideChains(seqRes,atomRes);
      return;
    }
 else {
      if (DEBUG) {
        System.out.println("String_Node_Str" + seqRes.getChainID() + "String_Node_Str");
      }
      return;
    }
  }
  if (atomRes.getAtomGroups(GroupType.AMINOACID).size() < 1) {
    if (DEBUG) {
      System.out.println("String_Node_Str" + atomRes.getChainID() + "String_Node_Str");
    }
    return;
  }
  if (DEBUG)   System.out.println("String_Node_Str" + atomRes.getChainID());
  boolean noMatchFound=align(seqResGroups,atomRes.getAtomGroups());
  if (!noMatchFound) {
    atomRes.setSeqResGroups(seqResGroups);
  }
}

Fixed version (ground truth):
/** 
 * map the seqres groups to the atomRes chain. updates the atomRes chain object with the mapped data seqRes chain shuold not be needed after this and atomRes should be continued to be used.
 * @param atomRes
 * @param seqRes
 * @throws StructureException 
 */
public void mapSeqresRecords(Chain atomRes,Chain seqRes) throws StructureException {
  List<Group> seqResGroups=seqRes.getAtomGroups();
  List<Group> atmResGroups=atomRes.getAtomGroups();
  if (DEBUG) {
    System.err.println("String_Node_Str" + atomRes.getChainID() + "String_Node_Str"+ atmResGroups.size()+ "String_Node_Str"+ seqRes.getChainID()+ "String_Node_Str"+ seqResGroups.size()+ "String_Node_Str");
  }
  List<Group> matchedGroups=trySimpleMatch(seqResGroups,atmResGroups);
  if (matchedGroups != null) {
    atomRes.setSeqResGroups(matchedGroups);
    return;
  }
  if (seqRes.getAtomGroups(GroupType.AMINOACID).size() < 1) {
    if (seqRes.getAtomGroups(GroupType.NUCLEOTIDE).size() > 1) {
      if (DEBUG) {
        System.out.println("String_Node_Str" + seqRes.getChainID() + "String_Node_Str");
      }
      align2NucleotideChains(seqRes,atomRes);
      return;
    }
 else {
      if (DEBUG) {
        System.out.println("String_Node_Str" + seqRes.getChainID() + "String_Node_Str");
      }
      return;
    }
  }
  if (atomRes.getAtomGroups(GroupType.AMINOACID).size() < 1) {
    if (DEBUG) {
      System.out.println("String_Node_Str" + atomRes.getChainID() + "String_Node_Str");
    }
    return;
  }
  if (DEBUG)   System.out.println("String_Node_Str" + atomRes.getChainID());
  boolean noMatchFound=align(seqResGroups,atomRes.getAtomGroups());
  if (!noMatchFound) {
    atomRes.setSeqResGroups(seqResGroups);
  }
}