Program: 16902
Project: 16902
Buggy source:
/** 
 * map the seqres groups to the atomRes chain. updates the atomRes chain object with the mapped data seqRes chain should not be needed after this and atomRes should be continued to be used.
 * @param atomRes
 * @param seqRes
 */
public void mapSeqresRecords(Chain atomRes,Chain seqRes){
  List<Group> seqResGroups=seqRes.getAtomGroups();
  List<Group> atmResGroups=atomRes.getAtomGroups();
  logger.debug("String_Node_Str",atomRes.getChainID(),atmResGroups.size(),seqRes.getChainID(),seqResGroups.size());
  List<Group> matchedGroups=trySimpleMatch(seqResGroups,atmResGroups);
  if (matchedGroups != null) {
    atomRes.setSeqResGroups(matchedGroups);
    return;
  }
  logger.debug("String_Node_Str");
  int numAminosSeqres=seqRes.getAtomGroups(GroupType.AMINOACID).size();
  int numNucleotidesSeqres=seqRes.getAtomGroups(GroupType.NUCLEOTIDE).size();
  if (numAminosSeqres < 1) {
    if (numNucleotidesSeqres > 1) {
      logger.debug("String_Node_Str",seqRes.getChainID(),numNucleotidesSeqres);
      alignNucleotideChains(seqRes,atomRes);
      return;
    }
 else {
      logger.debug("String_Node_Str",seqRes.getChainID(),numAminosSeqres,numNucleotidesSeqres);
      return;
    }
  }
  if (atomRes.getAtomGroups(GroupType.AMINOACID).size() < 1) {
    logger.debug("String_Node_Str",atomRes.getChainID());
    return;
  }
  logger.debug("String_Node_Str",atomRes.getChainID());
  boolean noMatchFound=alignProteinChains(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 The seqRes chain should not be needed after this and atomRes should be further used.
 * @param atomRes the chain containing ATOM groups (in atomGroups slot). This chain is modified to contain in its seqresGroups slot the mapped atom groups
 * @param seqRes the chain containing SEQRES groups (in atomGroups slot). This chain is not modified
 */
public void mapSeqresRecords(Chain atomRes,Chain seqRes){
  List<Group> seqResGroups=seqRes.getAtomGroups();
  List<Group> atmResGroups=atomRes.getAtomGroups();
  logger.debug("String_Node_Str",atomRes.getChainID(),atmResGroups.size(),seqRes.getChainID(),seqResGroups.size());
  List<Group> matchedGroups=trySimpleMatch(seqResGroups,atmResGroups);
  if (matchedGroups != null) {
    atomRes.setSeqResGroups(matchedGroups);
    return;
  }
  logger.debug("String_Node_Str");
  int numAminosSeqres=seqRes.getAtomGroups(GroupType.AMINOACID).size();
  int numNucleotidesSeqres=seqRes.getAtomGroups(GroupType.NUCLEOTIDE).size();
  if (numAminosSeqres < 1) {
    if (numNucleotidesSeqres > 1) {
      logger.debug("String_Node_Str",seqRes.getChainID(),numNucleotidesSeqres);
      alignNucleotideChains(seqRes,atomRes);
      return;
    }
 else {
      logger.debug("String_Node_Str",seqRes.getChainID(),numAminosSeqres,numNucleotidesSeqres);
      return;
    }
  }
  if (atomRes.getAtomGroups(GroupType.AMINOACID).size() < 1) {
    logger.debug("String_Node_Str",atomRes.getChainID());
    return;
  }
  logger.debug("String_Node_Str",atomRes.getChainID());
  boolean noMatchFound=alignProteinChains(seqResGroups,atomRes.getAtomGroups());
  if (!noMatchFound) {
    atomRes.setSeqResGroups(seqResGroups);
  }
}