nus-yam/ex-repair huggingface dataset:
Program: 16710
Project: 16710
Buggy source:
/** 
 * This is to test the issue discussed here: http://www.globalphasing.com/startools/ Essentially single quote characters (') are valid not only for quoting, but also as parts of data values as long as some rules of the STAR format are followed. For instance Phenix produces mmCIF files with non-quoted strings containing single quote characters 
 * @throws IOException
 */
public void testQuotingCornerCase() throws IOException {
  InputStream inStream=this.getClass().getResourceAsStream("String_Node_Str");
  MMcifParser parser=new SimpleMMcifParser();
  SimpleMMcifConsumer consumer=new SimpleMMcifConsumer();
  FileParsingParameters fileParsingParams=new FileParsingParameters();
  fileParsingParams.setAlignSeqRes(true);
  consumer.setFileParsingParameters(fileParsingParams);
  parser.addMMcifConsumer(consumer);
  parser.parse(new BufferedReader(new InputStreamReader(inStream)));
  Structure s=consumer.getStructure();
  assertNotNull(s);
}

Fixed version (ground truth):
/** 
 * This is to test the issue discussed here: http://www.globalphasing.com/startools/ Essentially single quote characters (') are valid not only for quoting, but also as parts of data values as long as some rules of the STAR format are followed. For instance Phenix produces mmCIF files with non-quoted strings containing single quote characters 
 * @throws IOException
 */
@Test public void testQuotingCornerCase() throws IOException {
  InputStream inStream=this.getClass().getResourceAsStream("String_Node_Str");
  MMcifParser parser=new SimpleMMcifParser();
  SimpleMMcifConsumer consumer=new SimpleMMcifConsumer();
  FileParsingParameters fileParsingParams=new FileParsingParameters();
  fileParsingParams.setAlignSeqRes(true);
  consumer.setFileParsingParameters(fileParsingParams);
  parser.addMMcifConsumer(consumer);
  parser.parse(new BufferedReader(new InputStreamReader(inStream)));
  Structure s=consumer.getStructure();
  assertNotNull(s);
}
Program: 16711
Project: 16711
Buggy source:
/** 
 * A test for reading a phenix-produced (ver 1.9_1692) mmCIF file. This is the file submitted to the PDB for deposition of entry 4lup
 * @throws IOException
 */
@Ignore @Test public void testPhenixFile() throws IOException {
  InputStream inStream=new GZIPInputStream(this.getClass().getResourceAsStream("String_Node_Str"));
  MMcifParser parser=new SimpleMMcifParser();
  SimpleMMcifConsumer consumer=new SimpleMMcifConsumer();
  FileParsingParameters fileParsingParams=new FileParsingParameters();
  fileParsingParams.setAlignSeqRes(true);
  consumer.setFileParsingParameters(fileParsingParams);
  parser.addMMcifConsumer(consumer);
  parser.parse(new BufferedReader(new InputStreamReader(inStream)));
  Structure s=consumer.getStructure();
  assertNotNull(s);
  assertTrue(s.isCrystallographic());
}

Fixed version (ground truth):
/** 
 * A test for reading a phenix-produced (ver 1.9_1692) mmCIF file. This is the file submitted to the PDB for deposition of entry 4lup See github issue #234
 * @throws IOException
 */
public void testPhenixFile() throws IOException {
  InputStream inStream=new GZIPInputStream(this.getClass().getResourceAsStream("String_Node_Str"));
  MMcifParser parser=new SimpleMMcifParser();
  SimpleMMcifConsumer consumer=new SimpleMMcifConsumer();
  FileParsingParameters fileParsingParams=new FileParsingParameters();
  fileParsingParams.setAlignSeqRes(true);
  consumer.setFileParsingParameters(fileParsingParams);
  parser.addMMcifConsumer(consumer);
  parser.parse(new BufferedReader(new InputStreamReader(inStream)));
  Structure s=consumer.getStructure();
  assertNotNull(s);
  assertTrue(s.isCrystallographic());
}
Program: 16712
Project: 16712
Buggy source:
private static void printJmolScript4Block(Atom[] atoms,List<List<Integer>> alignRes,Color[] colors,StringWriter jmol,int str,int colorPos,int blockNum){
  Color start=ColorUtils.lighter(colors[str % colors.length],1);
  double fraction=(colorPos * 1.0) / blockNum;
  Color color=ColorUtils.darker(start,fraction);
  List<String> pdb=new ArrayList<String>();
  for (int i=0; i < alignRes.get(str).size(); i++) {
    if (alignRes.get(str).get(i) != null) {
      int pos=alignRes.get(str).get(i);
      pdb.add(JmolTools.getPdbInfo(atoms[pos]));
    }
  }
  StringBuffer buf=new StringBuffer("String_Node_Str");
  int count=0;
  for (  String res : pdb) {
    if (count > 0)     buf.append("String_Node_Str");
    buf.append(res);
    buf.append("String_Node_Str" + (str + 1));
    count++;
  }
  buf.append("String_Node_Str" + color.getRed() + "String_Node_Str"+ color.getGreen()+ "String_Node_Str"+ color.getBlue()+ "String_Node_Str");
  jmol.append(buf);
}

Fixed version (ground truth):
private static void printJmolScript4Block(Atom[] atoms,List<List<Integer>> alignRes,Color[] colors,StringWriter jmol,int str,int colorPos,int blockNum){
  Color start=colors[str % colors.length];
  double fraction=(colorPos * 1.0) / (blockNum + 1.0);
  Color color=ColorUtils.darker(start,fraction);
  List<String> pdb=new ArrayList<String>();
  for (int i=0; i < alignRes.get(str).size(); i++) {
    if (alignRes.get(str).get(i) != null) {
      int pos=alignRes.get(str).get(i);
      pdb.add(JmolTools.getPdbInfo(atoms[pos]));
    }
  }
  StringBuffer buf=new StringBuffer("String_Node_Str");
  int count=0;
  for (  String res : pdb) {
    if (count > 0)     buf.append("String_Node_Str");
    buf.append(res);
    buf.append("String_Node_Str" + (str + 1));
    count++;
  }
  buf.append("String_Node_Str" + color.getRed() + "String_Node_Str"+ color.getGreen()+ "String_Node_Str"+ color.getBlue()+ "String_Node_Str");
  jmol.append(buf);
}
Program: 16713
Project: 16713
Buggy source:
public void resetDisplay() throws StructureAlignmentException {
  if (multAln != null) {
    String script=getJmolString(multAln,atomArrays,colors);
    System.out.println(script);
    evalString(script);
    jmolPanel.evalString("String_Node_Str");
    jmolPanel.evalString("String_Node_Str");
  }
}

Fixed version (ground truth):
public void resetDisplay() throws StructureAlignmentException {
  if (multAln != null) {
    String script=getJmolString(multAln,atomArrays,colors);
    evalString(script);
    jmolPanel.evalString("String_Node_Str");
    jmolPanel.evalString("String_Node_Str");
  }
}
Program: 16715
Project: 16715
Buggy source:
/** 
 * Copy constructor.
 * @param bs BlockSetImpl object to be copied.
 * @return BlockSetImpl an identical copy of the input BlockSetImpl object.
 */
public BlockSetImpl(BlockSetImpl bs){
  this.parent=bs.parent;
  this.pose=(Pose)bs.pose.clone();
  this.length=bs.length;
  this.coreLength=bs.coreLength;
  List<Block> blocks=new ArrayList<Block>();
  for (  Block b : bs.blocks) {
    blocks.add((Block)b.clone());
  }
  this.blocks=blocks;
}

Fixed version (ground truth):
/** 
 * Copy constructor.
 * @param bs BlockSetImpl object to be copied.
 * @return BlockSetImpl an identical copy of the input BlockSetImpl object.
 */
public BlockSetImpl(BlockSetImpl bs){
  this.parent=bs.parent;
  this.length=bs.length;
  this.coreLength=bs.coreLength;
  this.pose=null;
  pose=null;
  List<Block> blocks=new ArrayList<Block>();
  for (  Block b : bs.blocks) {
    Block newBK=(Block)b.clone();
    newBK.setBlockSet(this);
  }
  this.blocks=blocks;
}
Program: 16716
Project: 16716
Buggy source:
/** 
 * Copy constructor.
 * @param e MultipleAlignmentEnsembleImpl to copy.
 * @return MultipleAlignmentEnsembleImpl identical copy of the input MultipleAlignmentEnsembleImpl.
 */
public MultipleAlignmentEnsembleImpl(MultipleAlignmentEnsembleImpl e){
  algorithmName=e.algorithmName;
  version=e.version;
  ioTime=e.ioTime;
  id=e.id;
  calculationTime=e.calculationTime;
  atomArrays=null;
  if (e.atomArrays != null) {
    atomArrays=new ArrayList<Atom[]>();
    for (    Atom[] array : e.atomArrays) {
      Atom[] newArray=new Atom[array.length];
      for (int i=0; i < array.length; i++) {
        newArray[i]=(Atom)array[i].clone();
      }
      atomArrays.add(newArray);
    }
  }
  distanceMatrix=null;
  if (e.distanceMatrix != null) {
    distanceMatrix=new ArrayList<Matrix>();
    for (    Matrix mat : e.distanceMatrix) {
      distanceMatrix.add((Matrix)mat.clone());
    }
  }
  multipleAlignments=null;
  if (e.multipleAlignments != null) {
    multipleAlignments=new ArrayList<MultipleAlignment>();
    for (    MultipleAlignment msa : e.multipleAlignments) {
      multipleAlignments.add((MultipleAlignment)msa.clone());
    }
  }
  structureNames=new ArrayList<String>(e.structureNames);
}

Fixed version (ground truth):
/** 
 * Copy constructor.
 * @param e MultipleAlignmentEnsembleImpl to copy.
 * @return MultipleAlignmentEnsembleImpl identical copy of the input MultipleAlignmentEnsembleImpl.
 */
public MultipleAlignmentEnsembleImpl(MultipleAlignmentEnsembleImpl e){
  algorithmName=e.algorithmName;
  version=e.version;
  ioTime=e.ioTime;
  id=e.id;
  calculationTime=e.calculationTime;
  atomArrays=null;
  if (e.atomArrays != null) {
    atomArrays=new ArrayList<Atom[]>();
    for (    Atom[] array : e.atomArrays) {
      Atom[] newArray=new Atom[array.length];
      for (int i=0; i < array.length; i++) {
        newArray[i]=(Atom)array[i].clone();
      }
      atomArrays.add(newArray);
    }
  }
  distanceMatrix=null;
  if (e.distanceMatrix != null) {
    distanceMatrix=new ArrayList<Matrix>();
    for (    Matrix mat : e.distanceMatrix) {
      distanceMatrix.add((Matrix)mat.clone());
    }
  }
  multipleAlignments=null;
  if (e.multipleAlignments != null) {
    multipleAlignments=new ArrayList<MultipleAlignment>();
    for (    MultipleAlignment msa : e.multipleAlignments) {
      MultipleAlignment newMSA=(MultipleAlignment)msa.clone();
      newMSA.setParent(this);
    }
  }
  structureNames=new ArrayList<String>(e.structureNames);
}
Program: 16717
Project: 16717
Buggy source:
/** 
 * Copy constructor.
 * @param ma MultipleAlignmentImpl to copy.
 * @return MultipleAlignmentImpl identical copy of the input MultipleAlignmentImpl.
 */
public MultipleAlignmentImpl(MultipleAlignmentImpl ma){
  parent=ma.parent;
  alnSequences=new ArrayList<String>(ma.getAlnSequences());
  blockSets=null;
  if (ma.blockSets != null) {
    this.blockSets=new ArrayList<BlockSet>();
    for (    BlockSet bs : ma.blockSets) {
      blockSets.add((BlockSet)bs.clone());
    }
  }
  algScore=ma.getAlgScore();
  probability=ma.getProbability();
}

Fixed version (ground truth):
/** 
 * Copy constructor.
 * @param ma MultipleAlignmentImpl to copy.
 * @return MultipleAlignmentImpl identical copy of the input MultipleAlignmentImpl.
 */
public MultipleAlignmentImpl(MultipleAlignmentImpl ma){
  parent=ma.parent;
  alnSequences=new ArrayList<String>(ma.getAlnSequences());
  pose=null;
  blockSets=null;
  if (ma.blockSets != null) {
    this.blockSets=new ArrayList<BlockSet>();
    for (    BlockSet bs : ma.blockSets) {
      BlockSet newBS=(BlockSet)bs.clone();
      newBS.setMultipleAlignment(this);
    }
  }
  algScore=ma.getAlgScore();
  probability=ma.getProbability();
}
Program: 16719
Project: 16719
Buggy source:
/** 
 * Initialize variables
 * @param rotation
 * @param translation
 */
private void init(Matrix rotation,Atom translation){
  if (rotation.getColumnDimension() != 3 || rotation.getRowDimension() != 3) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  double c=(rotation.trace() - 1) / 2.0;
  this.theta=Math.acos(c);
  if (theta < MIN_ANGLE) {
    calculateTranslationalAxis(rotation,translation);
  }
 else {
    calculateRotationalAxis(rotation,translation,c);
  }
}

Fixed version (ground truth):
/** 
 * Initialize variables
 * @param rotation
 * @param translation
 */
private void init(Matrix rotation,Atom translation){
  if (rotation.getColumnDimension() != 3 || rotation.getRowDimension() != 3) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  double c=(rotation.trace() - 1) / 2.0;
  if (-1 - 1e-8 < c && c < -1)   c=-1;
  if (1 + 1e-8 > c && c > 1)   c=1;
  if (-1 > c || c > 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.theta=Math.acos(c);
  if (theta < MIN_ANGLE) {
    calculateTranslationalAxis(rotation,translation);
  }
 else {
    calculateRotationalAxis(rotation,translation,c);
  }
}
Program: 16720
Project: 16720
Buggy source:
@Override public void actionPerformed(ActionEvent arg0){
  System.out.println("String_Node_Str");
  if (parent == null) {
    System.err.println("String_Node_Str");
    return;
  }
  showMatrix(parent.getDisTable1(),"String_Node_Str");
  showMatrix(parent.getDisTable2(),"String_Node_Str");
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent arg0){
  System.out.println("String_Node_Str");
  if (parent == null) {
    System.err.println("String_Node_Str");
    return;
  }
  if (parent.getDisTable1() != null)   showMatrix(parent.getDisTable1(),"String_Node_Str");
  if (parent.getDisTable2() != null)   showMatrix(parent.getDisTable2(),"String_Node_Str");
}
Program: 16721
Project: 16721
Buggy source:
/** 
 * Helper method. Calculates and sets the global and individual RMSD and TMscore of the alignment. Needs the updated background distances matrices, since it assumes all distances to be already calculated.
 * @throws StructureAlignmentException
 * @throws StructureException
 */
private void updateRMSDandScore() throws StructureAlignmentException, StructureException {
  int size=size();
  listRMSD=new ArrayList<Double>();
  listTMscore=new ArrayList<Double>();
  for (int s1=0; s1 < size; s1++) {
    int lenRMSD=0;
    int lenScore=0;
    double sumRMSD=0.0;
    double sumScore=0.0;
    for (int s2=0; s2 < size; s2++) {
      int Lmin=Math.min(getAtomArrays().get(s1).length,getAtomArrays().get(s2).length);
      double d0=1.24 * Math.cbrt(Lmin - 15.) - 1.8;
      double d0sq=d0 * d0;
      lenScore+=Lmin;
      for (int k=0; k < getBlocks().size(); k++) {
        for (int j=0; j < getBlocks().get(k).length(); j++) {
          Integer pos1=getBlocks().get(k).getAlignRes().get(s1).get(j);
          Integer pos2=getBlocks().get(k).getAlignRes().get(s2).get(j);
          if (pos1 == null || pos2 == null)           continue;
          double d=backDistMatrix.get(s1).get(s2).get(pos1,pos2);
          sumRMSD+=(d * d);
          sumScore+=1. / (1 + d * d / d0sq);
          lenRMSD++;
        }
      }
    }
    listRMSD.add(Math.sqrt(sumRMSD / lenRMSD));
    listTMscore.add(sumScore / lenScore);
  }
  for (int i=0; i < size; i++) {
    rmsd=listRMSD.get(i);
    tmScore=listTMscore.get(i);
  }
  rmsd/=size;
  tmScore/=size;
}

Fixed version (ground truth):
/** 
 * Helper method. Calculates and sets the global and individual RMSD and TMscore of the alignment. Needs the updated background distances matrices, since it assumes all distances to be already calculated.
 * @throws StructureAlignmentException
 * @throws StructureException
 */
private void updateRMSDandScore() throws StructureAlignmentException, StructureException {
  int size=size();
  rmsd=0;
  tmScore=0;
  listRMSD=new ArrayList<Double>();
  listTMscore=new ArrayList<Double>();
  for (int s1=0; s1 < size; s1++) {
    int lenRMSD=0;
    int lenScore=0;
    double sumRMSD=0.0;
    double sumScore=0.0;
    for (int s2=0; s2 < size; s2++) {
      int Lmin=Math.min(getAtomArrays().get(s1).length,getAtomArrays().get(s2).length);
      double d0=1.24 * Math.cbrt(Lmin - 15.) - 1.8;
      double d0sq=d0 * d0;
      lenScore+=Lmin;
      for (int k=0; k < getBlocks().size(); k++) {
        for (int j=0; j < getBlocks().get(k).length(); j++) {
          Integer pos1=getBlocks().get(k).getAlignRes().get(s1).get(j);
          Integer pos2=getBlocks().get(k).getAlignRes().get(s2).get(j);
          if (pos1 == null || pos2 == null)           continue;
          double d=backDistMatrix.get(s1).get(s2).get(pos1,pos2);
          sumRMSD+=(d * d);
          sumScore+=1. / (1 + d * d / d0sq);
          lenRMSD++;
        }
      }
    }
    listRMSD.add(Math.sqrt(sumRMSD / lenRMSD));
    listTMscore.add(sumScore / lenScore);
  }
  for (int i=0; i < size; i++) {
    rmsd+=listRMSD.get(i);
    tmScore+=listTMscore.get(i);
  }
  rmsd/=size;
  tmScore/=size;
}
Program: 16723
Project: 16723
Buggy source:
/** 
 * Display a MultipleAlignment. Atoms are rotated here with the Pose method.
 * @param multAln
 * @return MultipleAlignmentJmol instance
 * @throws StructureException
 * @throws StructureAlignmentException 
 */
public static MultipleAlignmentJmol display(MultipleAlignment multAln) throws StructureException, StructureAlignmentException {
  for (int i=0; i < multAln.size(); i++) {
    if (multAln.getAtomArrays().get(i).length < 1)     throw new StructureException("String_Node_Str" + multAln.getAtomArrays().get(i).length);
  }
  try {
    List<Atom[]> rotatedAtoms=multAln.getPose().getRotatedAtoms();
    MultipleAlignmentJmol jmol=new MultipleAlignmentJmol(multAln,rotatedAtoms);
    jmol.setTitle(jmol.getStructure().getPDBHeader().getTitle());
    return jmol;
  }
 catch (  StructureAlignmentException e) {
    e.printStackTrace();
    System.err.println("String_Node_Str");
    MultipleAlignmentJmol jmol=new MultipleAlignmentJmol(multAln,multAln.getAtomArrays());
    jmol.setTitle(jmol.getStructure().getPDBHeader().getTitle());
    return jmol;
  }
}

Fixed version (ground truth):
/** 
 * Display a MultipleAlignment. New structures are downloaded if they were not cached in the alignment and they are entirely rotated here with the Pose information.
 * @param multAln
 * @return MultipleAlignmentJmol instance
 * @throws StructureException
 * @throws StructureAlignmentException 
 * @throws IOException 
 */
public static MultipleAlignmentJmol display(MultipleAlignment multAln) throws StructureException, StructureAlignmentException, IOException {
  int size=multAln.size();
  if (multAln.getAtomArrays() == null)   multAln.getParent().updateAtomArrays();
  for (int i=0; i < size; i++) {
    if (multAln.getAtomArrays().get(i).length < 1)     throw new StructureException("String_Node_Str" + multAln.getAtomArrays().get(i).length);
  }
  try {
    List<Atom[]> rotatedAtoms=new ArrayList<Atom[]>();
    for (int i=0; i < size; i++) {
      Structure displayS=multAln.getAtomArrays().get(i)[0].getGroup().getChain().getParent().clone();
      Atom[] rotCA=StructureTools.getAtomCAArray(displayS);
      Calc.rotate(rotCA[0].getGroup().getChain().getParent(),multAln.getPose().getRotation().get(i));
      Calc.shift(rotCA[0].getGroup().getChain().getParent(),multAln.getPose().getTranslation().get(i));
      rotatedAtoms.add(rotCA);
    }
    MultipleAlignmentJmol jmol=new MultipleAlignmentJmol(multAln,rotatedAtoms);
    jmol.setTitle(jmol.getStructure().getPDBHeader().getTitle());
    return jmol;
  }
 catch (  StructureAlignmentException e) {
    e.printStackTrace();
    System.err.println("String_Node_Str");
    MultipleAlignmentJmol jmol=new MultipleAlignmentJmol(multAln,multAln.getAtomArrays());
    jmol.setTitle(jmol.getStructure().getPDBHeader().getTitle());
    return jmol;
  }
}
Program: 16724
Project: 16724
Buggy source:
/** 
 * Default constructor. Instantiates an empty CeMcMain object.
 */
public CeMcMain(){
  ensemble=null;
  params=new CeMcParameters();
}

Fixed version (ground truth):
/** 
 * Default constructor. Instantiates an empty CeMcMain object with the default parameters.
 */
public CeMcMain(){
  ensemble=null;
  params=new CeMcParameters();
}
Program: 16727
Project: 16727
Buggy source:
@Override public void setBlockSet(BlockSet parent){
  this.parent=parent;
  if (parent != null)   parent.getBlocks().add(this);
}

Fixed version (ground truth):
@Override public void setBlockSet(BlockSet parent){
  if (parent != null)   parent.getBlocks().remove(this);
  this.parent=parent;
  if (parent != null)   parent.getBlocks().add(this);
}
Program: 16728
Project: 16728
Buggy source:
@Override public void setMultipleAlignment(MultipleAlignment parent){
  this.parent=parent;
  if (parent != null)   parent.getBlockSets().add(this);
}

Fixed version (ground truth):
@Override public void setMultipleAlignment(MultipleAlignment parent){
  if (parent != null)   parent.getBlockSets().remove(this);
  this.parent=parent;
  if (parent != null)   parent.getBlockSets().add(this);
}
Program: 16729
Project: 16729
Buggy source:
/** 
 * Returns the List of Atom arrays. Every structure has an Atom array associated.
 * @return List of Atom[].
 * @see #setAtomArrays(List)
 */
public List<Atom[]> getAtomArrays();

Fixed version (ground truth):
/** 
 * Returns the List of Atom arrays. Every structure has an Atom array associated. The Atom arrays are only stored as a cache, and must be deleted when the alignment is serialized or stored.
 * @return List of Atom[].
 * @see #setAtomArrays(List)
 */
public List<Atom[]> getAtomArrays();
Program: 16730
Project: 16730
Buggy source:
/** 
 * Sets the List of Atom arrays. Every structure has an Atom array associated.
 * @param atomArrays the List of Atom[].
 * @param setNames if true the List of structure names is updated with the corresponding PDB codes of the Atoms.
 * @see #getAtomArrays()
 * @see #setStructureNames(List)
 */
public void setAtomArrays(List<Atom[]> atomArrays,boolean setNames);

Fixed version (ground truth):
/** 
 * Sets the List of Atom arrays. Every structure has an Atom array associated. The Atom arrays are only stored as a cache, and must be deleted when the alignment is serialized or stored.
 * @param atomArrays the List of Atom[].
 * @see #getAtomArrays()
 * @see #setStructureNames(List)
 */
public void setAtomArrays(List<Atom[]> atomArrays);
Program: 16731
Project: 16731
Buggy source:
/** 
 * Set the List containing the names of the structures aligned (i.e.: PDB code, SCOP domain, etc.).
 * @param structureNames names of the structures
 * @see #getStructureNames()
 * @see #setAtomArrays(List)
 */
public void setStructureNames(List<String> structureNames);

Fixed version (ground truth):
/** 
 * Set the List containing the names of the structures aligned (i.e.: PDB code, SCOP domain, etc.). The names are structure identifiers of the structures.
 * @param structureNames names of the structures, structure identifiers
 * @see #getStructureNames()
 * @see #setAtomArrays(List)
 */
public void setStructureNames(List<String> structureNames);
Program: 16732
Project: 16732
Buggy source:
/** 
 * Returns a List containing the names of the structures aligned (i.e.: PDB code, SCOP domain, etc.). They are in the same order as in the Atom List and alignment List (same index number for same structure).
 * @return List of String names of the structures
 * @see #setStructureNames(List)
 * @see #getAtomArrays()
 */
public List<String> getStructureNames();

Fixed version (ground truth):
/** 
 * Returns a List containing the names of the structures aligned (i.e.: PDB code, SCOP domain, etc.). The names are structure identifiers of the structures. They are in the same order as in the alignment Blocks (same index number for same structure).
 * @return List of String names of the structures
 * @see #setStructureNames(List)
 * @see #getAtomArrays()
 */
public List<String> getStructureNames();
Program: 16733
Project: 16733
Buggy source:
@Override public List<Atom[]> getAtomArrays(){
  if (atomArrays == null)   atomArrays=new ArrayList<Atom[]>();
  return atomArrays;
}

Fixed version (ground truth):
@Override public List<Atom[]> getAtomArrays(){
  if (atomArrays == null)   ;
  return atomArrays;
}
Program: 16734
Project: 16734
Buggy source:
@Override public void setAtomArrays(List<Atom[]> atomArrays,boolean setNames){
  this.atomArrays=atomArrays;
  if (setNames) {
    List<String> names=new ArrayList<String>();
    for (int i=0; i < atomArrays.size(); i++)     names.add(atomArrays.get(i)[0].getGroup().getChain().getParent().getPDBCode());
    setStructureNames(names);
  }
}

Fixed version (ground truth):
@Override public void setAtomArrays(List<Atom[]> atomArrays){
  this.atomArrays=atomArrays;
  List<String> names=new ArrayList<String>();
  for (int i=0; i < atomArrays.size(); i++)   names.add(atomArrays.get(i)[0].getGroup().getChain().getParent().getIdentifier());
  setStructureNames(names);
}
Program: 16735
Project: 16735
Buggy source:
@Override public List<String> getStructureNames(){
  if (structureNames == null)   structureNames=new ArrayList<String>();
  return structureNames;
}

Fixed version (ground truth):
@Override public List<String> getStructureNames(){
  return structureNames;
}
Program: 16736
Project: 16736
Buggy source:
@Override public int size() throws StructureAlignmentException {
  if (atomArrays == null)   throw new StructureAlignmentException("String_Node_Str");
 else   return atomArrays.size();
}

Fixed version (ground truth):
@Override public int size() throws StructureAlignmentException {
  if (structureNames == null)   throw new StructureAlignmentException("String_Node_Str");
 else   return structureNames.size();
}
Program: 16737
Project: 16737
Buggy source:
public static void main(String[] args) throws IOException, StructureException, StructureAlignmentException, InterruptedException, ExecutionException {
  List<String> names=Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  AtomCache cache=new AtomCache();
  List<Atom[]> atomArrays=new ArrayList<Atom[]>();
  for (  String name : names)   atomArrays.add(cache.getAtoms(name));
  CeMcMain algorithm=new CeMcMain();
  MultipleAlignment result=algorithm.align(atomArrays);
  result.getParent().setAlgorithmName(algorithm.getAlgorithmName());
  result.getParent().setVersion(algorithm.getVersion());
  StructureAlignmentDisplay.display(result);
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException, StructureException, StructureAlignmentException, InterruptedException, ExecutionException {
  List<String> names=Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  AtomCache cache=new AtomCache();
  List<Atom[]> atomArrays=new ArrayList<Atom[]>();
  for (  String name : names)   atomArrays.add(cache.getAtoms(name));
  CeMcMain algorithm=new CeMcMain();
  MultipleAlignment result=algorithm.align(atomArrays);
  result.getParent().setStructureNames(names);
  result.getParent().setAlgorithmName(algorithm.getAlgorithmName());
  result.getParent().setVersion(algorithm.getVersion());
  StructureAlignmentDisplay.display(result);
}
Program: 16739
Project: 16739
Buggy source:
/** 
 * Copy constructor.
 * @param bs BlockSetImpl object to be copied.
 * @return BlockSetImpl an identical copy of the input BlockSetImpl object.
 */
public BlockSetImpl(BlockSetImpl bs){
  this.parent=bs.parent;
  this.length=bs.length;
  this.coreLength=bs.coreLength;
  this.pose=null;
  pose=null;
  List<Block> blocks=new ArrayList<Block>();
  for (  Block b : bs.blocks) {
    Block newBK=(Block)b.clone();
    newBK.setBlockSet(this);
  }
  this.blocks=blocks;
}

Fixed version (ground truth):
/** 
 * Copy constructor.
 * @param bs BlockSetImpl object to be copied.
 * @return BlockSetImpl an identical copy of the input BlockSetImpl object.
 */
public BlockSetImpl(BlockSetImpl bs){
  this.parent=bs.parent;
  this.length=bs.length;
  this.coreLength=bs.coreLength;
  this.pose=null;
  pose=null;
  blocks=null;
  if (bs.blocks != null) {
    this.blocks=new ArrayList<Block>();
    for (    Block b : bs.blocks) {
      Block newB=(Block)b.clone();
      newB.setBlockSet(this);
    }
  }
}
Program: 16740
Project: 16740
Buggy source:
/** 
 * Copy constructor.
 * @param ma MultipleAlignmentImpl to copy.
 * @return MultipleAlignmentImpl identical copy of the input MultipleAlignmentImpl.
 */
public MultipleAlignmentImpl(MultipleAlignmentImpl ma){
  parent=ma.parent;
  alnSequences=new ArrayList<String>(ma.getAlnSequences());
  pose=null;
  blockSets=null;
  if (ma.blockSets != null) {
    this.blockSets=new ArrayList<BlockSet>();
    for (    BlockSet bs : ma.blockSets) {
      BlockSet newBS=(BlockSet)bs.clone();
      newBS.setMultipleAlignment(this);
    }
  }
  algScore=ma.getAlgScore();
  probability=ma.getProbability();
}

Fixed version (ground truth):
/** 
 * Copy constructor.
 * @param ma MultipleAlignmentImpl to copy.
 * @return MultipleAlignmentImpl identical copy of the input MultipleAlignmentImpl.
 */
public MultipleAlignmentImpl(MultipleAlignmentImpl ma){
  parent=ma.parent;
  alnSequences=null;
  if (ma.alnSequences != null)   alnSequences=new ArrayList<String>(ma.alnSequences);
  pose=null;
  blockSets=null;
  if (ma.blockSets != null) {
    this.blockSets=new ArrayList<BlockSet>();
    for (    BlockSet bs : ma.blockSets) {
      BlockSet newBS=(BlockSet)bs.clone();
      newBS.setMultipleAlignment(this);
    }
  }
  algScore=ma.getAlgScore();
  probability=ma.getProbability();
}
Program: 16741
Project: 16741
Buggy source:
public static void main(String[] args) throws IOException, StructureException {
  List<String> names=Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  AtomCache cache=new AtomCache();
  List<Atom[]> atomArrays=new ArrayList<Atom[]>();
  for (  String name : names)   atomArrays.add(cache.getAtoms(name));
  MultipleAlignment fakeMultAln=fakeMultipleAlignment("String_Node_Str",atomArrays);
  fakeMultAln.setAlgorithmName("String_Node_Str");
  fakeMultAln.setAtomArrays(atomArrays);
  fakeMultAln.setStructureNames(names);
  List<Atom[]> rotatedAtoms=new ArrayList<Atom[]>();
  for (int i=0; i < fakeMultAln.getSize(); i++) {
    Matrix rotationMatrix=fakeMultAln.getBlockSets().get(0).getPose().getRotationMatrix().get(i);
    Atom shiftVector=fakeMultAln.getBlockSets().get(0).getPose().getTranslation().get(i);
    Atom[] rotCA=StructureTools.cloneAtomArray(atomArrays.get(i));
    for (    Atom a : rotCA) {
      Calc.rotate(a,rotationMatrix);
      Calc.shift(a,shiftVector);
    }
    rotatedAtoms.add(rotCA);
  }
  MultipleAlignmentJmol jmol=new MultipleAlignmentJmol(fakeMultAln,rotatedAtoms);
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException, StructureException {
  List<String> names=Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  AtomCache cache=new AtomCache();
  List<Atom[]> atomArrays=new ArrayList<Atom[]>();
  for (  String name : names)   atomArrays.add(cache.getAtoms(name));
  MultipleAlignment fakeMultAln=fakeMultipleAlignment("String_Node_Str",atomArrays);
  fakeMultAln.setAlgorithmName("String_Node_Str");
  fakeMultAln.setAtomArrays(atomArrays);
  fakeMultAln.setStructureNames(names);
  List<Atom[]> rotatedAtoms=new ArrayList<Atom[]>();
  for (int i=0; i < fakeMultAln.getSize(); i++) {
    Matrix rotationMatrix=fakeMultAln.getBlockSets().get(0).getPose().getRotationMatrix().get(i);
    Atom shiftVector=fakeMultAln.getBlockSets().get(0).getPose().getTranslation().get(i);
    Atom[] rotCA=StructureTools.cloneAtomArray(atomArrays.get(i));
    for (    Atom a : rotCA) {
      Calc.rotate(a,rotationMatrix);
      Calc.shift(a,shiftVector);
    }
    rotatedAtoms.add(rotCA);
  }
  MultipleAlignmentJmol jmol=new MultipleAlignmentJmol(fakeMultAln,rotatedAtoms);
  jmol.setTitle(jmol.getStructure().getPDBHeader().getTitle());
}
Program: 16742
Project: 16742
Buggy source:
protected void initCoords(){
  try {
    if (multAln == null) {
      if (structure != null)       setStructure(structure);
 else {
        return;
      }
    }
    Structure artificial=DisplayAFP.getAlignedStructure(atomArrays);
    PDBHeader header=new PDBHeader();
    String title=multAln.getAlgorithmName() + "String_Node_Str" + multAln.getVersion()+ "String_Node_Str";
    for (    String name : multAln.getStructureNames())     title+=name + "String_Node_Str";
    header.setTitle(title);
    artificial.setPDBHeader(header);
    setStructure(artificial);
  }
 catch (  StructureException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
protected void initCoords(){
  try {
    if (multAln == null) {
      if (structure != null)       setStructure(structure);
 else {
        return;
      }
    }
    Structure artificial=DisplayAFP.getAlignedStructure(atomArrays);
    PDBHeader header=new PDBHeader();
    String title=multAln.getAlgorithmName() + "String_Node_Str" + multAln.getVersion()+ "String_Node_Str";
    for (    String name : multAln.getStructureNames())     title+=name + "String_Node_Str";
    System.out.println(title);
    header.setTitle(title);
    artificial.setPDBHeader(header);
    setStructure(artificial);
  }
 catch (  StructureException e) {
    e.printStackTrace();
  }
}
Program: 16743
Project: 16743
Buggy source:
public void resetDisplay(){
  if (afpChain != null && ca1 != null && ca2 != null) {
    String script=getJmolString(afpChain,ca1,ca2);
    System.out.println(script);
    jmolPanel.evalString("String_Node_Str");
  }
}

Fixed version (ground truth):
public void resetDisplay(){
  if (afpChain != null && ca1 != null && ca2 != null) {
    String script=getJmolString(afpChain,ca1,ca2);
    evalString(script);
    jmolPanel.evalString("String_Node_Str");
  }
}
Program: 16746
Project: 16746
Buggy source:
public static final String convertAtomsToSeq(Atom[] atoms){
  StringBuilder buf=new StringBuilder();
  Group prevGroup=null;
  for (  Atom a : atoms) {
    Group g=a.getGroup();
    if (prevGroup != null) {
      if (prevGroup.equals(g)) {
        continue;
      }
    }
    String code3=g.getPDBName();
    try {
      buf.append(convert_3code_1code(code3));
    }
 catch (    UnknownPdbAminoAcidException e) {
      buf.append('X');
    }
    prevGroup=g;
  }
  return buf.toString();
}

Fixed version (ground truth):
public static final String convertAtomsToSeq(Atom[] atoms){
  StringBuilder buf=new StringBuilder();
  Group prevGroup=null;
  for (  Atom a : atoms) {
    Group g=a.getGroup();
    if (prevGroup != null) {
      if (prevGroup.equals(g)) {
        continue;
      }
    }
    String code3=g.getPDBName();
    Character code1=get1LetterCodeAmino(code3);
    if (code1 == null)     code1=UNKNOWN_GROUP_LABEL;
    buf.append(code1);
    prevGroup=g;
  }
  return buf.toString();
}
Program: 16747
Project: 16747
Buggy source:
/** 
 * Convert three character amino acid codes into single character e.g. convert CYS to C
 * @return a character
 * @param code3 a three character amino acid representation String
 * @throws UnknownPdbAminoAcidException
 * @see {@link #get1LetterCode(String)}
 */
public static final Character convert_3code_1code(String code3) throws UnknownPdbAminoAcidException {
  Character code1=null;
  code1=aminoAcids.get(code3);
  if (code1 == null) {
    throw new UnknownPdbAminoAcidException(code3 + "String_Node_Str");
  }
 else {
    return code1;
  }
}

Fixed version (ground truth):
/** 
 * @param code3
 * @return
 * @deprecated Use {@link #get1LetterCodeAmino(String)} instead
 */
@Deprecated public static final Character convert_3code_1code(String code3){
  return get1LetterCodeAmino(code3);
}
Program: 16748
Project: 16748
Buggy source:
/** 
 * Count how many number of Atoms are contained within a Structure object.
 * @param s the structure object
 * @return the number of Atoms in this Structure
 */
public static final int getNrAtoms(Structure s){
  int nrAtoms=0;
  Iterator<Group> iter=new GroupIterator(s);
  while (iter.hasNext()) {
    Group g=iter.next();
    nrAtoms+=g.size();
  }
  return nrAtoms;
}

Fixed version (ground truth):
/** 
 * Count how many Atoms are contained within a Structure object.
 * @param s the structure object
 * @return the number of Atoms in this Structure
 */
public static final int getNrAtoms(Structure s){
  int nrAtoms=0;
  Iterator<Group> iter=new GroupIterator(s);
  while (iter.hasNext()) {
    Group g=iter.next();
    nrAtoms+=g.size();
  }
  return nrAtoms;
}
Program: 16749
Project: 16749
Buggy source:
/** 
 * Returns the set of intra-chain contacts for the given chain for C-alpha atoms (including non-standard  aminoacids appearing as HETATM groups), i.e. the contact map. Uses a geometric hashing algorithm that speeds up the calculation without need of full distance matrix.   The parsing mode   {@link FileParsingParameters#setAlignSeqRes(boolean)} needs to be set to true for this to work.
 * @param chain
 * @param cutoff
 * @return
 * @deprecated Use the more generic {@link #getRepresentativeAtomsInContact(Chain,double)} instead
 */
@Deprecated public static AtomContactSet getAtomsCAInContact(Chain chain,double cutoff){
  Grid grid=new Grid(cutoff);
  Atom[] atoms=getAtomCAArray(chain);
  grid.addAtoms(atoms);
  return grid.getContacts();
}

Fixed version (ground truth):
/** 
 * Returns the set of intra-chain contacts for the given chain for C-alpha atoms (including non-standard  aminoacids appearing as HETATM groups), i.e. the contact map. Uses a geometric hashing algorithm that speeds up the calculation without need of full distance matrix.   The parsing mode   {@link FileParsingParameters#setAlignSeqRes(boolean)} needs to be set to true for this to work.
 * @param chain
 * @param cutoff
 * @return
 * @see {@link #getRepresentativeAtomsInContact(Chain,double)}
 */
public static AtomContactSet getAtomsCAInContact(Chain chain,double cutoff){
  Grid grid=new Grid(cutoff);
  Atom[] atoms=getAtomCAArray(chain);
  grid.addAtoms(atoms);
  return grid.getContacts();
}
Program: 16750
Project: 16750
Buggy source:
/** 
 * Return an Atom array of the C-alpha atoms. Any atom that is a carbon and has CA name will be returned.
 * @param s the structure object
 * @return an Atom[] array
 * @deprecated Use the more generic {@link #getRepresentativeAtomArray(Structure)} instead
 */
@Deprecated public static Atom[] getAtomCAArray(Structure s){
  List<Atom> atoms=new ArrayList<Atom>();
  for (  Chain c : s.getChains()) {
    for (    Group g : c.getAtomGroups()) {
      if (g.hasAtom(CA_ATOM_NAME) && g.getAtom(CA_ATOM_NAME).getElement() == Element.C) {
        atoms.add(g.getAtom(CA_ATOM_NAME));
      }
    }
  }
  return atoms.toArray(new Atom[atoms.size()]);
}

Fixed version (ground truth):
/** 
 * Return an Atom array of the C-alpha atoms. Any atom that is a carbon and has CA name will be returned.
 * @param s the structure object
 * @return an Atom[] array
 * @see #getRepresentativeAtomArray(Structure)
 */
public static Atom[] getAtomCAArray(Structure s){
  List<Atom> atoms=new ArrayList<Atom>();
  for (  Chain c : s.getChains()) {
    for (    Group g : c.getAtomGroups()) {
      if (g.hasAtom(CA_ATOM_NAME) && g.getAtom(CA_ATOM_NAME).getElement() == Element.C) {
        atoms.add(g.getAtom(CA_ATOM_NAME));
      }
    }
  }
  return atoms.toArray(new Atom[atoms.size()]);
}
Program: 16751
Project: 16751
Buggy source:
/** 
 * Convert a three letter aminoacid code into a single character code. If the code does not correspond to a amino acid or nucleotide, returns  {@link #UNKNOWN_GROUP_LABEL}. Returned null for nucleotides prior to version 4.0.1.
 * @param groupCode3 three letter representation
 * @return The 1-letter abbreviation
 */
public static final Character get1LetterCode(String groupCode3){
  Character aminoCode1;
  try {
    aminoCode1=convert_3code_1code(groupCode3);
  }
 catch (  UnknownPdbAminoAcidException e) {
    groupCode3=groupCode3.trim();
    if (isNucleotide(groupCode3)) {
      aminoCode1=nucleotides30.get(groupCode3);
      if (aminoCode1 == null) {
        aminoCode1=nucleotides23.get(groupCode3);
      }
      if (aminoCode1 == null) {
        aminoCode1=UNKNOWN_GROUP_LABEL;
      }
    }
 else {
      aminoCode1=UNKNOWN_GROUP_LABEL;
    }
  }
  return aminoCode1;
}

Fixed version (ground truth):
/** 
 * Convert a three letter amino acid or nucleotide code into a single character code. If the code does not correspond to an amino acid or nucleotide, returns  {@link #UNKNOWN_GROUP_LABEL}. Returned null for nucleotides prior to version 4.0.1.
 * @param groupCode3 three letter representation
 * @return The 1-letter abbreviation
 */
public static final Character get1LetterCode(String groupCode3){
  Character code1;
  code1=get1LetterCodeAmino(groupCode3);
  if (code1 == null) {
    groupCode3=groupCode3.trim();
    if (isNucleotide(groupCode3)) {
      code1=nucleotides30.get(groupCode3);
      if (code1 == null) {
        code1=nucleotides23.get(groupCode3);
      }
      if (code1 == null) {
        code1=UNKNOWN_GROUP_LABEL;
      }
    }
 else {
      code1=UNKNOWN_GROUP_LABEL;
    }
  }
  return code1;
}
Program: 16752
Project: 16752
Buggy source:
public static final boolean isNucleotide(String groupCode3){
  String code=groupCode3.trim();
  return nucleotides30.containsKey(code) || nucleotides23.containsKey(code);
}

Fixed version (ground truth):
/** 
 * Test if the three-letter code of an ATOM entry corresponds to a nucleotide or to an aminoacid.
 * @param a 3-character code for a group.
 */
public static final boolean isNucleotide(String groupCode3){
  String code=groupCode3.trim();
  return nucleotides30.containsKey(code) || nucleotides23.containsKey(code);
}
Program: 16753
Project: 16753
Buggy source:
private void initResSerialsMap(Chain c){
  if (c.getSeqResGroups().isEmpty()) {
    logger.warn("String_Node_Str",c.getChainID());
  }
  Map<ResidueNumber,Integer> resNums2ResSerials=new HashMap<ResidueNumber,Integer>();
  chains2pdbResNums2ResSerials.put(c.getChainID(),resNums2ResSerials);
  for (int i=0; i < c.getSeqResGroups().size(); i++) {
    resNums2ResSerials.put(c.getSeqResGroup(i).getResidueNumber(),i + 1);
  }
}

Fixed version (ground truth):
private void initResSerialsMap(Chain c){
  if (c.getSeqResGroups() == null || c.getSeqResGroups().isEmpty()) {
    logger.warn("String_Node_Str" + "String_Node_Str",c.getChainID());
  }
  Map<ResidueNumber,Integer> resNums2ResSerials=new HashMap<ResidueNumber,Integer>();
  chains2pdbResNums2ResSerials.put(c.getChainID(),resNums2ResSerials);
  if (c.getSeqResGroups() == null)   return;
  for (int i=0; i < c.getSeqResGroups().size(); i++) {
    resNums2ResSerials.put(c.getSeqResGroup(i).getResidueNumber(),i + 1);
  }
}
Program: 16754
Project: 16754
Buggy source:
/** 
 * Given a Group g of Chain c (member of this Compound) return the corresponding position in the  alignment of all member sequences (1-based numbering), i.e. this is equivalent  to getting the index (1-based) in the SEQRES sequence.  If   {@link FileParsingParameters#setAlignSeqRes(boolean)} is not used, a mapping will not be availableand this method will return -1 for all residues of all chains.
 * @param g
 * @param c
 * @return the aligned residue index (1 to n) or -1 if no mapping exists for the given group
 * @throws IllegalArgumentException if the given Chain is not a member of this Compound
 * @see {@link Chain#getSeqResGroup(int)} 
 */
public int getAlignedResIndex(Group g,Chain c){
  if (!chains.contains(c))   throw new IllegalArgumentException("String_Node_Str" + c.getChainID() + "String_Node_Str"+ getChainIds().toString());
  if (chains2pdbResNums2ResSerials.isEmpty() || !chains2pdbResNums2ResSerials.containsKey(c.getChainID())) {
    initResSerialsMap(c);
  }
  Integer alignedSerial=chains2pdbResNums2ResSerials.get(c.getChainID()).get(g.getResidueNumber());
  if (alignedSerial == null) {
    return -1;
  }
  return alignedSerial;
}

Fixed version (ground truth):
/** 
 * Given a Group g of Chain c (member of this Compound) return the corresponding position in the  alignment of all member sequences (1-based numbering), i.e. the index (1-based) in the SEQRES sequence. This allows for comparisons of residues belonging to different chains of the same Compound (entity). <p> If   {@link FileParsingParameters#setAlignSeqRes(boolean)} is not used or SEQRES not present, a mapping will not be available and this method will return  {@link ResidueNumber#getSeqNum()} for all residues, whichin some cases will be correctly aligned indices (when no insertion codes are  used and when all chains within the entity are numbered in the same way), but in general they will be neither unique (because of insertion codes) nor aligned. </p>
 * @param g
 * @param c
 * @return the aligned residue index (1 to n) or {@link ResidueNumber#getSeqNum()} if no mapping exists for the given group and chain
 * @throws IllegalArgumentException if the given Chain is not a member of this Compound
 * @see {@link Chain#getSeqResGroup(int)} 
 */
public int getAlignedResIndex(Group g,Chain c){
  boolean contained=false;
  for (  Chain member : getChains()) {
    if (c.getChainID().equals(member.getChainID())) {
      contained=true;
      break;
    }
  }
  if (!contained)   throw new IllegalArgumentException("String_Node_Str" + c.getChainID() + "String_Node_Str"+ getChainIds().toString());
  if (chains2pdbResNums2ResSerials.isEmpty() || !chains2pdbResNums2ResSerials.containsKey(c.getChainID())) {
    initResSerialsMap(c);
  }
  Integer alignedSerial=chains2pdbResNums2ResSerials.get(c.getChainID()).get(g.getResidueNumber());
  if (alignedSerial == null) {
    return g.getResidueNumber().getSeqNum();
  }
  return alignedSerial;
}
Program: 16755
Project: 16755
Buggy source:
/** 
 * Returns the set of inter-chain contacts between the two given chains for all non-H atoms. Uses a geometric hashing algorithm that speeds up the calculation without need of full distance matrix. 
 * @param chain1
 * @param chain2
 * @param cutoff
 * @param hetAtoms if true HET atoms are included, if false they are not
 * @return
 */
public static AtomContactSet getAtomsInContact(Chain chain1,Chain chain2,double cutoff,boolean hetAtoms){
  return getAtomsInContact(chain1,chain2,null,cutoff,hetAtoms);
}

Fixed version (ground truth):
/** 
 * Returns the set of inter-chain contacts between the two given chains for all non-H atoms. Uses a geometric hashing algorithm that speeds up the calculation without need of full distance matrix. The parsing mode   {@link FileParsingParameters#setAlignSeqRes(boolean)} needs to be set to true for this to work.  
 * @param chain1
 * @param chain2
 * @param cutoff
 * @param hetAtoms if true HET atoms are included, if false they are not
 * @return
 */
public static AtomContactSet getAtomsInContact(Chain chain1,Chain chain2,double cutoff,boolean hetAtoms){
  return getAtomsInContact(chain1,chain2,null,cutoff,hetAtoms);
}
Program: 16756
Project: 16756
Buggy source:
/** 
 * Returns the set of intra-chain contacts for the given chain for C-alpha atoms (including non-standard  aminoacids appearing as HETATM groups), i.e. the contact map. Uses a geometric hashing algorithm that speeds up the calculation without need of full distance matrix.  
 * @param chain
 * @param cutoff
 * @return
 */
public static AtomContactSet getAtomsCAInContact(Chain chain,double cutoff){
  Grid grid=new Grid(cutoff);
  Atom[] atoms=getAtomCAArray(chain);
  grid.addAtoms(atoms);
  return grid.getContacts();
}

Fixed version (ground truth):
/** 
 * Returns the set of intra-chain contacts for the given chain for C-alpha atoms (including non-standard  aminoacids appearing as HETATM groups), i.e. the contact map. Uses a geometric hashing algorithm that speeds up the calculation without need of full distance matrix.   The parsing mode   {@link FileParsingParameters#setAlignSeqRes(boolean)} needs to be set to true for this to work.
 * @param chain
 * @param cutoff
 * @return
 */
public static AtomContactSet getAtomsCAInContact(Chain chain,double cutoff){
  Grid grid=new Grid(cutoff);
  Atom[] atoms=getAtomCAArray(chain);
  grid.addAtoms(atoms);
  return grid.getContacts();
}
Program: 16757
Project: 16757
Buggy source:
public void add(GroupContact groupContact){
  contacts.put(getResNumberPairFromContact(groupContact),groupContact);
}

Fixed version (ground truth):
public void add(GroupContact groupContact){
  contacts.put(getResIdPairFromContact(groupContact),groupContact);
}
Program: 16758
Project: 16758
Buggy source:
/** 
 * Constructs a <code>GroupContactSet</code> by collapsing the given <code>AtomContactSet</code> into residue-residue (group-group) contacts. 
 * @param atomContacts
 */
public GroupContactSet(AtomContactSet atomContacts){
  contacts=new HashMap<Pair<ResidueNumber>,GroupContact>();
  atoms2groups(atomContacts);
}

Fixed version (ground truth):
/** 
 * Constructs a <code>GroupContactSet</code> by collapsing the given <code>AtomContactSet</code> into residue-residue (group-group) contacts. 
 * @param atomContacts
 */
public GroupContactSet(AtomContactSet atomContacts){
  contacts=new HashMap<Pair<ResidueIdentifier>,GroupContact>();
  atoms2groups(atomContacts);
}