nus-yam/ex-repair huggingface dataset:
Program: 16572
Project: 16572
Buggy source:
@Override public void setPdbId(String pdbId){
  if (cache == null)   cache=new AtomCache();
  if (this.pdbId != null && (this.pdbId.equals(pdbId))) {
    return;
  }
  this.pdbId=pdbId;
  reset();
  MMCIFFileReader reader=new MMCIFFileReader(cache.getPath());
  FileParsingParameters params=cache.getFileParsingParams();
  params.setAlignSeqRes(true);
  params.setParseBioAssembly(true);
  reader.setFileParsingParameters(params);
  reader.setFetchBehavior(cache.getFetchBehavior());
  reader.setObsoleteBehavior(cache.getObsoleteBehavior());
  try {
    asymUnit=reader.getStructureById(pdbId);
    if (asymUnit.nrModels() > 1) {
      asymUnit=StructureTools.removeModels(asymUnit);
    }
    SimpleMMcifConsumer consumer=reader.getMMcifConsumer();
    pdbxStructOperList=consumer.getStructOpers();
    pdbxStructAssemblies=consumer.getStructAssemblies();
    pdbxStructAssemblyGens=consumer.getStructAssemblyGens();
    consumer.documentStart();
  }
 catch (  IOException e) {
    logger.error("String_Node_Str" + pdbId,e);
  }
}

Fixed version (ground truth):
@Override public void setPdbId(String pdbId){
  if (cache == null)   cache=new AtomCache();
  if (this.pdbId != null && (this.pdbId.equals(pdbId))) {
    return;
  }
  this.pdbId=pdbId;
  reset();
  MMCIFFileReader reader=new MMCIFFileReader(cache.getPath());
  FileParsingParameters params=cache.getFileParsingParams();
  params.setAlignSeqRes(true);
  params.setParseBioAssembly(true);
  reader.setFileParsingParameters(params);
  reader.setFetchBehavior(cache.getFetchBehavior());
  reader.setObsoleteBehavior(cache.getObsoleteBehavior());
  try {
    asymUnit=reader.getStructureById(pdbId);
    if (asymUnit.nrModels() > 1) {
      asymUnit=StructureTools.removeModels(asymUnit);
    }
    SimpleMMcifConsumer consumer=reader.getMMcifConsumer();
    pdbxStructOperList=consumer.getStructOpers();
    pdbxStructAssemblies=consumer.getStructAssemblies();
    pdbxStructAssemblyGens=consumer.getStructAssemblyGens();
    consumer.documentStart();
    Iterator<PdbxStructAssembly> it=pdbxStructAssemblies.iterator();
    while (it.hasNext()) {
      PdbxStructAssembly psa=it.next();
      try {
        Integer.parseInt(psa.getId());
      }
 catch (      NumberFormatException e) {
        logger.info("String_Node_Str",psa.getId(),pdbId);
        it.remove();
      }
    }
  }
 catch (  IOException e) {
    logger.error("String_Node_Str" + pdbId,e);
  }
}
Program: 16573
Project: 16573
Buggy source:
@Test public void test5LDH() throws IOException, StructureException {
  testID("String_Node_Str",1);
}

Fixed version (ground truth):
@Test public void test5LDH() throws IOException, StructureException {
  testID("String_Node_Str",1);
  testID("String_Node_Str",2);
  MmCifBiolAssemblyProvider mmcifProvider=new MmCifBiolAssemblyProvider();
  BioUnitDataProviderFactory.setBioUnitDataProvider(mmcifProvider.getClass().getCanonicalName());
  boolean gotException=false;
  try {
    StructureIO.getBiologicalAssembly("String_Node_Str",3);
  }
 catch (  StructureException e) {
    gotException=true;
  }
  assertTrue("String_Node_Str",gotException);
}
Program: 16574
Project: 16574
Buggy source:
/** 
 * Calculates the set of symmetry operation Matrices (transformations) of the new alignment, based on the symmetry relations in the SymmetryAxes object. <p> If the SymmetryAxes object is null, the superposition of the subunits is done without contraint.
 */
private void updateTransformation() throws StructureException {
  if (axes != null) {
    for (int t=0; t < axes.getElementaryAxes().size(); t++) {
      Matrix4d axis=axes.getElementaryAxes().get(t);
      List<Integer> chain1=axes.getSubunitRelation(t).get(0);
      List<Integer> chain2=axes.getSubunitRelation(t).get(1);
      List<Atom> list1=new ArrayList<Atom>();
      List<Atom> list2=new ArrayList<Atom>();
      for (int pair=0; pair < chain1.size(); pair++) {
        int p1=chain1.get(pair);
        int p2=chain2.get(pair);
        for (int k=0; k < length; k++) {
          Integer pos1=block.get(p1).get(k);
          Integer pos2=block.get(p2).get(k);
          if (pos1 != null && pos2 != null) {
            list1.add(atoms[pos1]);
            list2.add(atoms[pos2]);
          }
        }
      }
      Atom[] arr1=list1.toArray(new Atom[list1.size()]);
      Atom[] arr2=list2.toArray(new Atom[list2.size()]);
      SVDSuperimposer svd=new SVDSuperimposer(arr1,arr2);
      axis=svd.getTransformation();
      axes.updateAxis(t,axis);
    }
  }
 else {
    MultipleSuperimposer imposer=new CoreSuperimposer();
    imposer.superimpose(msa);
  }
}

Fixed version (ground truth):
/** 
 * Calculates the set of symmetry operation Matrices (transformations) of the new alignment, based on the symmetry relations in the SymmetryAxes object. <p> If the SymmetryAxes object is null, the superposition of the subunits is done without contraint.
 */
private void updateTransformation() throws StructureException, RefinerFailedException {
  if (msa.getCoreLength() == 0)   throw new RefinerFailedException("String_Node_Str");
  if (axes != null) {
    for (int t=0; t < axes.getElementaryAxes().size(); t++) {
      Matrix4d axis=axes.getElementaryAxes().get(t);
      List<Integer> chain1=axes.getSubunitRelation(t).get(0);
      List<Integer> chain2=axes.getSubunitRelation(t).get(1);
      List<Atom> list1=new ArrayList<Atom>();
      List<Atom> list2=new ArrayList<Atom>();
      for (int pair=0; pair < chain1.size(); pair++) {
        int p1=chain1.get(pair);
        int p2=chain2.get(pair);
        for (int k=0; k < length; k++) {
          Integer pos1=block.get(p1).get(k);
          Integer pos2=block.get(p2).get(k);
          if (pos1 != null && pos2 != null) {
            list1.add(atoms[pos1]);
            list2.add(atoms[pos2]);
          }
        }
      }
      Atom[] arr1=list1.toArray(new Atom[list1.size()]);
      Atom[] arr2=list2.toArray(new Atom[list2.size()]);
      SVDSuperimposer svd=new SVDSuperimposer(arr1,arr2);
      axis=svd.getTransformation();
      axes.updateAxis(t,axis);
    }
  }
 else {
    MultipleSuperimposer imposer=new CoreSuperimposer();
    imposer.superimpose(msa);
  }
}
Program: 16575
Project: 16575
Buggy source:
/** 
 * This method translates the internal data structures to a MultipleAlignment of the subunits in order to use the methods to score MultipleAlignments.
 * @throws StructureException
 * @throws RefinerFailedException
 */
private void updateMultipleAlignment() throws StructureException, RefinerFailedException {
  msa.clear();
  Block b=msa.getBlock(0);
  b.setAlignRes(block);
  subunitCore=b.getCoreLength();
  if (subunitCore < 1) {
    throw new RefinerFailedException("String_Node_Str");
  }
  updateTransformation();
  if (axes == null)   return;
  List<Matrix4d> transformations=new ArrayList<Matrix4d>();
  for (int su=0; su < order; su++) {
    transformations.add(axes.getSubunitTransform(su));
  }
  msa.getBlockSet(0).setTransformations(transformations);
}

Fixed version (ground truth):
/** 
 * This method translates the internal data structures to a MultipleAlignment of the subunits in order to use the methods to score MultipleAlignments.
 * @throws StructureException
 * @throws RefinerFailedException
 */
private void updateMultipleAlignment() throws StructureException, RefinerFailedException {
  msa.clear();
  Block b=msa.getBlock(0);
  b.setAlignRes(block);
  subunitCore=b.getCoreLength();
  if (subunitCore < 1)   throw new RefinerFailedException("String_Node_Str");
  updateTransformation();
  if (axes == null)   return;
  List<Matrix4d> transformations=new ArrayList<Matrix4d>();
  for (int su=0; su < order; su++) {
    transformations.add(axes.getSubunitTransform(su));
  }
  msa.getBlockSet(0).setTransformations(transformations);
}
Program: 16576
Project: 16576
Buggy source:
/** 
 * Deletes an alignment column at a randomly selected position.
 * @throws StructureException
 * @throws RefinerFailedException
 */
private boolean shrinkBlock() throws StructureException, RefinerFailedException {
  if (subunitCore <= Lmin)   return false;
  updateTransformation();
  updateMultipleAlignment();
  Matrix residueDistances=MultipleAlignmentTools.getAverageResidueDistances(msa);
  double maxDist=Double.MIN_VALUE;
  double[] colDistances=new double[length];
  int res=0;
  for (int col=0; col < length; col++) {
    int normalize=0;
    for (int s=0; s < order; s++) {
      if (residueDistances.get(s,col) != -1) {
        colDistances[col]+=residueDistances.get(s,col);
        normalize++;
      }
    }
    colDistances[col]/=normalize;
    if (colDistances[col] > maxDist) {
      if (rnd.nextDouble() > 0.5) {
        maxDist=colDistances[col];
        res=col;
      }
    }
  }
  for (int su=0; su < order; su++) {
    Integer residue=block.get(su).get(res);
    block.get(su).remove(res);
    if (residue != null)     freePool.add(residue);
    Collections.sort(freePool);
  }
  length--;
  checkGaps();
  return true;
}

Fixed version (ground truth):
/** 
 * Deletes an alignment column at a randomly selected position.
 * @throws StructureException
 * @throws RefinerFailedException
 */
private boolean shrinkBlock() throws StructureException, RefinerFailedException {
  if (subunitCore <= Lmin)   return false;
  updateMultipleAlignment();
  Matrix residueDistances=MultipleAlignmentTools.getAverageResidueDistances(msa);
  double maxDist=Double.MIN_VALUE;
  double[] colDistances=new double[length];
  int res=0;
  for (int col=0; col < length; col++) {
    int normalize=0;
    for (int s=0; s < order; s++) {
      if (residueDistances.get(s,col) != -1) {
        colDistances[col]+=residueDistances.get(s,col);
        normalize++;
      }
    }
    colDistances[col]/=normalize;
    if (colDistances[col] > maxDist) {
      if (rnd.nextDouble() > 0.5) {
        maxDist=colDistances[col];
        res=col;
      }
    }
  }
  for (int su=0; su < order; su++) {
    Integer residue=block.get(su).get(res);
    block.get(su).remove(res);
    if (residue != null)     freePool.add(residue);
    Collections.sort(freePool);
  }
  length--;
  checkGaps();
  return true;
}
Program: 16578
Project: 16578
Buggy source:
/** 
 * This method uses iteratively CeSymm to calculate all symmetries in the input array of atoms and organize them in a multiple alignment of the subunits.
 * @param atoms atoms
 * @return MultipleAlignment of the subunits
 * @throws StructureException
 */
public MultipleAlignment execute(Atom[] atoms) throws StructureException {
  allAtoms=atoms;
  for (Integer res=0; res < allAtoms.length; res++) {
    alignGraph.add(new ArrayList<Integer>());
  }
  boolean symm=iterate(atoms);
  if (symm)   buildAlignment();
 else {
    levels.add(msa);
  }
  recoverAxes();
  return msa;
}

Fixed version (ground truth):
/** 
 * This method uses iteratively CeSymm to calculate all symmetries in the input array of atoms and organize them in a multiple alignment of the subunits.
 * @param atoms atoms
 * @return MultipleAlignment of the subunits
 * @throws StructureException
 */
public MultipleAlignment execute(Atom[] atoms) throws StructureException {
  allAtoms=atoms;
  for (Integer res=0; res < allAtoms.length; res++) {
    alignGraph.add(new ArrayList<Integer>());
  }
  boolean symm=iterate(atoms);
  if (symm)   buildAlignment();
 else   levels.add(msa);
  recoverAxes();
  return msa;
}
Program: 16579
Project: 16579
Buggy source:
/** 
 * Calculates the set of symmetry operation Matrices (transformations) of the new alignment, based on the symmetry relations in the SymmetryAxes object. <p> If the SymmetryAxes object is null, the superposition of the subunits is done without contraint.
 */
private void updateTransformation() throws StructureException, RefinerFailedException {
  if (msa.getCoreLength() == 0)   throw new RefinerFailedException("String_Node_Str");
  if (axes != null) {
    for (int t=0; t < axes.getElementaryAxes().size(); t++) {
      Matrix4d axis=axes.getElementaryAxes().get(t);
      List<Integer> chain1=axes.getSubunitRelation(t).get(0);
      List<Integer> chain2=axes.getSubunitRelation(t).get(1);
      List<Atom> list1=new ArrayList<Atom>();
      List<Atom> list2=new ArrayList<Atom>();
      for (int pair=0; pair < chain1.size(); pair++) {
        int p1=chain1.get(pair);
        int p2=chain2.get(pair);
        for (int k=0; k < length; k++) {
          Integer pos1=block.get(p1).get(k);
          Integer pos2=block.get(p2).get(k);
          if (pos1 != null && pos2 != null) {
            list1.add(atoms[pos1]);
            list2.add(atoms[pos2]);
          }
        }
      }
      Atom[] arr1=list1.toArray(new Atom[list1.size()]);
      Atom[] arr2=list2.toArray(new Atom[list2.size()]);
      SVDSuperimposer svd=new SVDSuperimposer(arr1,arr2);
      axis=svd.getTransformation();
      axes.updateAxis(t,axis);
    }
  }
 else {
    MultipleSuperimposer imposer=new CoreSuperimposer();
    imposer.superimpose(msa);
  }
}

Fixed version (ground truth):
/** 
 * Calculates the set of symmetry operation Matrices (transformations) of the new alignment, based on the symmetry relations in the SymmetryAxes object. <p> If the SymmetryAxes object is null, the superposition of the subunits is done without contraint.
 */
private void updateTransformation() throws StructureException, RefinerFailedException {
  if (axes != null) {
    for (int t=0; t < axes.getElementaryAxes().size(); t++) {
      Matrix4d axis=axes.getElementaryAxes().get(t);
      List<Integer> chain1=axes.getSubunitRelation(t).get(0);
      List<Integer> chain2=axes.getSubunitRelation(t).get(1);
      List<Atom> list1=new ArrayList<Atom>();
      List<Atom> list2=new ArrayList<Atom>();
      for (int pair=0; pair < chain1.size(); pair++) {
        int p1=chain1.get(pair);
        int p2=chain2.get(pair);
        for (int k=0; k < length; k++) {
          Integer pos1=block.get(p1).get(k);
          Integer pos2=block.get(p2).get(k);
          if (pos1 != null && pos2 != null) {
            list1.add(atoms[pos1]);
            list2.add(atoms[pos2]);
          }
        }
      }
      Atom[] arr1=list1.toArray(new Atom[list1.size()]);
      Atom[] arr2=list2.toArray(new Atom[list2.size()]);
      if (arr1.length > 0 && arr2.length > 0) {
        SVDSuperimposer svd=new SVDSuperimposer(arr1,arr2);
        axis=svd.getTransformation();
        axes.updateAxis(t,axis);
      }
    }
  }
 else {
    MultipleSuperimposer imposer=new CoreSuperimposer();
    imposer.superimpose(msa);
  }
}
Program: 16580
Project: 16580
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void addGroup(Group group){
  group.setChain(this);
  groups.add(group);
  String pdbResnum=null;
  ResidueNumber resNum=group.getResidueNumber();
  if (resNum != null)   pdbResnum=resNum.toString();
  if (pdbResnum != null) {
    Integer pos=groups.size() - 1;
    if (pdbResnumMap.containsKey(pdbResnum)) {
      if (group instanceof AminoAcid)       pdbResnumMap.put(pdbResnum,pos);
    }
 else     pdbResnumMap.put(pdbResnum,pos);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void addGroup(Group group){
  group.setChain(this);
  for (  Group g : group.getAltLocs()) {
    g.setChain(this);
  }
  groups.add(group);
  String pdbResnum=null;
  ResidueNumber resNum=group.getResidueNumber();
  if (resNum != null)   pdbResnum=resNum.toString();
  if (pdbResnum != null) {
    Integer pos=groups.size() - 1;
    if (pdbResnumMap.containsKey(pdbResnum)) {
      if (group instanceof AminoAcid)       pdbResnumMap.put(pdbResnum,pos);
    }
 else     pdbResnumMap.put(pdbResnum,pos);
  }
}
Program: 16581
Project: 16581
Buggy source:
private Group getCorrectAltLocGroup(Character altLoc,String recordName,Character aminoCode1,String groupCode3){
  List<Atom> atoms=current_group.getAtoms();
  if (atoms.size() > 0) {
    Atom a1=atoms.get(0);
    if (a1.getAltLoc().equals(altLoc)) {
      return current_group;
    }
  }
  List<Group> altLocs=current_group.getAltLocs();
  for (  Group altLocG : altLocs) {
    atoms=altLocG.getAtoms();
    if (atoms.size() > 0) {
      for (      Atom a1 : atoms) {
        if (a1.getAltLoc().equals(altLoc)) {
          return altLocG;
        }
      }
    }
  }
  if (groupCode3.equals(current_group.getPDBName())) {
    if (current_group.getAtoms().size() == 0) {
      return current_group;
    }
    Group altLocG=(Group)current_group.clone();
    altLocG.setAtoms(new ArrayList<Atom>());
    current_group.addAltLoc(altLocG);
    return altLocG;
  }
  Group altLocG=getNewGroup(recordName,aminoCode1,groupCode3);
  altLocG.setPDBName(groupCode3);
  altLocG.setResidueNumber(current_group.getResidueNumber());
  current_group.addAltLoc(altLocG);
  return altLocG;
}

Fixed version (ground truth):
private Group getCorrectAltLocGroup(Character altLoc,String recordName,Character aminoCode1,String groupCode3){
  List<Atom> atoms=current_group.getAtoms();
  if (atoms.size() > 0) {
    Atom a1=atoms.get(0);
    if (a1.getAltLoc().equals(altLoc)) {
      return current_group;
    }
  }
  List<Group> altLocs=current_group.getAltLocs();
  for (  Group altLocG : altLocs) {
    atoms=altLocG.getAtoms();
    if (atoms.size() > 0) {
      for (      Atom a1 : atoms) {
        if (a1.getAltLoc().equals(altLoc)) {
          return altLocG;
        }
      }
    }
  }
  if (groupCode3.equals(current_group.getPDBName())) {
    if (current_group.getAtoms().size() == 0) {
      return current_group;
    }
    Group altLocG=(Group)current_group.clone();
    altLocG.setAtoms(new ArrayList<Atom>());
    altLocG.getAltLocs().clear();
    current_group.addAltLoc(altLocG);
    return altLocG;
  }
  Group altLocG=getNewGroup(recordName,aminoCode1,groupCode3);
  altLocG.setPDBName(groupCode3);
  altLocG.setResidueNumber(current_group.getResidueNumber());
  current_group.addAltLoc(altLocG);
  return altLocG;
}
Program: 16582
Project: 16582
Buggy source:
/** 
 * returns and identical copy of this Group object .
 * @return  and identical copy of this Group object
 */
@Override public Object clone(){
  AminoAcidImpl n=new AminoAcidImpl();
  n.setPDBFlag(has3D());
  n.setResidueNumber(getResidueNumber());
  n.setPDBName(getPDBName());
  n.setAminoType(getAminoType());
  n.setRecordType(recordType);
  for (  Atom atom1 : atoms) {
    Atom atom=(Atom)atom1.clone();
    n.addAtom(atom);
    atom.setGroup(n);
  }
  return n;
}

Fixed version (ground truth):
/** 
 * returns and identical copy of this Group object .
 * @return  and identical copy of this Group object
 */
@Override public Object clone(){
  AminoAcidImpl n=new AminoAcidImpl();
  n.setPDBFlag(has3D());
  n.setResidueNumber(getResidueNumber());
  n.setPDBName(getPDBName());
  n.setAminoType(getAminoType());
  n.setRecordType(recordType);
  for (  Atom atom1 : atoms) {
    Atom atom=(Atom)atom1.clone();
    n.addAtom(atom);
    atom.setGroup(n);
  }
  if (getAltLocs() != null && !getAltLocs().isEmpty()) {
    for (    Group altLocGroup : this.getAltLocs()) {
      Group nAltLocGroup=(Group)altLocGroup.clone();
      n.addAltLoc(nAltLocGroup);
    }
  }
  return n;
}
Program: 16583
Project: 16583
Buggy source:
/** 
 * returns and identical copy of this Group object .
 * @return  and identical copy of this Group object
 */
@Override public Object clone(){
  HetatomImpl n=new HetatomImpl();
  n.setPDBFlag(has3D());
  n.setResidueNumber(residueNumber);
  n.setPDBName(getPDBName());
  for (  Atom atom1 : atoms) {
    Atom atom=(Atom)atom1.clone();
    n.addAtom(atom);
    atom.setGroup(n);
  }
  return n;
}

Fixed version (ground truth):
/** 
 * returns and identical copy of this Group object .
 * @return  and identical copy of this Group object
 */
@Override public Object clone(){
  HetatomImpl n=new HetatomImpl();
  n.setPDBFlag(has3D());
  n.setResidueNumber(residueNumber);
  n.setPDBName(getPDBName());
  for (  Atom atom1 : atoms) {
    Atom atom=(Atom)atom1.clone();
    n.addAtom(atom);
    atom.setGroup(n);
  }
  if (altLocs != null) {
    for (    Group altLocGroup : this.altLocs) {
      Group nAltLocGroup=(Group)altLocGroup.clone();
      n.addAltLoc(nAltLocGroup);
    }
  }
  return n;
}
Program: 16584
Project: 16584
Buggy source:
@Override public Object clone(){
  NucleotideImpl n=new NucleotideImpl();
  n.setPDBFlag(has3D());
  n.setResidueNumber(getResidueNumber());
  n.setPDBName(getPDBName());
  for (  Atom atom1 : atoms) {
    Atom atom=(Atom)atom1.clone();
    n.addAtom(atom);
    atom.setGroup(n);
  }
  return n;
}

Fixed version (ground truth):
@Override public Object clone(){
  NucleotideImpl n=new NucleotideImpl();
  n.setPDBFlag(has3D());
  n.setResidueNumber(getResidueNumber());
  n.setPDBName(getPDBName());
  for (  Atom atom1 : atoms) {
    Atom atom=(Atom)atom1.clone();
    n.addAtom(atom);
    atom.setGroup(n);
  }
  if (getAltLocs() != null && !getAltLocs().isEmpty()) {
    for (    Group altLocGroup : this.getAltLocs()) {
      Group nAltLocGroup=(Group)altLocGroup.clone();
      n.addAltLoc(nAltLocGroup);
    }
  }
  return n;
}
Program: 16585
Project: 16585
Buggy source:
private void compareCloned(Structure s,Structure c) throws StructureException {
  assertEquals(s.getChains().size(),c.getChains().size());
  for (  Chain chain : s.getChains()) {
    Chain test=c.getChainByPDB(chain.getChainID());
    assertEquals("String_Node_Str" + chain.getChainID(),chain.getSeqResLength(),test.getSeqResLength());
    assertEquals("String_Node_Str" + chain.getChainID(),chain.getAtomLength(),test.getAtomLength());
  }
  Atom[] allAtoms=StructureTools.getAllAtomArray(s);
  Atom[] allAtomsCloned=StructureTools.getAllAtomArray(c);
  assertEquals(allAtoms.length,allAtomsCloned.length);
}

Fixed version (ground truth):
private void compareCloned(Structure s,Structure c) throws StructureException {
  assertEquals(s.getChains().size(),c.getChains().size());
  for (  Chain chain : s.getChains()) {
    Chain test=c.getChainByPDB(chain.getChainID());
    assertEquals("String_Node_Str" + chain.getChainID(),chain.getSeqResLength(),test.getSeqResLength());
    assertEquals("String_Node_Str" + chain.getChainID(),chain.getAtomLength(),test.getAtomLength());
    Iterator<Group> it=test.getAtomGroups().iterator();
    for (    Group g : chain.getAtomGroups()) {
      Group testGroup=it.next();
      assertEquals(g.getAltLocs().size(),testGroup.getAltLocs().size());
    }
  }
  Atom[] allAtoms=StructureTools.getAllAtomArray(s);
  Atom[] allAtomsCloned=StructureTools.getAllAtomArray(c);
  assertEquals(allAtoms.length,allAtomsCloned.length);
}
Program: 16586
Project: 16586
Buggy source:
/** 
 * Get the String form of this identifier.
 * @return The String form of this identifier
 */
String getIdentifier();

Fixed version (ground truth):
/** 
 * Get the String form of this identifier. It is recommended that the   {@link #toString()} method also return theidentifier, for consistency during serialization.
 * @return The String form of this identifier
 */
String getIdentifier();
Program: 16587
Project: 16587
Buggy source:
@Override public String toString(){
  StringBuilder s=new StringBuilder();
  s.append(name);
  s.append("String_Node_Str");
  try {
    String id=getPdbId();
    s.append("String_Node_Str");
    s.append(id);
    s.append("String_Node_Str");
  }
 catch (  StructureException e) {
  }
  s.append("String_Node_Str");
  s.append(mySource);
  s.append("String_Node_Str");
  return s.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  return name;
}
Program: 16588
Project: 16588
Buggy source:
@Override public String toString(){
  String resume="String_Node_Str" + parent.getStructureIdentifiers() + "String_Node_Str"+ parent.getAlgorithmName()+ "String_Node_Str"+ parent.getVersion()+ "String_Node_Str"+ getBlockSets().size()+ "String_Node_Str"+ getBlocks().size()+ "String_Node_Str"+ length()+ "String_Node_Str"+ getCoreLength();
  for (  String score : getScores()) {
    resume+="String_Node_Str" + score + "String_Node_Str";
    resume+=String.format("String_Node_Str",getScore(score));
  }
  return resume;
}

Fixed version (ground truth):
@Override public String toString(){
  List<String> ids=new ArrayList<String>(parent.getStructureIdentifiers().size());
  for (  StructureIdentifier i : parent.getStructureIdentifiers()) {
    ids.add(i.getIdentifier());
  }
  String resume="String_Node_Str" + ids + "String_Node_Str"+ parent.getAlgorithmName()+ "String_Node_Str"+ parent.getVersion()+ "String_Node_Str"+ getBlockSets().size()+ "String_Node_Str"+ getBlocks().size()+ "String_Node_Str"+ length()+ "String_Node_Str"+ getCoreLength();
  for (  String score : getScores()) {
    resume+="String_Node_Str" + score + "String_Node_Str";
    resume+=String.format("String_Node_Str",getScore(score));
  }
  return resume;
}
Program: 16589
Project: 16589
Buggy source:
/** 
 * Converts the   {@link MultipleAlignment} into a multiple sequence alignmentString in FASTA format.
 * @param alignment MultipleAlignment
 * @return String multiple sequence alignment in FASTA format
 * @see MultipleAlignmentTools#getSequenceAlignment(MultipleAlignment)
 */
public static String toFASTA(MultipleAlignment alignment){
  List<String> alnSequences=MultipleAlignmentTools.getSequenceAlignment(alignment);
  String fasta="String_Node_Str";
  for (int st=0; st < alignment.size(); st++) {
    fasta+="String_Node_Str" + alignment.getEnsemble().getStructureIdentifiers().get(st) + "String_Node_Str"+ alnSequences.get(st)+ "String_Node_Str";
  }
  return fasta;
}

Fixed version (ground truth):
/** 
 * Converts the   {@link MultipleAlignment} into a multiple sequence alignmentString in FASTA format.
 * @param alignment MultipleAlignment
 * @return String multiple sequence alignment in FASTA format
 * @see MultipleAlignmentTools#getSequenceAlignment(MultipleAlignment)
 */
public static String toFASTA(MultipleAlignment alignment){
  List<String> alnSequences=MultipleAlignmentTools.getSequenceAlignment(alignment);
  String fasta="String_Node_Str";
  for (int st=0; st < alignment.size(); st++) {
    fasta+="String_Node_Str" + alignment.getEnsemble().getStructureIdentifiers().get(st).getIdentifier() + "String_Node_Str"+ alnSequences.get(st)+ "String_Node_Str";
  }
  return fasta;
}
Program: 16592
Project: 16592
Buggy source:
private void calcAlignment(){
  int pos=tabPane.getSelectedIndex();
  StructurePairSelector tab=null;
  if (pos == 0) {
    tab=tab1;
  }
 else   if (pos == 1) {
    tab=tab3;
  }
 else   if (pos == 2) {
    tab=tab2;
  }
  try {
    Structure s=tab.getStructure1();
    if (s == null) {
      System.err.println("String_Node_Str");
      return;
    }
    String name="String_Node_Str";
    if (pos == 0) {
      name=tab1.getName1();
    }
 else {
      name=s.getName();
    }
    System.out.println("String_Node_Str" + name);
    alicalc=new SymmetryCalc(this,s,name);
    thread=new Thread(alicalc);
    thread.start();
    abortB.setEnabled(true);
    progress.setIndeterminate(true);
    ProgressThreadDrawer drawer=new ProgressThreadDrawer(progress);
    drawer.start();
  }
 catch (  StructureException e) {
    JOptionPane.showMessageDialog(null,"String_Node_Str" + e.getMessage());
  }
  updateAlgorithm();
}

Fixed version (ground truth):
private void calcAlignment(){
  int pos=tabPane.getSelectedIndex();
  StructurePairSelector tab=null;
  if (pos == 0) {
    tab=tab1;
  }
 else   if (pos == 1) {
    tab=tab3;
  }
 else   if (pos == 2) {
    tab=tab2;
  }
  try {
    Structure s=tab.getStructure1();
    if (s == null) {
      System.err.println("String_Node_Str");
      return;
    }
    String name="String_Node_Str";
    if (pos == 0) {
      name=tab1.getName1();
    }
 else {
      name=s.getName();
    }
    System.out.println("String_Node_Str" + name);
    alicalc=new SymmetryCalc(this,s,name);
    thread=new Thread(alicalc);
    thread.start();
    abortB.setEnabled(true);
    progress.setIndeterminate(true);
    ProgressThreadDrawer drawer=new ProgressThreadDrawer(progress);
    drawer.start();
  }
 catch (  StructureException e) {
    JOptionPane.showMessageDialog(null,"String_Node_Str" + e.getMessage());
  }
}
Program: 16593
Project: 16593
Buggy source:
private Box setupAlgorithm(){
  String[] algorithms={"String_Node_Str"};
  updateAlgorithm();
  JLabel algoLabel=new JLabel("String_Node_Str");
  JComboBox algorithmList=new JComboBox(algorithms);
  algorithmList.setSelectedIndex(0);
  Action actionAlgorithm=new AbstractAction("String_Node_Str"){
    public static final long serialVersionUID=0l;
    @Override public void actionPerformed(    ActionEvent evt){
      updateAlgorithm();
    }
  }
;
  algorithmList.addActionListener(actionAlgorithm);
  Action paramAction=new AbstractAction("String_Node_Str"){
    public static final long serialVersionUID=0l;
    @Override public void actionPerformed(    ActionEvent evt){
      configureParameters();
    }
  }
;
  JButton parameterButton=new JButton(paramAction);
  Box hBoxAlgo=Box.createHorizontalBox();
  hBoxAlgo.add(Box.createGlue());
  hBoxAlgo.add(algoLabel);
  hBoxAlgo.add(algorithmList);
  hBoxAlgo.add(Box.createGlue());
  hBoxAlgo.add(parameterButton);
  hBoxAlgo.add(Box.createGlue());
  return hBoxAlgo;
}

Fixed version (ground truth):
private Box setupAlgorithm(){
  String[] algorithms={"String_Node_Str"};
  JLabel algoLabel=new JLabel("String_Node_Str");
  JComboBox algorithmList=new JComboBox(algorithms);
  algorithmList.setSelectedIndex(0);
  Action paramAction=new AbstractAction("String_Node_Str"){
    public static final long serialVersionUID=0l;
    @Override public void actionPerformed(    ActionEvent evt){
      configureParameters();
    }
  }
;
  JButton parameterButton=new JButton(paramAction);
  Box hBoxAlgo=Box.createHorizontalBox();
  hBoxAlgo.add(Box.createGlue());
  hBoxAlgo.add(algoLabel);
  hBoxAlgo.add(algorithmList);
  hBoxAlgo.add(Box.createGlue());
  hBoxAlgo.add(parameterButton);
  hBoxAlgo.add(Box.createGlue());
  return hBoxAlgo;
}
Program: 16594
Project: 16594
Buggy source:
public MultipleAlignment analyze(Atom[] atoms,CESymmParameters param) throws StructureException {
  if (atoms.length < 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.params=param;
  AFPChain selfAFP=null;
  if (params.isMultipleAxes() && params.getRefineMethod() != RefineMethod.NOT_REFINED) {
    logger.info("String_Node_Str");
    CeSymmIterative iterative=new CeSymmIterative(params.clone());
    msa=iterative.execute(atoms);
    axes=iterative.getSymmetryAxes();
    if (SymmetryTools.isRefined(msa)) {
      refined=true;
    }
 else {
      selfAFP=align(atoms);
      msa=null;
    }
  }
 else {
    selfAFP=align(atoms);
  }
  if (refined) {
    if (msa == null)     msa=SymmetryTools.fromAFP(selfAFP,atoms);
    CoreSuperimposer imposer=new CoreSuperimposer();
    imposer.superimpose(msa);
    MultipleAlignmentScorer.calculateScores(msa);
    msa.putScore("String_Node_Str",1.0);
    if (this.params.getOptimization()) {
      try {
        SymmOptimizer optimizer=new SymmOptimizer(msa,axes,params,params.getSeed());
        msa=optimizer.optimize();
        msa.putScore("String_Node_Str",1.0);
      }
 catch (      RefinerFailedException e) {
        logger.info("String_Node_Str" + e.getMessage());
      }
    }
  }
 else {
    MultipleAlignmentEnsemble e=new MultipleAlignmentEnsembleImpl(selfAFP,atoms,atoms,false);
    msa=e.getMultipleAlignment(0);
    logger.info("String_Node_Str");
    msa.putScore("String_Node_Str",0.0);
  }
  return msa;
}

Fixed version (ground truth):
public MultipleAlignment analyze(Atom[] atoms,CESymmParameters param) throws StructureException {
  reset();
  if (atoms.length < 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.params=param;
  AFPChain selfAFP=null;
  if (params.isMultipleAxes() && params.getRefineMethod() != RefineMethod.NOT_REFINED) {
    logger.info("String_Node_Str");
    CeSymmIterative iterative=new CeSymmIterative(params.clone());
    msa=iterative.execute(atoms);
    axes=iterative.getSymmetryAxes();
    if (SymmetryTools.isRefined(msa)) {
      refined=true;
    }
 else {
      selfAFP=align(atoms);
      msa=null;
    }
  }
 else {
    selfAFP=align(atoms);
  }
  if (refined) {
    if (msa == null)     msa=SymmetryTools.fromAFP(selfAFP,atoms);
    CoreSuperimposer imposer=new CoreSuperimposer();
    imposer.superimpose(msa);
    MultipleAlignmentScorer.calculateScores(msa);
    msa.putScore("String_Node_Str",1.0);
    if (this.params.getOptimization()) {
      try {
        SymmOptimizer optimizer=new SymmOptimizer(msa,axes,params,params.getSeed());
        msa=optimizer.optimize();
        msa.putScore("String_Node_Str",1.0);
      }
 catch (      RefinerFailedException e) {
        logger.info("String_Node_Str" + e.getMessage());
      }
    }
  }
 else {
    MultipleAlignmentEnsemble e=new MultipleAlignmentEnsembleImpl(selfAFP,atoms,atoms,false);
    msa=e.getMultipleAlignment(0);
    logger.info("String_Node_Str");
    msa.putScore("String_Node_Str",0.0);
  }
  return msa;
}
Program: 16595
Project: 16595
Buggy source:
public CeSymm(){
  super();
  params=new CESymmParameters();
  refined=false;
}

Fixed version (ground truth):
public CeSymm(){
  reset();
}
Program: 16596
Project: 16596
Buggy source:
public boolean isSignificant() throws StructureException {
  double symmetryThreshold=this.params.getSymmetryThreshold();
  return isSignificant(this.msa,symmetryThreshold);
}

Fixed version (ground truth):
public boolean isSignificant() throws StructureException {
  double symmetryThreshold=params.getSymmetryThreshold();
  return SymmetryTools.isSignificant(msa,symmetryThreshold);
}
Program: 16598
Project: 16598
Buggy source:
public MultipleAlignment analyze(Atom[] atoms,CESymmParameters param) throws StructureException {
  if (atoms.length < 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.params=param;
  if (params.isMultipleAxes() && params.getRefineMethod() != RefineMethod.NOT_REFINED) {
    logger.info("String_Node_Str");
    CeSymmIterative iterative=new CeSymmIterative(params.clone());
    msa=iterative.execute(atoms);
    axes=iterative.getSymmetryAxes();
    if (SymmetryTools.isRefined(msa)) {
      refined=true;
    }
 else {
      afpChain=align(atoms,atoms,params);
      msa=null;
    }
  }
 else {
    afpChain=align(atoms,atoms,params);
  }
  if (refined) {
    if (msa == null)     msa=SymmetryTools.fromAFP(afpChain,ca1);
    CoreSuperimposer imposer=new CoreSuperimposer();
    imposer.superimpose(msa);
    MultipleAlignmentScorer.calculateScores(msa);
    msa.putScore("String_Node_Str",1.0);
    if (this.params.getOptimization()) {
      try {
        SymmOptimizer optimizer=new SymmOptimizer(msa,axes,params,params.getSeed());
        msa=optimizer.optimize();
        msa.putScore("String_Node_Str",1.0);
      }
 catch (      RefinerFailedException e) {
        logger.info("String_Node_Str" + e.getMessage());
      }
    }
  }
 else {
    MultipleAlignmentEnsemble e=new MultipleAlignmentEnsembleImpl(afpChain,ca1,ca1,false);
    msa=e.getMultipleAlignment(0);
    logger.info("String_Node_Str");
    msa.putScore("String_Node_Str",0.0);
  }
  return msa;
}

Fixed version (ground truth):
public MultipleAlignment analyze(Atom[] atoms,CESymmParameters param) throws StructureException {
  if (atoms.length < 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.params=param;
  AFPChain selfAFP=null;
  if (params.isMultipleAxes() && params.getRefineMethod() != RefineMethod.NOT_REFINED) {
    logger.info("String_Node_Str");
    CeSymmIterative iterative=new CeSymmIterative(params.clone());
    msa=iterative.execute(atoms);
    axes=iterative.getSymmetryAxes();
    if (SymmetryTools.isRefined(msa)) {
      refined=true;
    }
 else {
      selfAFP=align(atoms);
      msa=null;
    }
  }
 else {
    selfAFP=align(atoms);
  }
  if (refined) {
    if (msa == null)     msa=SymmetryTools.fromAFP(selfAFP,atoms);
    CoreSuperimposer imposer=new CoreSuperimposer();
    imposer.superimpose(msa);
    MultipleAlignmentScorer.calculateScores(msa);
    msa.putScore("String_Node_Str",1.0);
    if (this.params.getOptimization()) {
      try {
        SymmOptimizer optimizer=new SymmOptimizer(msa,axes,params,params.getSeed());
        msa=optimizer.optimize();
        msa.putScore("String_Node_Str",1.0);
      }
 catch (      RefinerFailedException e) {
        logger.info("String_Node_Str" + e.getMessage());
      }
    }
  }
 else {
    MultipleAlignmentEnsemble e=new MultipleAlignmentEnsembleImpl(selfAFP,atoms,atoms,false);
    msa=e.getMultipleAlignment(0);
    logger.info("String_Node_Str");
    msa.putScore("String_Node_Str",0.0);
  }
  return msa;
}
Program: 16599
Project: 16599
Buggy source:
public void process() throws Exception {
  if (matrix == null) {
    double[][] distances=calculateDistanceMatrix(multipleSequenceAlignment,treeConstructionAlgorithm);
    matrix=new BasicSymmetricalDistanceMatrix(multipleSequenceAlignment.getSize());
    for (int i=0; i < matrix.getSize(); i++) {
      matrix.setIdentifier(i,multipleSequenceAlignment.getAlignedSequence(i).getAccession().getID());
    }
    for (int col=0; col < matrix.getSize(); col++) {
      for (int row=0; row < matrix.getSize(); row++) {
        matrix.setValue(col,row,distances[col][row]);
      }
    }
    copyDistanceMatrix=CheckTreeAccuracy.copyMatrix(matrix);
  }
  final List<Phylogeny> ps=new ArrayList<Phylogeny>();
  final NeighborJoining nj=NeighborJoining.createInstance(verbose);
  ps.add(nj.execute(matrix));
  p=ps.get(0);
}

Fixed version (ground truth):
public void process() throws Exception {
  if (matrix == null) {
    double[][] distances=calculateDistanceMatrix(multipleSequenceAlignment,treeConstructionAlgorithm);
    matrix=new BasicSymmetricalDistanceMatrix(multipleSequenceAlignment.getSize());
    for (int i=0; i < matrix.getSize(); i++) {
      matrix.setIdentifier(i,multipleSequenceAlignment.getAlignedSequence(i + 1).getAccession().getID());
    }
    for (int col=0; col < matrix.getSize(); col++) {
      for (int row=0; row < matrix.getSize(); row++) {
        matrix.setValue(col,row,distances[col][row]);
      }
    }
    copyDistanceMatrix=CheckTreeAccuracy.copyMatrix(matrix);
  }
  final List<Phylogeny> ps=new ArrayList<Phylogeny>();
  final NeighborJoining nj=NeighborJoining.createInstance(verbose);
  ps.add(nj.execute(matrix));
  p=ps.get(0);
}
Program: 16601
Project: 16601
Buggy source:
public static void main(String[] args) throws Exception {
  InputStream inStream=TreeConstructor.class.getResourceAsStream("String_Node_Str");
  FastaReader<ProteinSequence,AminoAcidCompound> fastaReader=new FastaReader<ProteinSequence,AminoAcidCompound>(inStream,new GenericFastaHeaderParser<ProteinSequence,AminoAcidCompound>(),new ProteinSequenceCreator(AminoAcidCompoundSet.getAminoAcidCompoundSet()));
  LinkedHashMap<String,ProteinSequence> proteinSequences=fastaReader.process();
  inStream.close();
  MultipleSequenceAlignment<ProteinSequence,AminoAcidCompound> msa=new MultipleSequenceAlignment<ProteinSequence,AminoAcidCompound>();
  for (  ProteinSequence proteinSequence : proteinSequences.values()) {
    msa.addAlignedSequence(proteinSequence);
  }
  long readT=System.currentTimeMillis();
  DistanceMatrix DM=DistanceMatrixCalculator.kimuraDistance(msa);
  Phylogeny phylo=TreeConstructor.distanceTree((BasicSymmetricalDistanceMatrix)DM,TreeConstructorType.NJ);
  long treeT=System.currentTimeMillis();
  String newick=ForesterWrapper.getNewickString(phylo,true,true);
  System.out.println(newick);
  System.out.println("String_Node_Str" + (treeT - readT) + "String_Node_Str");
  double cv=DistanceTreeEvaluator.evaluate(phylo,DM);
  System.out.println("String_Node_Str" + (int)(cv * 100) + "String_Node_Str");
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  InputStream inStream=TreeConstructor.class.getResourceAsStream("String_Node_Str");
  FastaReader<ProteinSequence,AminoAcidCompound> fastaReader=new FastaReader<ProteinSequence,AminoAcidCompound>(inStream,new GenericFastaHeaderParser<ProteinSequence,AminoAcidCompound>(),new ProteinSequenceCreator(AminoAcidCompoundSet.getAminoAcidCompoundSet()));
  LinkedHashMap<String,ProteinSequence> proteinSequences=fastaReader.process();
  inStream.close();
  MultipleSequenceAlignment<ProteinSequence,AminoAcidCompound> msa=new MultipleSequenceAlignment<ProteinSequence,AminoAcidCompound>();
  for (  ProteinSequence proteinSequence : proteinSequences.values()) {
    msa.addAlignedSequence(proteinSequence);
  }
  long readT=System.currentTimeMillis();
  SubstitutionMatrix<AminoAcidCompound> M=SubstitutionMatrixHelper.getBlosum62();
  DistanceMatrix DM=DistanceMatrixCalculator.fractionalDissimilarityScore(msa,M);
  Phylogeny phylo=TreeConstructor.distanceTree((BasicSymmetricalDistanceMatrix)DM,TreeConstructorType.NJ);
  long treeT=System.currentTimeMillis();
  String newick=ForesterWrapper.getNewickString(phylo,true,true);
  System.out.println(newick);
  System.out.println("String_Node_Str" + (treeT - readT) + "String_Node_Str");
  double cv=DistanceTreeEvaluator.evaluate(phylo,DM);
  System.out.println("String_Node_Str" + (int)(cv * 100) + "String_Node_Str");
}
Program: 16607
Project: 16607
Buggy source:
/** 
 * Detect helical turn patterns.
 */
private void calculateTurns(){
  for (int i=0; i < groups.length; i++) {
    for (int turn=3; turn <= 5; turn++) {
      if (i + turn >= groups.length)       continue;
      if (isBonded(i + turn,i)) {
        logger.debug("String_Node_Str" + (i + turn) + i);
        for (int j=i; j < i + turn + 1; j++) {
          logger.debug("String_Node_Str" + i + "String_Node_Str"+ j+ "String_Node_Str"+ turn);
          SecStrucGroup group=groups[j];
          SecStrucState state=(SecStrucState)group.getProperty(Group.SEC_STRUC);
          boolean[] turns=state.getTurn();
          turns[turn - 3]=true;
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Detect helical turn patterns.
 */
private void calculateTurns(){
  for (int i=0; i < groups.length; i++) {
    for (int turn=3; turn <= 5; turn++) {
      if (i + turn >= groups.length)       continue;
      if (isBonded(i + turn,i)) {
        logger.debug("String_Node_Str" + (i + turn) + i);
        for (int j=i; j < i + turn + 1; j++) {
          logger.debug("String_Node_Str" + i + "String_Node_Str"+ j+ "String_Node_Str"+ turn);
          SecStrucState state=getSecStrucState(j);
          boolean[] turns=state.getTurn();
          turns[turn - 3]=true;
        }
      }
    }
  }
}
Program: 16608
Project: 16608
Buggy source:
private void checkSetTurns(){
  for (int i=0; i < groups.length - 3; i++) {
    Group g=groups[i];
    SecStrucState state=(SecStrucState)g.getProperty(Group.SEC_STRUC);
    SecStrucType type=state.getType();
    if (type.isHelixType())     continue;
    boolean[] turns=state.getTurn();
    for (int t=0; t < 3; t++) {
      if (turns[t]) {
        for (int l=i + 1; l < i + t + 3; l++) {
          logger.debug("String_Node_Str" + i + "String_Node_Str"+ type);
          if (l >= groups.length)           break;
          SecStrucType typel=getSecStrucType(l);
          if (typel.equals(SecStrucType.coil))           setSecStrucType(l,SecStrucType.turn);
        }
      }
    }
  }
}

Fixed version (ground truth):
private void checkSetTurns(){
  for (int i=0; i < groups.length - 3; i++) {
    SecStrucState state=getSecStrucState(i);
    SecStrucType type=state.getType();
    if (type.isHelixType())     continue;
    boolean[] turns=state.getTurn();
    for (int t=0; t < 3; t++) {
      if (turns[t]) {
        for (int l=i + 1; l < i + t + 3; l++) {
          logger.debug("String_Node_Str" + i + "String_Node_Str"+ type);
          if (l >= groups.length)           break;
          SecStrucType typel=getSecStrucType(l);
          if (typel.equals(SecStrucType.coil))           setSecStrucType(l,SecStrucType.turn);
        }
      }
    }
  }
}
Program: 16609
Project: 16609
Buggy source:
/** 
 * Test if two groups are forming an H-Bond. DSSP defines H-Bonds if the energy < -500 cal/mol
 * @param one group one
 * @param two group two
 * @return flag if the two are forming an Hbond
 */
private boolean isBonded(int i,int j){
  Group one=groups[i];
  SecStrucState stateOne=(SecStrucState)one.getProperty(Group.SEC_STRUC);
  double acc1e=stateOne.getAccept1().getEnergy();
  double acc2e=stateOne.getAccept2().getEnergy();
  int partnerAcc1=stateOne.getAccept1().getPartner();
  int partnerAcc2=stateOne.getAccept2().getPartner();
  if (((partnerAcc1 == j) && (acc1e < HBONDHIGHENERGY)) || ((partnerAcc2 == j) && (acc2e < HBONDHIGHENERGY))) {
    logger.debug("String_Node_Str" + i + "String_Node_Str"+ j);
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Test if two groups are forming an H-Bond. DSSP defines H-Bonds if the energy < -500 cal/mol
 * @param one group one
 * @param two group two
 * @return flag if the two are forming an Hbond
 */
private boolean isBonded(int i,int j){
  SecStrucState stateOne=getSecStrucState(i);
  double acc1e=stateOne.getAccept1().getEnergy();
  double acc2e=stateOne.getAccept2().getEnergy();
  int partnerAcc1=stateOne.getAccept1().getPartner();
  int partnerAcc2=stateOne.getAccept2().getPartner();
  if (((partnerAcc1 == j) && (acc1e < HBONDHIGHENERGY)) || ((partnerAcc2 == j) && (acc2e < HBONDHIGHENERGY))) {
    logger.debug("String_Node_Str" + i + "String_Node_Str"+ j);
    return true;
  }
  return false;
}
Program: 16610
Project: 16610
Buggy source:
private void setSecStrucType(int pos,SecStrucType type){
  Group g=groups[pos];
  SecStrucState s=(SecStrucState)g.getProperty(Group.SEC_STRUC);
  s.setType(type);
}

Fixed version (ground truth):
private void setSecStrucType(int pos,SecStrucType type){
  SecStrucState s=getSecStrucState(pos);
  s.setType(type);
}
Program: 16611
Project: 16611
Buggy source:
private void checkSetHelix(int prange,SecStrucType type){
  int range=prange - 3;
  logger.debug("String_Node_Str" + type + "String_Node_Str"+ prange+ "String_Node_Str"+ range);
  for (int i=1; i < groups.length - range - 1; i++) {
    Group g=groups[i];
    SecStrucState state=(SecStrucState)g.getProperty(Group.SEC_STRUC);
    Group prevG=groups[i - 1];
    SecStrucState prevState=(SecStrucState)prevG.getProperty(Group.SEC_STRUC);
    Group nextG=groups[i + 1];
    SecStrucState nextState=(SecStrucState)nextG.getProperty(Group.SEC_STRUC);
    boolean[] turns=state.getTurn();
    boolean[] pturns=prevState.getTurn();
    boolean[] nturns=nextState.getTurn();
    if (turns[range] && pturns[range] && nturns[range]) {
      boolean empty=true;
      for (int curr=i; curr <= i + range; curr++) {
        logger.debug("String_Node_Str" + i + "String_Node_Str"+ prange+ "String_Node_Str"+ range);
        SecStrucType cstate=getSecStrucType(curr);
        if (cstate.isHelixType()) {
          empty=false;
          break;
        }
      }
      if (empty) {
        for (int curr=i; curr <= i + range; curr++) {
          setSecStrucType(curr,type);
        }
      }
    }
  }
}

Fixed version (ground truth):
private void checkSetHelix(int prange,SecStrucType type){
  int range=prange - 3;
  logger.debug("String_Node_Str" + type + "String_Node_Str"+ prange+ "String_Node_Str"+ range);
  for (int i=1; i < groups.length - range - 1; i++) {
    SecStrucState state=getSecStrucState(i);
    SecStrucState prevState=getSecStrucState(i - 1);
    SecStrucState nextState=getSecStrucState(i + 1);
    boolean[] turns=state.getTurn();
    boolean[] pturns=prevState.getTurn();
    boolean[] nturns=nextState.getTurn();
    if (turns[range] && pturns[range] && nturns[range]) {
      boolean empty=true;
      for (int curr=i; curr <= i + range; curr++) {
        logger.debug("String_Node_Str" + i + "String_Node_Str"+ prange+ "String_Node_Str"+ range);
        SecStrucType cstate=getSecStrucType(curr);
        if (cstate.isHelixType()) {
          empty=false;
          break;
        }
      }
      if (empty) {
        for (int curr=i; curr <= i + range; curr++) {
          setSecStrucType(curr,type);
        }
      }
    }
  }
}