nus-yam/ex-repair huggingface dataset:
Program: 17026
Project: 17026
Buggy source:
/** 
 * Returns a list of transformation matrices for the generation of a macromolecular assembly for the specified assembly Id. 
 * @param assemblyId Id of the macromolecular assembly to be generated
 * @return list of transformation matrices to generate macromolecular assembly
 */
public ArrayList<ModelTransformationMatrix> getBioUnitTransformationList(PdbxStructAssembly psa,PdbxStructAssemblyGen psag,List<PdbxStructOperList> operators){
  System.out.println("String_Node_Str" + psa.getDetails() + "String_Node_Str"+ psa.getOligomeric_details()+ "String_Node_Str"+ psa.getOligomeric_count());
  init();
  this.psa=psa;
  this.psag=psag;
  asymIds=Arrays.asList(psag.getAsym_id_list().split("String_Node_Str"));
  operatorResolver.parseOperatorExpressionString(psag.getOper_expression());
  asymId=psa.getId();
  for (  PdbxStructOperList oper : operators) {
    ModelTransformationMatrix transform=new ModelTransformationMatrix();
    transform.id=oper.getId();
    transform.setTransformationMatrix(oper.getMatrix(),oper.getVector());
    modelTransformations.add(transform);
  }
  ArrayList<ModelTransformationMatrix> transformations=getBioUnitTransformationsListUnaryOperators();
  transformations.addAll(getBioUnitTransformationsListBinaryOperators());
  transformations.trimToSize();
  return transformations;
}

Fixed version (ground truth):
/** 
 * Returns a list of transformation matrices for the generation of a macromolecular assembly for the specified assembly Id. 
 * @param assemblyId Id of the macromolecular assembly to be generated
 * @return list of transformation matrices to generate macromolecular assembly
 */
public ArrayList<ModelTransformationMatrix> getBioUnitTransformationList(PdbxStructAssembly psa,List<PdbxStructAssemblyGen> psags,List<PdbxStructOperList> operators){
  init();
  this.psa=psa;
  this.psags=psags;
  asymId=psa.getId();
  for (  PdbxStructOperList oper : operators) {
    ModelTransformationMatrix transform=new ModelTransformationMatrix();
    transform.id=oper.getId();
    transform.setTransformationMatrix(oper.getMatrix(),oper.getVector());
    modelTransformations.add(transform);
  }
  ArrayList<ModelTransformationMatrix> transformations=getBioUnitTransformationsListUnaryOperators(psa.getId());
  transformations.addAll(getBioUnitTransformationsListBinaryOperators(psa.getId()));
  transformations.trimToSize();
  return transformations;
}
Program: 17027
Project: 17027
Buggy source:
private ArrayList<ModelTransformationMatrix> getBioUnitTransformationsListBinaryOperators(){
  ArrayList<ModelTransformationMatrix> transformations=new ArrayList<ModelTransformationMatrix>();
  List<OrderedPair<String>> operators=operatorResolver.getBinaryOperators();
  for (  String chainId : asymIds) {
    for (    OrderedPair<String> operator : operators) {
      ModelTransformationMatrix original1=getModelTransformationMatrix(operator.getElement1());
      ModelTransformationMatrix original2=getModelTransformationMatrix(operator.getElement2());
      ModelTransformationMatrix transform=ModelTransformationMatrix.multiply4square_x_4square2(original1,original2);
      transform.ndbChainId=chainId;
      transform.id=original1.id + "String_Node_Str" + original2.id;
      transformations.add(transform);
    }
  }
  return transformations;
}

Fixed version (ground truth):
private ArrayList<ModelTransformationMatrix> getBioUnitTransformationsListBinaryOperators(String assemblyId){
  ArrayList<ModelTransformationMatrix> transformations=new ArrayList<ModelTransformationMatrix>();
  List<OrderedPair<String>> operators=operatorResolver.getBinaryOperators();
  for (  PdbxStructAssemblyGen psag : psags) {
    if (psag.getAssembly_id().equals(assemblyId)) {
      List<String> asymIds=Arrays.asList(psag.getAsym_id_list().split("String_Node_Str"));
      operatorResolver.parseOperatorExpressionString(psag.getOper_expression());
      for (      String chainId : asymIds) {
        for (        OrderedPair<String> operator : operators) {
          ModelTransformationMatrix original1=getModelTransformationMatrix(operator.getElement1());
          ModelTransformationMatrix original2=getModelTransformationMatrix(operator.getElement2());
          ModelTransformationMatrix transform=ModelTransformationMatrix.multiply4square_x_4square2(original1,original2);
          transform.ndbChainId=chainId;
          transform.id=original1.id + "String_Node_Str" + original2.id;
          transformations.add(transform);
        }
      }
    }
  }
  System.out.println("String_Node_Str" + assemblyId + "String_Node_Str"+ transformations.size());
  return transformations;
}
Program: 17028
Project: 17028
Buggy source:
public Structure getBiolAssembly(String pdbId,int biolAssemblyNr) throws IOException, StructureException {
  provider.setPdbId(pdbId);
  if (!provider.hasBiolAssembly()) {
    return null;
  }
  if (provider.getNrBiolAssemblies() <= biolAssemblyNr) {
    return null;
  }
  PdbxStructAssembly psa=provider.getPdbxStructAssembly(biolAssemblyNr);
  PdbxStructAssemblyGen psag=provider.getPdbxStructAssemblyGen(biolAssemblyNr);
  List<PdbxStructOperList> operators=provider.getPdbxStructOperList();
  BiologicalAssemblyBuilder builder=new BiologicalAssemblyBuilder();
  ArrayList<ModelTransformationMatrix> transformations=builder.getBioUnitTransformationList(psa,psag,operators);
  Structure asymUnit=null;
  if (provider instanceof MmCifPDBBiolAssemblyProvider) {
    MmCifPDBBiolAssemblyProvider mmcifprov=(MmCifPDBBiolAssemblyProvider)provider;
    asymUnit=mmcifprov.getAsymUnit();
  }
 else {
    asymUnit=StructureIO.getStructure(pdbId);
  }
  return builder.rebuildQuaternaryStructure(asymUnit,transformations);
}

Fixed version (ground truth):
public Structure getBiolAssembly(String pdbId,int biolAssemblyNr) throws IOException, StructureException {
  provider.setPdbId(pdbId);
  if (!provider.hasBiolAssembly()) {
    return null;
  }
  if (provider.getNrBiolAssemblies() <= biolAssemblyNr) {
    return null;
  }
  PdbxStructAssembly psa=provider.getPdbxStructAssembly(biolAssemblyNr);
  List<PdbxStructAssemblyGen> psags=provider.getPdbxStructAssemblyGen(biolAssemblyNr);
  List<PdbxStructOperList> operators=provider.getPdbxStructOperList();
  BiologicalAssemblyBuilder builder=new BiologicalAssemblyBuilder();
  ArrayList<ModelTransformationMatrix> transformations=builder.getBioUnitTransformationList(psa,psags,operators);
  Structure asymUnit=null;
  if (provider instanceof MmCifPDBBiolAssemblyProvider) {
    MmCifPDBBiolAssemblyProvider mmcifprov=(MmCifPDBBiolAssemblyProvider)provider;
    asymUnit=mmcifprov.getAsymUnit();
  }
 else {
    asymUnit=StructureIO.getStructure(pdbId);
  }
  return builder.rebuildQuaternaryStructure(asymUnit,transformations);
}
Program: 17029
Project: 17029
Buggy source:
@Override public List<ModelTransformationMatrix> getBioUnitTransformationList(String pdbId,int biolAssemblyNr){
  provider.setPdbId(pdbId);
  PdbxStructAssembly psa=provider.getPdbxStructAssembly(biolAssemblyNr - 1);
  PdbxStructAssemblyGen psag=provider.getPdbxStructAssemblyGen(biolAssemblyNr - 1);
  if (psa == null || psag == null) {
    return null;
  }
  List<PdbxStructOperList> operators=provider.getPdbxStructOperList();
  BiologicalAssemblyBuilder builder=new BiologicalAssemblyBuilder();
  List<ModelTransformationMatrix> transformations=builder.getBioUnitTransformationList(psa,psag,operators);
  return transformations;
}

Fixed version (ground truth):
@Override public List<ModelTransformationMatrix> getBioUnitTransformationList(String pdbId,int biolAssemblyNr){
  provider.setPdbId(pdbId);
  PdbxStructAssembly psa=provider.getPdbxStructAssembly(biolAssemblyNr - 1);
  List<PdbxStructAssemblyGen> psags=provider.getPdbxStructAssemblyGen(biolAssemblyNr - 1);
  if (psa == null || psags == null) {
    return null;
  }
  List<PdbxStructOperList> operators=provider.getPdbxStructOperList();
  BiologicalAssemblyBuilder builder=new BiologicalAssemblyBuilder();
  List<ModelTransformationMatrix> transformations=builder.getBioUnitTransformationList(psa,psags,operators);
  return transformations;
}
Program: 17030
Project: 17030
Buggy source:
private void readMatrix(String line){
  String pos=line.substring(18,19);
  int i=Integer.parseInt(pos);
  String index=line.substring(21,24 + correct).trim();
  int id=Integer.parseInt(index);
  if (id != currentIndex) {
    addNewMatrix();
    currentIndex=id;
    currentMatrix=new Matrix(3,3);
    shift=new double[3];
  }
  String x=line.substring(24 + correct,33 + correct);
  String y=line.substring(34 + correct,43 + correct);
  String z=line.substring(44 + correct,53 + correct);
  String vec=line.substring(58 + correct,line.length()).trim();
  currentMatrix.set(0,(i - 1),Float.parseFloat(x));
  currentMatrix.set(1,(i - 1),Float.parseFloat(y));
  currentMatrix.set(2,(i - 1),Float.parseFloat(z));
  shift[i - 1]=Float.parseFloat(vec);
}

Fixed version (ground truth):
private void readMatrix(String line){
  String pos=line.substring(18,19);
  int i=Integer.parseInt(pos);
  String index=line.substring(21,24 + correct).trim();
  int id=Integer.parseInt(index);
  if (id != currentIndex) {
    addNewMatrix();
    currentIndex=id;
    currentMatrix=Matrix.identity(3,3);
    shift=new double[3];
  }
  String x=line.substring(24 + correct,33 + correct);
  String y=line.substring(34 + correct,43 + correct);
  String z=line.substring(44 + correct,53 + correct);
  String vec=line.substring(58 + correct,line.length()).trim();
  currentMatrix.set(0,(i - 1),Float.parseFloat(x));
  currentMatrix.set(1,(i - 1),Float.parseFloat(y));
  currentMatrix.set(2,(i - 1),Float.parseFloat(z));
  shift[i - 1]=Float.parseFloat(vec);
}
Program: 17031
Project: 17031
Buggy source:
/** 
 * See here for the current spec: http://www.wwpdb.org/documentation/format33/remarks2.html
 * @param line
 */
public void pdb_REMARK_350_Handler(String line){
  if (line.startsWith("String_Node_Str")) {
    String nr=line.substring(24,line.length()).trim();
    if (currentBioMolecule != null) {
      finalizeCurrentBioMolecule();
    }
    currentBioMolecule=Integer.parseInt(nr);
  }
 else   if (line.startsWith("String_Node_Str")) {
    addToCurrentChainList(line);
  }
 else   if (line.startsWith("String_Node_Str")) {
    addToCurrentChainList(line);
  }
 else   if (line.startsWith("String_Node_Str")) {
    readMatrix(line);
  }
}

Fixed version (ground truth):
/** 
 * See here for the current spec: http://www.wwpdb.org/documentation/format33/remarks2.html
 * @param line
 */
public void pdb_REMARK_350_Handler(String line){
  if (line.startsWith("String_Node_Str")) {
    String nr=line.substring(24,line.length()).trim();
    if (currentBioMolecule != null) {
      finalizeCurrentBioMolecule();
    }
    currentBioMolecule=Integer.parseInt(nr);
    currentIndex=1;
  }
 else   if (line.startsWith("String_Node_Str")) {
    addToCurrentChainList(line);
  }
 else   if (line.startsWith("String_Node_Str")) {
    addToCurrentChainList(line);
  }
 else   if (line.startsWith("String_Node_Str")) {
    readMatrix(line);
  }
}
Program: 17032
Project: 17032
Buggy source:
public PDBBioAssemblyParser(){
  currentChainIDs=new ArrayList<String>();
  currentIndex=1;
  transformations=new ArrayList<ModelTransformationMatrix>();
  currentMatrix=new Matrix(3,3);
  shift=new double[3];
  correct=0;
}

Fixed version (ground truth):
public PDBBioAssemblyParser(){
  currentChainIDs=new ArrayList<String>();
  currentIndex=1;
  transformations=new ArrayList<ModelTransformationMatrix>();
  currentMatrix=Matrix.identity(3,3);
  currentBioMolecule=null;
  shift=new double[3];
  correct=0;
}
Program: 17034
Project: 17034
Buggy source:
public Structure rebuildQuaternaryStructure(Structure asymUnit,ArrayList<ModelTransformationMatrix> transformations){
  Structure s=asymUnit.clone();
  List<Chain> transformedChains=new ArrayList<Chain>();
  for (  ModelTransformationMatrix max : transformations) {
    boolean foundChain=false;
    for (    Chain c : asymUnit.getChains()) {
      if (max.ndbChainId.equals(c.getInternalChainID())) {
        foundChain=true;
        Chain newChain=(Chain)c.clone();
        Matrix m=max.getMatrix();
        double[] vector=max.getVector();
        Atom v=new AtomImpl();
        v.setCoords(vector);
        for (        Group a : newChain.getAtomGroups()) {
          Calc.rotate(a,m);
          Calc.shift(a,v);
        }
        transformedChains.add(newChain);
      }
    }
    if (!foundChain) {
      System.err.println("String_Node_Str" + max.ndbChainId);
    }
  }
  s.setChains(transformedChains);
  return s;
}

Fixed version (ground truth):
public Structure rebuildQuaternaryStructure(Structure asymUnit,ArrayList<ModelTransformationMatrix> transformations){
  Structure s=asymUnit.clone();
  List<Chain> transformedChains=new ArrayList<Chain>();
  System.out.print("String_Node_Str" + s.getPDBCode() + "String_Node_Str");
  for (  Chain c : s.getChains()) {
    System.out.print(c.getChainID());
    if (c.getInternalChainID() != null) {
      System.out.print("String_Node_Str" + c.getInternalChainID() + "String_Node_Str");
    }
  }
  for (  ModelTransformationMatrix max : transformations) {
    boolean foundChain=false;
    for (    Chain c : s.getChains()) {
      String intChainID=c.getInternalChainID();
      if (intChainID == null) {
        System.err.println("String_Node_Str" + c.getChainID() + "String_Node_Str"+ max.ndbChainId+ "String_Node_Str");
        intChainID=c.getChainID();
      }
      if (max.ndbChainId.equals(intChainID)) {
        foundChain=true;
        Chain newChain=(Chain)c.clone();
        Matrix m=max.getMatrix();
        double[] vector=max.getVector();
        Atom v=new AtomImpl();
        v.setCoords(vector);
        for (        Group g : newChain.getAtomGroups()) {
          for (          Atom a : g.getAtoms()) {
            Calc.rotate(a,m);
            Calc.shift(a,v);
          }
        }
        transformedChains.add(newChain);
      }
    }
    if (!foundChain) {
      System.err.println("String_Node_Str" + max.ndbChainId);
    }
  }
  s.setChains(transformedChains);
  return s;
}
Program: 17035
Project: 17035
Buggy source:
/** 
 * Returns a list of transformation matrices for the generation of a macromolecular assembly for the specified assembly Id. 
 * @param assemblyId Id of the macromolecular assembly to be generated
 * @return list of transformation matrices to generate macromolecular assembly
 */
public ArrayList<ModelTransformationMatrix> getBioUnitTransformationList(PdbxStructAssembly psa,PdbxStructAssemblyGen psag,List<PdbxStructOperList> operators){
  System.out.println("String_Node_Str" + psa.getDetails() + "String_Node_Str"+ psa.getOligomeric_details()+ "String_Node_Str"+ psa.getOligomeric_count());
  System.out.println(psag);
  init();
  this.psa=psa;
  this.psag=psag;
  asymIds=Arrays.asList(psag.getAsym_id_list().split("String_Node_Str"));
  operatorResolver.parseOperatorExpressionString(psag.getOper_expression());
  asymId=psa.getId();
  for (  PdbxStructOperList oper : operators) {
    ModelTransformationMatrix transform=new ModelTransformationMatrix();
    transform.id=oper.getId();
    transform.setTransformationMatrix(oper.getMatrix(),oper.getVector());
    modelTransformations.add(transform);
  }
  ArrayList<ModelTransformationMatrix> transformations=getBioUnitTransformationsListUnaryOperators();
  transformations.addAll(getBioUnitTransformationsListBinaryOperators());
  transformations.trimToSize();
  return transformations;
}

Fixed version (ground truth):
/** 
 * Returns a list of transformation matrices for the generation of a macromolecular assembly for the specified assembly Id. 
 * @param assemblyId Id of the macromolecular assembly to be generated
 * @return list of transformation matrices to generate macromolecular assembly
 */
public ArrayList<ModelTransformationMatrix> getBioUnitTransformationList(PdbxStructAssembly psa,PdbxStructAssemblyGen psag,List<PdbxStructOperList> operators){
  System.out.println("String_Node_Str" + psa.getDetails() + "String_Node_Str"+ psa.getOligomeric_details()+ "String_Node_Str"+ psa.getOligomeric_count());
  init();
  this.psa=psa;
  this.psag=psag;
  asymIds=Arrays.asList(psag.getAsym_id_list().split("String_Node_Str"));
  operatorResolver.parseOperatorExpressionString(psag.getOper_expression());
  asymId=psa.getId();
  for (  PdbxStructOperList oper : operators) {
    ModelTransformationMatrix transform=new ModelTransformationMatrix();
    transform.id=oper.getId();
    transform.setTransformationMatrix(oper.getMatrix(),oper.getVector());
    modelTransformations.add(transform);
  }
  ArrayList<ModelTransformationMatrix> transformations=getBioUnitTransformationsListUnaryOperators();
  transformations.addAll(getBioUnitTransformationsListBinaryOperators());
  transformations.trimToSize();
  return transformations;
}
Program: 17036
Project: 17036
Buggy source:
public ChemComp getChemComp(){
  if (chemComp == null) {
    chemComp=ChemCompGroupFactory.getChemComp(pdb_name);
  }
  return chemComp;
}

Fixed version (ground truth):
public ChemComp getChemComp(){
  if (chemComp == null) {
    chemComp=ChemCompGroupFactory.getChemComp(pdb_name);
    if (chemComp == null)     System.out.println("String_Node_Str" + pdb_name);
  }
  return chemComp;
}
Program: 17037
Project: 17037
Buggy source:
/** 
 * set three character name of Group .
 * @param s  a String specifying the PDBName value
 * @see #getPDBName
 * @throws PDBParseException ...
 */
public void setPDBName(String s) throws PDBParseException {
  pdb_name=s;
}

Fixed version (ground truth):
/** 
 * set three character name of Group .
 * @param s  a String specifying the PDBName value
 * @see #getPDBName
 * @throws PDBParseException ...
 */
public void setPDBName(String s) throws PDBParseException {
  if (s.equals("String_Node_Str"))   System.out.println("String_Node_Str");
  pdb_name=s;
}
Program: 17039
Project: 17039
Buggy source:
public static final double getNetCharge(String sequence){
  return getIsoelectricPoint(sequence,true);
}

Fixed version (ground truth):
public static final double getNetCharge(String sequence){
  return getNetCharge(sequence,true);
}
Program: 17040
Project: 17040
Buggy source:
@Test public void testNetCharge(){
  assertEquals(2.0,Utils.roundToDecimals(PeptideProperties.getNetCharge(sequence,false),1));
  assertEquals(0.0,Utils.roundToDecimals(PeptideProperties.getNetCharge(fullInvalidSequence,false),1));
  assertEquals(-3.2,Utils.roundToDecimals(PeptideProperties.getNetCharge("String_Node_Str",false),1));
}

Fixed version (ground truth):
@Test public void testNetCharge(){
  assertEquals(2.9,Utils.roundToDecimals(PeptideProperties.getNetCharge(sequence,false),1));
  assertEquals(0.0,Utils.roundToDecimals(PeptideProperties.getNetCharge(fullInvalidSequence,false),1));
  assertEquals(-3.2,Utils.roundToDecimals(PeptideProperties.getNetCharge("String_Node_Str",false),1));
}
Program: 17042
Project: 17042
Buggy source:
public static void main(String[] args){
  try {
    String name1, name2;
    name1="String_Node_Str";
    name2="String_Node_Str";
    name1="String_Node_Str";
    name2="String_Node_Str";
    name1="String_Node_Str";
    name2="String_Node_Str";
    CeCPMain ce=(CeCPMain)StructureAlignmentFactory.getAlgorithm(CeCPMain.algorithmName);
    CeParameters params=(CeParameters)ce.getParameters();
    ce.setParameters(params);
    AtomCache cache=new AtomCache();
    Atom[] ca1=cache.getAtoms(name1);
    Atom[] ca2=cache.getAtoms(name2);
    if (debug) {
      System.out.format("String_Node_Str",ca1[0].getGroup().getChain().getParent().getName(),ca2[0].getGroup().getChain().getParent().getName());
    }
    AFPChain afpChain=ce.align(ca1,ca2);
    if (debug) {
      System.out.format("String_Node_Str",afpChain.getName1(),afpChain.getName2());
      System.out.format("String_Node_Str",afpChain.getAlignScore());
    }
    int cp=afpChain.getOptAln()[0][1][0];
    System.out.println("String_Node_Str" + cp);
    displayAlignment(afpChain,ca1,ca2);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  try {
    String name1, name2;
    name1="String_Node_Str";
    name2="String_Node_Str";
    name1="String_Node_Str";
    name2="String_Node_Str";
    name1="String_Node_Str";
    name2="String_Node_Str";
    name1="String_Node_Str";
    name2="String_Node_Str";
    name1="String_Node_Str";
    name2="String_Node_Str";
    CeCPMain ce=(CeCPMain)StructureAlignmentFactory.getAlgorithm(CeCPMain.algorithmName);
    CeParameters params=(CeParameters)ce.getParameters();
    ce.setParameters(params);
    AtomCache cache=new AtomCache();
    Atom[] ca1=cache.getAtoms(name1);
    Atom[] ca2=cache.getAtoms(name2);
    if (debug) {
      System.out.format("String_Node_Str",ca1[0].getGroup().getChain().getParent().getName(),ca2[0].getGroup().getChain().getParent().getName());
    }
    AFPChain afpChain=ce.align(ca1,ca2);
    if (debug) {
      System.out.format("String_Node_Str",afpChain.getName1(),afpChain.getName2());
      System.out.format("String_Node_Str",afpChain.getAlignScore());
    }
    int cp=afpChain.getOptAln()[0][1][0];
    System.out.println("String_Node_Str" + cp);
    displayAlignment(afpChain,ca1,ca2);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 17043
Project: 17043
Buggy source:
/** 
 * Finds the index of the last residue which could be a valid n-terminus. A residue i is valid if at least minCPlength residues are present in block in the interval [i,ca2len).
 * @param block
 * @param blockLen
 * @param ca2len
 * @param minCPlength
 * @return
 */
protected static CPRange calculateMinCP(int[] block,int blockLen,int ca2len,int minCPlength){
  CPRange range=new CPRange();
  int middle=Arrays.binarySearch(block,ca2len);
  if (middle < 0) {
    middle=-middle - 1;
  }
  range.mid=middle;
  int minCPntermIndex=middle - minCPlength;
  if (minCPntermIndex >= 0) {
    range.n=block[minCPntermIndex];
  }
 else {
    range.n=-1;
  }
  int minCPctermIndex=middle + minCPlength - 1;
  if (minCPctermIndex < blockLen) {
    range.c=block[minCPctermIndex];
  }
 else {
    range.c=ca2len * 2;
  }
  return range;
}

Fixed version (ground truth):
/** 
 * Finds the alignment index of the residues minCPlength before and after the duplication.
 * @param block The permuted block being considered, generally optAln[0][1]
 * @param blockLen The length of the block (in case extra memory was allocated in block)
 * @param ca2len The length, in residues, of the protein specified by block
 * @param minCPlength The minimum number of residues allowed for a CP
 * @return a CPRange with the following components:<dl><dt>n</dt><dd>Index into <code>block</code> of the residue such that <code>minCPlength</code> residues remain to the end of <code>ca2len</code>, or -1 if no residue fits that criterium.</dd> <dt>mid</dt><dd>Index of the first residue higher than <code>ca2len</code>.</dd> <dt>c</dt><dd>Index of <code>minCPlength</code>-th residue after ca2len, or ca2len*2 if no residue fits that criterium.</dd> </dl>
 */
protected static CPRange calculateMinCP(int[] block,int blockLen,int ca2len,int minCPlength){
  CPRange range=new CPRange();
  int middle=Arrays.binarySearch(block,ca2len);
  if (middle < 0) {
    middle=-middle - 1;
  }
  range.mid=middle;
  int minCPntermIndex=middle - minCPlength;
  if (minCPntermIndex >= 0) {
    range.n=block[minCPntermIndex];
  }
 else {
    range.n=-1;
  }
  int minCPctermIndex=middle + minCPlength - 1;
  if (minCPctermIndex < blockLen) {
    range.c=block[minCPctermIndex];
  }
 else {
    range.c=ca2len * 2;
  }
  return range;
}
Program: 17044
Project: 17044
Buggy source:
public void testOldSecOutput(){
  InputStream inStream=this.getClass().getResourceAsStream("String_Node_Str");
  assertNotNull(inStream);
  String xml=StringManipulationHelper.convertStreamToString(inStream);
  AtomCache cache=new AtomCache();
  try {
    String name1="String_Node_Str";
    String name2="String_Node_Str";
    Atom[] ca1=cache.getAtoms(name1);
    Atom[] ca2=cache.getAtoms(name2);
    AFPChain afpChainOrig=AFPChainXMLParser.fromXML(xml,ca1,ca2);
    afpChainOrig.setCalculationTime(-1);
    String xmlComp=AFPChainXMLConverter.toXML(afpChainOrig,ca1,ca2);
    StringManipulationTestsHelper.assertEqualsIgnoreEndline(xml,xmlComp);
    StructureAlignment ce=StructureAlignmentFactory.getAlgorithm(CeMain.algorithmName);
    AFPChain afpChainNew=ce.align(ca1,ca2);
    afpChainNew.setCalculationTime(-1);
    afpChainNew.setName1(name1);
    afpChainNew.setName2(name2);
    String xmlNew=AFPChainXMLConverter.toXML(afpChainNew,ca1,ca2);
    StringManipulationTestsHelper.assertEqualsIgnoreEndline(xml,xmlNew);
  }
 catch (  Exception e) {
    e.printStackTrace();
    fail(e.getMessage());
  }
}

Fixed version (ground truth):
public void testOldSecOutput() throws Exception {
  InputStream inStream=this.getClass().getResourceAsStream("String_Node_Str");
  assertNotNull(inStream);
  String xml=StringManipulationHelper.convertStreamToString(inStream);
  AtomCache cache=new AtomCache();
  String name1="String_Node_Str";
  String name2="String_Node_Str";
  Atom[] ca1=cache.getAtoms(name1);
  Atom[] ca2=cache.getAtoms(name2);
  AFPChain afpChainOrig=AFPChainXMLParser.fromXML(xml,ca1,ca2);
  afpChainOrig.setCalculationTime(-1);
  String xmlComp=AFPChainXMLConverter.toXML(afpChainOrig,ca1,ca2);
  StringManipulationTestsHelper.assertEqualsIgnoreEndline(xml,xmlComp);
  StructureAlignment ce=StructureAlignmentFactory.getAlgorithm(CeMain.algorithmName);
  AFPChain afpChainNew=ce.align(ca1,ca2);
  afpChainNew.setCalculationTime(-1);
  afpChainNew.setName1(name1);
  afpChainNew.setName2(name2);
  String xmlNew=AFPChainXMLConverter.toXML(afpChainNew,ca1,ca2);
  StringManipulationTestsHelper.assertEqualsIgnoreEndline(xml,xmlNew);
}
Program: 17046
Project: 17046
Buggy source:
private AFPChain makeDummyAFPChain(int[][][] dupAlign,Atom[] ca1,Atom[] ca2){
  AFPChain afp=new AFPChain();
  afp.setOptAln(dupAlign);
  afp.setOptLength(dupAlign[0][1].length);
  afp.setCa1Length(ca1.length);
  afp.setCa2Length(ca2.length);
  afp.setBlockNum(1);
  afp.setOptLen(new int[]{dupAlign[0][1].length});
  return afp;
}

Fixed version (ground truth):
/** 
 * Creates a minimal AFPChain from the specified alignment and proteins
 * @param dupAlign
 * @param ca1
 * @param ca2
 * @return
 */
private AFPChain makeDummyAFPChain(int[][][] dupAlign,Atom[] ca1,Atom[] ca2){
  AFPChain afp=new AFPChain();
  afp.setOptAln(dupAlign);
  afp.setOptLength(dupAlign[0][1].length);
  afp.setCa1Length(ca1.length);
  afp.setCa2Length(ca2.length);
  afp.setBlockNum(1);
  afp.setOptLen(new int[]{dupAlign[0][1].length});
  return afp;
}
Program: 17047
Project: 17047
Buggy source:
public Structure getDomain(String pdbDomainName,AtomCache cache){
  SortedSet<String> domainRanges=null;
  if (serializedCache != null) {
    if (serializedCache.containsKey(pdbDomainName)) {
      domainRanges=serializedCache.get(pdbDomainName);
    }
  }
  Structure s=null;
  try {
    if (domainRanges == null || domainRanges.size() == 0) {
      URL u=new URL(server + "String_Node_Str" + pdbDomainName);
      System.out.println(u);
      InputStream response=HTTPConnectionTools.getInputStream(u);
      String xml=JFatCatClient.convertStreamToString(response);
      domainRanges=XMLUtil.getDomainRangesFromXML(xml);
      if (domainRanges != null)       cache(pdbDomainName,domainRanges);
    }
    int i=0;
    StringBuffer r=new StringBuffer();
    for (    String domainRange : domainRanges) {
      if (!domainRange.contains("String_Node_Str"))       r.append(domainRange);
 else {
        String[] spl=domainRange.split("String_Node_Str");
        if (spl.length > 1)         r.append(spl[1]);
 else {
          System.out.println("String_Node_Str" + domainRange);
        }
      }
      i++;
      if (i < domainRanges.size()) {
        r.append("String_Node_Str");
      }
    }
    String ranges=r.toString();
    StructureName sname=new StructureName(pdbDomainName);
    Structure tmp=cache.getStructure(sname.getPdbId());
    s=StructureTools.getSubRanges(tmp,ranges);
    s.setName(pdbDomainName);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return s;
}

Fixed version (ground truth):
public Structure getDomain(String pdbDomainName,AtomCache cache){
  SortedSet<String> domainRanges=null;
  if (serializedCache != null) {
    if (serializedCache.containsKey(pdbDomainName)) {
      domainRanges=serializedCache.get(pdbDomainName);
    }
  }
  Structure s=null;
  try {
    boolean shouldRequestDomainRanges=checkDomainRanges(domainRanges);
    if (shouldRequestDomainRanges) {
      URL u=new URL(server + "String_Node_Str" + pdbDomainName);
      System.out.println(u);
      InputStream response=HTTPConnectionTools.getInputStream(u);
      String xml=JFatCatClient.convertStreamToString(response);
      domainRanges=XMLUtil.getDomainRangesFromXML(xml);
      if (domainRanges != null)       cache(pdbDomainName,domainRanges);
    }
    int i=0;
    StringBuffer r=new StringBuffer();
    for (    String domainRange : domainRanges) {
      if (!domainRange.contains("String_Node_Str"))       r.append(domainRange);
 else {
        String[] spl=domainRange.split("String_Node_Str");
        if (spl.length > 1)         r.append(spl[1]);
 else {
          System.out.println("String_Node_Str" + domainRange);
        }
      }
      i++;
      if (i < domainRanges.size()) {
        r.append("String_Node_Str");
      }
    }
    String ranges=r.toString();
    System.out.println(ranges);
    StructureName sname=new StructureName(pdbDomainName);
    Structure tmp=cache.getStructure(sname.getPdbId());
    s=StructureTools.getSubRanges(tmp,ranges);
    s.setName(pdbDomainName);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return s;
}
Program: 17048
Project: 17048
Buggy source:
public RemotePDPProvider(boolean useCache){
  super(CACHE_FILE_NAME);
  if (!useCache)   disableCache();
 else   if (serializedCache.keySet().size() < 10000) {
    loadRepresentativeDomains();
  }
}

Fixed version (ground truth):
public RemotePDPProvider(boolean useCache){
  super(CACHE_FILE_NAME);
  if (!useCache) {
    disableCache();
  }
 else {
    loadRepresentativeDomains();
  }
}
Program: 17049
Project: 17049
Buggy source:
public Structure getDomain(String pdbDomainName,AtomCache cache){
  SortedSet<String> domainRanges=null;
  if (serializedCache != null) {
    if (serializedCache.containsKey(pdbDomainName)) {
      domainRanges=serializedCache.get(pdbDomainName);
    }
  }
  Structure s=null;
  try {
    if (domainRanges == null || domainRanges.size() == 0) {
      URL u=new URL(server + "String_Node_Str" + pdbDomainName);
      System.out.println(u);
      InputStream response=HTTPConnectionTools.getInputStream(u);
      String xml=JFatCatClient.convertStreamToString(response);
      domainRanges=XMLUtil.getDomainRangesFromXML(xml);
      if (domainRanges != null)       cache(pdbDomainName,domainRanges);
    }
    if (domainRanges.size() > 0) {
      String domainRange=domainRanges.first();
      s=cache.getStructure(domainRange);
      s.setName(pdbDomainName);
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return s;
}

Fixed version (ground truth):
public Structure getDomain(String pdbDomainName,AtomCache cache){
  SortedSet<String> domainRanges=null;
  if (serializedCache != null) {
    if (serializedCache.containsKey(pdbDomainName)) {
      domainRanges=serializedCache.get(pdbDomainName);
    }
  }
  Structure s=null;
  try {
    if (domainRanges == null || domainRanges.size() == 0) {
      URL u=new URL(server + "String_Node_Str" + pdbDomainName);
      System.out.println(u);
      InputStream response=HTTPConnectionTools.getInputStream(u);
      String xml=JFatCatClient.convertStreamToString(response);
      domainRanges=XMLUtil.getDomainRangesFromXML(xml);
      if (domainRanges != null)       cache(pdbDomainName,domainRanges);
    }
    int i=0;
    StringBuffer r=new StringBuffer();
    for (    String domainRange : domainRanges) {
      if (!domainRange.contains("String_Node_Str"))       r.append(domainRange);
 else {
        String[] spl=domainRange.split("String_Node_Str");
        if (spl.length > 1)         r.append(spl[1]);
 else {
          System.out.println("String_Node_Str" + domainRange);
        }
      }
      i++;
      if (i < domainRanges.size()) {
        r.append("String_Node_Str");
      }
    }
    String ranges=r.toString();
    StructureName sname=new StructureName(pdbDomainName);
    Structure tmp=cache.getStructure(sname.getPdbId());
    s=StructureTools.getSubRanges(tmp,ranges);
    s.setName(pdbDomainName);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return s;
}
Program: 17050
Project: 17050
Buggy source:
public RemotePDPProvider(boolean useCache){
  super(CACHE_FILE_NAME);
  if (!useCache)   disableCache();
}

Fixed version (ground truth):
public RemotePDPProvider(boolean useCache){
  super(CACHE_FILE_NAME);
  if (!useCache)   disableCache();
 else   if (serializedCache.keySet().size() < 10000) {
    loadRepresentativeDomains();
  }
}
Program: 17051
Project: 17051
Buggy source:
public static void main(String[] args){
  try {
    String name1, name2;
    int cp=0;
    name1="String_Node_Str";
    name2="String_Node_Str";
    cp=122;
    OptimalCECPMain ce=(OptimalCECPMain)StructureAlignmentFactory.getAlgorithm(OptimalCECPMain.algorithmName);
    CeParameters params=(CeParameters)ce.getParameters();
    ce.setParameters(params);
    AtomCache cache=new AtomCache();
    Atom[] ca1=cache.getAtoms(name1);
    Atom[] ca2=cache.getAtoms(name2);
    AFPChain afpChain;
    Atom[] ca2clone=cache.getAtoms(name2);
    afpChain=ce.alignPermuted(ca1,ca2clone,params,cp);
    displayAlignment(afpChain,ca1,ca2);
    AFPChain[] alignments=new AFPChain[ca2.length];
    afpChain=ce.alignOptimal(ca1,ca2,params,alignments);
    System.out.format("String_Node_Str",afpChain.getAlignScore());
    System.out.println("String_Node_Str");
    for (int i=0; i < alignments.length; i++) {
      double tm=AFPChainScorer.getTMScore(alignments[i],ca1,ca2);
      System.out.format("String_Node_Str",i,alignments[i].getAlignScore(),tm,alignments[i].getOptLength(),alignments[i].getTotalRmsdOpt(),alignments[i].getBlockNum());
    }
    displayAlignment(afpChain,ca1,ca2);
    for (int cpPos=0; cpPos < alignments.length; cpPos++) {
      AFPChain curr=alignments[cpPos];
      if ((!curr.isSequentialAlignment()) || curr.getBlockNum() > 1) {
        System.out.format("String_Node_Str",cpPos,curr.isSequentialAlignment(),curr.getBlockNum());
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  try {
    String name1, name2;
    int[] cps=new int[]{};
    name1="String_Node_Str";
    name2="String_Node_Str";
    cps=new int[]{122,0,3};
    OptimalCECPMain ce=(OptimalCECPMain)StructureAlignmentFactory.getAlgorithm(OptimalCECPMain.algorithmName);
    CeParameters params=(CeParameters)ce.getParameters();
    ce.setParameters(params);
    AtomCache cache=new AtomCache();
    Atom[] ca1=cache.getAtoms(name1);
    Atom[] ca2=cache.getAtoms(name2);
    AFPChain afpChain;
    AFPChain[] alignments=new AFPChain[ca2.length];
    afpChain=ce.alignOptimal(ca1,ca2,params,alignments);
    System.out.format("String_Node_Str",afpChain.getAlignScore());
    System.out.println("String_Node_Str");
    for (int i=0; i < alignments.length; i++) {
      double tm=AFPChainScorer.getTMScore(alignments[i],ca1,ca2);
      System.out.format("String_Node_Str",i,alignments[i].getAlignScore(),tm,alignments[i].getOptLength(),alignments[i].getTotalRmsdOpt(),alignments[i].getBlockNum());
    }
    for (    int cp : cps) {
      displayAlignment(alignments[cp],ca1,ca2);
    }
    CeCPMain cecp=new CeCPMain();
    afpChain=cecp.align(ca1,ca2);
    displayAlignment(afpChain,ca1,ca2);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 17052
Project: 17052
Buggy source:
/** 
 * Permutes <i>mat</i> by moving the rows of the matrix upwards by <i>cp</i> rows.
 * @param mat The original matrix
 * @param cpRows Number of rows upward to move entries
 * @param cpCols Number of columns leftward to move entries
 * @return The permuted matrix
 */
private static Matrix permuteMatrix(Matrix mat,int cpRows,int cpCols){
  if (cpRows == 0 && cpCols == 0) {
    return mat.copy();
  }
  if (cpRows < 0) {
    cpRows=mat.getRowDimension() + cpRows;
  }
  if (cpRows < 0 || cpRows >= mat.getRowDimension()) {
    throw new ArrayIndexOutOfBoundsException(String.format("String_Node_Str",cpRows,mat.getRowDimension()));
  }
  if (cpCols < 0) {
    cpCols=mat.getColumnDimension() + cpCols;
  }
  if (cpCols < 0 || cpCols >= mat.getColumnDimension()) {
    throw new ArrayIndexOutOfBoundsException(String.format("String_Node_Str",cpCols,mat.getColumnDimension()));
  }
  int[] rows=new int[mat.getRowDimension()];
  for (int i=0; i < rows.length; i++) {
    rows[i]=(i + cpRows) % rows.length;
  }
  int[] cols=new int[mat.getColumnDimension()];
  for (int i=0; i < cols.length; i++) {
    cols[i]=(i + cpCols) % cols.length;
  }
  Matrix newMat=mat.getMatrix(rows,cols);
  assert(newMat.getRowDimension() == mat.getRowDimension());
  assert(newMat.getColumnDimension() == mat.getColumnDimension());
  assert(newMat.get(0,0) == mat.get(cpRows % mat.getRowDimension(),cpCols % mat.getColumnDimension()));
  newMat.set(0,0,-1);
  newMat.set(10,20,-1);
  return newMat;
}

Fixed version (ground truth):
/** 
 * Permutes <i>mat</i> by moving the rows of the matrix upwards by <i>cp</i> rows.
 * @param mat The original matrix
 * @param cpRows Number of rows upward to move entries
 * @param cpCols Number of columns leftward to move entries
 * @return The permuted matrix
 */
private static Matrix permuteMatrix(Matrix mat,int cpRows,int cpCols){
  if (cpRows == 0 && cpCols == 0) {
    return mat.copy();
  }
  if (cpRows < 0) {
    cpRows=mat.getRowDimension() + cpRows;
  }
  if (cpRows < 0 || cpRows >= mat.getRowDimension()) {
    throw new ArrayIndexOutOfBoundsException(String.format("String_Node_Str",cpRows,mat.getRowDimension()));
  }
  if (cpCols < 0) {
    cpCols=mat.getColumnDimension() + cpCols;
  }
  if (cpCols < 0 || cpCols >= mat.getColumnDimension()) {
    throw new ArrayIndexOutOfBoundsException(String.format("String_Node_Str",cpCols,mat.getColumnDimension()));
  }
  int[] rows=new int[mat.getRowDimension()];
  for (int i=0; i < rows.length; i++) {
    rows[i]=(i + cpRows) % rows.length;
  }
  int[] cols=new int[mat.getColumnDimension()];
  for (int i=0; i < cols.length; i++) {
    cols[i]=(i + cpCols) % cols.length;
  }
  Matrix newMat=mat.getMatrix(rows,cols);
  assert(newMat.getRowDimension() == mat.getRowDimension());
  assert(newMat.getColumnDimension() == mat.getColumnDimension());
  assert(newMat.get(0,0) == mat.get(cpRows % mat.getRowDimension(),cpCols % mat.getColumnDimension()));
  return newMat;
}
Program: 17054
Project: 17054
Buggy source:
/** 
 * A week equality metric. Checks if the optAlign is the same, and if the objects being compared seem to be the same (same names, lengths). Does not check properties of the alignment such as scores or superposition matrices.
 * @see java.lang.Object#equals(java.lang.Object)
 */
@Override public boolean equals(Object obj){
  if (this == obj)   return true;
  if (obj == null)   return false;
  if (getClass() != obj.getClass())   return false;
  AFPChain other=(AFPChain)obj;
  if (algorithmName == null) {
    if (other.algorithmName != null)     return false;
  }
 else   if (!algorithmName.equals(other.algorithmName))   return false;
  if (blockNum != other.blockNum)   return false;
  if (ca1Length != other.ca1Length)   return false;
  if (ca2Length != other.ca2Length)   return false;
  if (name1 == null) {
    if (other.name1 != null)     return false;
  }
 else   if (!name1.equals(other.name1))   return false;
  if (name2 == null) {
    if (other.name2 != null)     return false;
  }
 else   if (!name2.equals(other.name2))   return false;
  if (!Arrays.deepEquals(optAln,other.optAln))   return false;
  if (!Arrays.equals(optLen,other.optLen))   return false;
  if (optLength != other.optLength)   return false;
  if (version == null) {
    if (other.version != null)     return false;
  }
 else   if (!version.equals(other.version))   return false;
  return true;
}

Fixed version (ground truth):
/** 
 * A week equality metric. Checks if the optAlign is the same, and if the objects being compared seem to be the same (same names, lengths). Does not check properties of the alignment such as scores or superposition matrices.
 * @see java.lang.Object#equals(java.lang.Object)
 */
@Override public boolean equals(Object obj){
  if (this == obj)   return true;
  if (obj == null)   return false;
  if (getClass() != obj.getClass())   return false;
  AFPChain other=(AFPChain)obj;
  if (blockNum != other.blockNum)   return false;
  if (ca1Length != other.ca1Length)   return false;
  if (ca2Length != other.ca2Length)   return false;
  if (!Arrays.deepEquals(optAln,other.optAln))   return false;
  if (!Arrays.equals(optLen,other.optLen))   return false;
  if (optLength != other.optLength)   return false;
  return true;
}
Program: 17055
Project: 17055
Buggy source:
@Override public int hashCode(){
  final int prime=31;
  int result=1;
  result=prime * result + ((algorithmName == null) ? 0 : algorithmName.hashCode());
  result=prime * result + blockNum;
  result=prime * result + ca1Length;
  result=prime * result + ca2Length;
  result=prime * result + ((name1 == null) ? 0 : name1.hashCode());
  result=prime * result + ((name2 == null) ? 0 : name2.hashCode());
  result=prime * result + Arrays.hashCode(optAln);
  result=prime * result + Arrays.hashCode(optLen);
  result=prime * result + optLength;
  result=prime * result + ((version == null) ? 0 : version.hashCode());
  return result;
}

Fixed version (ground truth):
@Override public int hashCode(){
  final int prime=31;
  int result=1;
  result=prime * result + blockNum;
  result=prime * result + ca1Length;
  result=prime * result + ca2Length;
  result=prime * result + Arrays.hashCode(optAln);
  result=prime * result + Arrays.hashCode(optLen);
  result=prime * result + optLength;
  return result;
}
Program: 17057
Project: 17057
Buggy source:
/** 
 * Load the sequence
 * @return
 */
private boolean init(){
  try {
    RandomAccessFile randomAccessFile=new RandomAccessFile(file,"String_Node_Str");
    randomAccessFile.seek(sequenceStartIndex);
    String sequence=sequenceParser.getSequence(randomAccessFile,sequenceLength);
    setContents(sequence);
  }
 catch (  Exception e) {
    throw new FileAccessError("String_Node_Str" + file + "String_Node_Str"+ sequenceStartIndex+ "String_Node_Str"+ sequenceLength+ "String_Node_Str"+ e.toString());
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Load the sequence
 * @return
 */
private boolean init(){
  try {
    RandomAccessFile randomAccessFile=new RandomAccessFile(file,"String_Node_Str");
    randomAccessFile.seek(sequenceStartIndex);
    String sequence=sequenceParser.getSequence(randomAccessFile,sequenceLength);
    setContents(sequence);
    randomAccessFile.close();
  }
 catch (  Exception e) {
    throw new FileAccessError("String_Node_Str" + file + "String_Node_Str"+ sequenceStartIndex+ "String_Node_Str"+ sequenceLength+ "String_Node_Str"+ e.toString());
  }
  return true;
}
Program: 17060
Project: 17060
Buggy source:
/** 
 * Circular permutation specific code to be run after the standard CE alignment
 * @param afpChain
 * @param ca1
 * @param ca2m
 * @param calculator
 * @throws StructureException
 */
public static void postProcessAlignment(AFPChain afpChain,Atom[] ca1,Atom[] ca2m,CECalculator calculator) throws StructureException {
  Matrix doubledMatrix=afpChain.getDistanceMatrix();
  assert(doubledMatrix.getRowDimension() == ca1.length);
  assert(doubledMatrix.getColumnDimension() == ca2m.length);
  Matrix singleMatrix=doubledMatrix.getMatrix(0,ca1.length - 1,0,(ca2m.length / 2) - 1);
  assert(singleMatrix.getRowDimension() == ca1.length);
  assert(singleMatrix.getColumnDimension() == (ca2m.length / 2));
  afpChain.setDistanceMatrix(singleMatrix);
  afpChain=filterDuplicateAFPs(afpChain,calculator,ca1,ca2m);
}

Fixed version (ground truth):
/** 
 * Circular permutation specific code to be run after the standard CE alignment
 * @param afpChain
 * @param ca1
 * @param ca2m
 * @param calculator
 * @throws StructureException
 */
public static AFPChain postProcessAlignment(AFPChain afpChain,Atom[] ca1,Atom[] ca2m,CECalculator calculator) throws StructureException {
  Matrix doubledMatrix=afpChain.getDistanceMatrix();
  assert(doubledMatrix.getRowDimension() == ca1.length);
  assert(doubledMatrix.getColumnDimension() == ca2m.length);
  Matrix singleMatrix=doubledMatrix.getMatrix(0,ca1.length - 1,0,(ca2m.length / 2) - 1);
  assert(singleMatrix.getRowDimension() == ca1.length);
  assert(singleMatrix.getColumnDimension() == (ca2m.length / 2) - 1);
  afpChain.setDistanceMatrix(singleMatrix);
  afpChain=filterDuplicateAFPs(afpChain,calculator,ca1,ca2m);
  return afpChain;
}
Program: 17061
Project: 17061
Buggy source:
@Override public AFPChain align(Atom[] ca1,Atom[] ca2,Object param) throws StructureException {
  long startTime=System.currentTimeMillis();
  Atom[] ca2m=prepareAtomsForAlign(ca2);
  if (debug) {
    System.out.format("String_Node_Str",System.currentTimeMillis() - startTime);
    startTime=System.currentTimeMillis();
  }
  AFPChain afpChain=super.align(ca1,ca2m,params);
  if (debug) {
    System.out.format("String_Node_Str",System.currentTimeMillis() - startTime);
    startTime=System.currentTimeMillis();
  }
  postProcessAlignment(afpChain,ca1,ca2m,calculator);
  if (debug) {
    System.out.format("String_Node_Str",System.currentTimeMillis() - startTime);
    startTime=System.currentTimeMillis();
  }
  return afpChain;
}

Fixed version (ground truth):
@Override public AFPChain align(Atom[] ca1,Atom[] ca2,Object param) throws StructureException {
  long startTime=System.currentTimeMillis();
  Atom[] ca2m=prepareAtomsForAlign(ca2);
  if (debug) {
    System.out.format("String_Node_Str",System.currentTimeMillis() - startTime);
    startTime=System.currentTimeMillis();
  }
  AFPChain afpChain=super.align(ca1,ca2m,params);
  if (debug) {
    System.out.format("String_Node_Str",System.currentTimeMillis() - startTime);
    startTime=System.currentTimeMillis();
  }
  afpChain=postProcessAlignment(afpChain,ca1,ca2m,calculator);
  if (debug) {
    System.out.format("String_Node_Str",System.currentTimeMillis() - startTime);
    startTime=System.currentTimeMillis();
  }
  return afpChain;
}
Program: 17062
Project: 17062
Buggy source:
private Structure getStructureFromURL(URL url) throws IOException, StructureException {
  System.out.println("String_Node_Str" + url);
  String queryS=url.getQuery();
  String chainId=null;
  if (queryS != null && (queryS.startsWith("String_Node_Str"))) {
    chainId=queryS.substring(8);
  }
  PDBFileReader reader=new PDBFileReader();
  reader.setPath(path);
  reader.setPdbDirectorySplit(isSplit);
  reader.setAutoFetch(autoFetch);
  reader.setFetchFileEvenIfObsolete(fetchFileEvenIfObsolete);
  reader.setFetchCurrent(fetchCurrent);
  reader.setFileParsingParameters(params);
  Structure s=reader.getStructure(url);
  if (chainId == null)   return StructureTools.getReducedStructure(s,-1);
 else   return StructureTools.getReducedStructure(s,chainId);
}

Fixed version (ground truth):
private Structure getStructureFromURL(URL url) throws IOException, StructureException {
  System.out.println("String_Node_Str" + url);
  String queryS=url.getQuery();
  String chainId=null;
  if (queryS != null && (queryS.startsWith("String_Node_Str"))) {
    chainId=queryS.substring(8);
    String fullu=url.toString();
    if (fullu.startsWith("String_Node_Str") && fullu.endsWith("String_Node_Str" + queryS)) {
      String newu=fullu.substring(0,(fullu.length() - (("String_Node_Str" + queryS).length())));
      url=new URL(newu);
    }
  }
  PDBFileReader reader=new PDBFileReader();
  reader.setPath(path);
  reader.setPdbDirectorySplit(isSplit);
  reader.setAutoFetch(autoFetch);
  reader.setFetchFileEvenIfObsolete(fetchFileEvenIfObsolete);
  reader.setFetchCurrent(fetchCurrent);
  reader.setFileParsingParameters(params);
  Structure s=reader.getStructure(url);
  if (chainId == null)   return StructureTools.getReducedStructure(s,-1);
 else   return StructureTools.getReducedStructure(s,chainId);
}