nus-yam/ex-repair huggingface dataset:
Program: 17120
Project: 17120
Buggy source:
@Test public void testGetAsList(){
  assertArrayEquals(global.getAsList().toArray(new AminoAcidCompound[7]),new AminoAcidCompound[]{cs.getCompoundForString("String_Node_Str"),cs.getCompoundForString("String_Node_Str"),cs.getCompoundForString("String_Node_Str"),cs.getCompoundForString("String_Node_Str"),cs.getCompoundForString("String_Node_Str"),cs.getCompoundForString("String_Node_Str"),cs.getCompoundForString("String_Node_Str")});
  assertArrayEquals(local.getAsList().toArray(new AminoAcidCompound[8]),new AminoAcidCompound[]{cs.getCompoundForString("String_Node_Str"),cs.getCompoundForString("String_Node_Str"),cs.getCompoundForString("String_Node_Str"),cs.getCompoundForString("String_Node_Str"),cs.getCompoundForString("String_Node_Str"),cs.getCompoundForString("String_Node_Str"),cs.getCompoundForString("String_Node_Str"),cs.getCompoundForString("String_Node_Str")});
}

Fixed version (ground truth):
@Test public void testGetAsList(){
  assertArrayEquals(global.getAsList().toArray(new AminoAcidCompound[7]),new AminoAcidCompound[]{cs.getCompoundForString("String_Node_Str"),cs.getCompoundForString("String_Node_Str"),cs.getCompoundForString("String_Node_Str"),cs.getCompoundForString("String_Node_Str"),cs.getCompoundForString("String_Node_Str"),cs.getCompoundForString("String_Node_Str"),cs.getCompoundForString("String_Node_Str")});
  assertArrayEquals(local.getAsList().toArray(new AminoAcidCompound[8]),new AminoAcidCompound[]{cs.getCompoundForString("String_Node_Str"),cs.getCompoundForString("String_Node_Str"),cs.getCompoundForString("String_Node_Str"),cs.getCompoundForString("String_Node_Str"),cs.getCompoundForString("String_Node_Str"),cs.getCompoundForString("String_Node_Str"),cs.getCompoundForString("String_Node_Str"),cs.getCompoundForString("String_Node_Str")});
  assertArrayEquals(local2.getAsList().toArray(new AminoAcidCompound[3]),new AminoAcidCompound[]{cs.getCompoundForString("String_Node_Str"),cs.getCompoundForString("String_Node_Str"),cs.getCompoundForString("String_Node_Str")});
}
Program: 17121
Project: 17121
Buggy source:
@Test public void testToString(){
  assertEquals(global.toString(),"String_Node_Str");
  assertEquals(local.toString(),"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testToString(){
  assertEquals(global.toString(),"String_Node_Str");
  assertEquals(local.toString(),"String_Node_Str");
  assertEquals(local2.toString(),"String_Node_Str");
}
Program: 17122
Project: 17122
Buggy source:
@Before public void setup(){
  go=new ProteinSequence("String_Node_Str");
  lo=new ProteinSequence("String_Node_Str");
  global=new SimpleAlignedSequence<AminoAcidCompound>(go,Arrays.asList(new Step[]{Step.GAP,Step.COMPOUND,Step.COMPOUND,Step.GAP,Step.COMPOUND,Step.COMPOUND,Step.GAP}));
  local=new SimpleAlignedSequence<AminoAcidCompound>(lo,Arrays.asList(new Step[]{Step.COMPOUND,Step.COMPOUND,Step.GAP,Step.GAP,Step.COMPOUND,Step.GAP,Step.COMPOUND,Step.COMPOUND}),1,3);
  cs=AminoAcidCompoundSet.getAminoAcidCompoundSet();
}

Fixed version (ground truth):
@Before public void setup(){
  go=new ProteinSequence("String_Node_Str");
  lo=new ProteinSequence("String_Node_Str");
  global=new SimpleAlignedSequence<AminoAcidCompound>(go,Arrays.asList(new Step[]{Step.GAP,Step.COMPOUND,Step.COMPOUND,Step.GAP,Step.COMPOUND,Step.COMPOUND,Step.GAP}));
  local=new SimpleAlignedSequence<AminoAcidCompound>(lo,Arrays.asList(new Step[]{Step.COMPOUND,Step.COMPOUND,Step.GAP,Step.GAP,Step.COMPOUND,Step.GAP,Step.COMPOUND,Step.COMPOUND}),1,3);
  local2=new SimpleAlignedSequence<AminoAcidCompound>(go,Arrays.asList(new Step[]{Step.COMPOUND,Step.COMPOUND,Step.COMPOUND}),1,0);
  cs=AminoAcidCompoundSet.getAminoAcidCompoundSet();
}
Program: 17123
Project: 17123
Buggy source:
@Test public void testGetEnd(){
  assertEquals(global.getEnd().getPosition(),new Integer(6));
  assertEquals(local.getEnd().getPosition(),new Integer(8));
}

Fixed version (ground truth):
@Test public void testGetEnd(){
  assertEquals(global.getEnd().getPosition(),new Integer(6));
  assertEquals(local.getEnd().getPosition(),new Integer(8));
  assertEquals(local2.getEnd().getPosition(),new Integer(3));
}
Program: 17124
Project: 17124
Buggy source:
@Test public void testGetLength(){
  assertEquals(global.getLength(),7);
  assertEquals(local.getLength(),8);
}

Fixed version (ground truth):
@Test public void testGetLength(){
  assertEquals(global.getLength(),7);
  assertEquals(local.getLength(),8);
  assertEquals(local2.getLength(),3);
}
Program: 17128
Project: 17128
Buggy source:
private static void printXMLMatrixShift(PrettyXMLWriter xml,AFPChain afpChain,int blockNr) throws IOException {
  xml.openTag("String_Node_Str");
  Matrix[] ms=afpChain.getBlockRotationMatrix();
  if (ms == null || ms.length == 0)   return;
  Matrix matrix=ms[blockNr];
  for (int x=0; x < 3; x++) {
    for (int y=0; y < 3; y++) {
      String key="String_Node_Str" + (x + 1) + (y + 1);
      xml.attribute(key,matrix.get(x,y) + "String_Node_Str");
    }
  }
  xml.closeTag("String_Node_Str");
  Atom[] shifts=afpChain.getBlockShiftVector();
  Atom shift=shifts[blockNr];
  xml.openTag("String_Node_Str");
  xml.attribute("String_Node_Str",shift.getX() + "String_Node_Str");
  xml.attribute("String_Node_Str",shift.getY() + "String_Node_Str");
  xml.attribute("String_Node_Str",shift.getZ() + "String_Node_Str");
  xml.closeTag("String_Node_Str");
}

Fixed version (ground truth):
private static void printXMLMatrixShift(PrettyXMLWriter xml,AFPChain afpChain,int blockNr) throws IOException {
  Matrix[] ms=afpChain.getBlockRotationMatrix();
  if (ms == null || ms.length == 0)   return;
  xml.openTag("String_Node_Str");
  Matrix matrix=ms[blockNr];
  for (int x=0; x < 3; x++) {
    for (int y=0; y < 3; y++) {
      String key="String_Node_Str" + (x + 1) + (y + 1);
      xml.attribute(key,matrix.get(x,y) + "String_Node_Str");
    }
  }
  xml.closeTag("String_Node_Str");
  Atom[] shifts=afpChain.getBlockShiftVector();
  Atom shift=shifts[blockNr];
  xml.openTag("String_Node_Str");
  xml.attribute("String_Node_Str",shift.getX() + "String_Node_Str");
  xml.attribute("String_Node_Str",shift.getY() + "String_Node_Str");
  xml.attribute("String_Node_Str",shift.getZ() + "String_Node_Str");
  xml.closeTag("String_Node_Str");
}
Program: 17129
Project: 17129
Buggy source:
public static double getTMScore(AFPChain align,Atom[] ca1,Atom[] ca2) throws StructureException {
  Atom[] ca1aligned=new Atom[align.getOptLength()];
  Atom[] ca2aligned=new Atom[align.getOptLength()];
  int pos=0;
  int[] blockLens=align.getOptLen();
  int[][][] optAln=align.getOptAln();
  assert(align.getBlockNum() <= optAln.length);
  for (int block=0; block < align.getBlockNum(); block++) {
    assert(blockLens[block] <= optAln[block][0].length);
    for (int i=0; i < blockLens[block]; i++) {
      ca1aligned[pos]=ca1[optAln[block][0][i]];
      ca2aligned[pos]=(Atom)ca2[optAln[block][1][i]].clone();
      pos++;
    }
  }
  assert(pos == align.getOptLength());
  SVDSuperimposer svd=new SVDSuperimposer(ca1aligned,ca2aligned);
  Matrix matrix=svd.getRotation();
  Atom shift=svd.getTranslation();
  for (  Atom a : ca2aligned) {
    Calc.rotate(a,matrix);
    Calc.shift(a,shift);
  }
  return SVDSuperimposer.getTMScore(ca1aligned,ca2aligned,ca1.length,ca2.length);
}

Fixed version (ground truth):
public static double getTMScore(AFPChain align,Atom[] ca1,Atom[] ca2) throws StructureException {
  if (align.getNrEQR() == 0)   return -1;
  Atom[] ca1aligned=new Atom[align.getOptLength()];
  Atom[] ca2aligned=new Atom[align.getOptLength()];
  int pos=0;
  int[] blockLens=align.getOptLen();
  int[][][] optAln=align.getOptAln();
  assert(align.getBlockNum() <= optAln.length);
  for (int block=0; block < align.getBlockNum(); block++) {
    assert(blockLens[block] <= optAln[block][0].length);
    for (int i=0; i < blockLens[block]; i++) {
      ca1aligned[pos]=ca1[optAln[block][0][i]];
      ca2aligned[pos]=(Atom)ca2[optAln[block][1][i]].clone();
      pos++;
    }
  }
  assert(pos == align.getOptLength());
  SVDSuperimposer svd=new SVDSuperimposer(ca1aligned,ca2aligned);
  Matrix matrix=svd.getRotation();
  Atom shift=svd.getTranslation();
  for (  Atom a : ca2aligned) {
    Calc.rotate(a,matrix);
    Calc.shift(a,shift);
  }
  return SVDSuperimposer.getTMScore(ca1aligned,ca2aligned,ca1.length,ca2.length);
}
Program: 17132
Project: 17132
Buggy source:
public void run(){
  StructureAlignment algorithm=parent.getStructureAlignment();
  try {
    Atom[] ca1=StructureTools.getAtomCAArray(structure1);
    Atom[] ca2=StructureTools.getAtomCAArray(structure2);
    AFPChain afpChain=algorithm.align(ca1,ca2);
    afpChain.setName1(name1);
    afpChain.setName2(name2);
    List<Group> hetatms=structure1.getChain(0).getAtomGroups("String_Node_Str");
    List<Group> nucs=structure1.getChain(0).getAtomGroups("String_Node_Str");
    List<Group> hetatms2=structure2.getChain(0).getAtomGroups("String_Node_Str");
    List<Group> nucs2=structure2.getChain(0).getAtomGroups("String_Node_Str");
    StructureAlignmentJmol jmol;
    jmol=StructureAlignmentDisplay.display(afpChain,ca1,ca2,hetatms,nucs,hetatms2,nucs2);
    String title=jmol.getTitle();
    ConfigStrucAligParams params=algorithm.getParameters();
    if (params != null)     title+="String_Node_Str" + algorithm.getParameters().toString();
    jmol.setTitle(title);
    DisplayAFP.showAlignmentImage(afpChain,ca1,ca2,jmol);
    System.out.println(afpChain.toCE(ca1,ca2));
  }
 catch (  StructureException e) {
    e.printStackTrace();
    logger.warning(e.getMessage());
  }
  parent.notifyCalcFinished();
}

Fixed version (ground truth):
public void run(){
  StructureAlignment algorithm=parent.getStructureAlignment();
  try {
    Atom[] ca1=StructureTools.getAtomCAArray(structure1);
    Atom[] ca2=StructureTools.getAtomCAArray(structure2);
    AFPChain afpChain=algorithm.align(ca1,ca2);
    afpChain.setName1(name1);
    afpChain.setName2(name2);
    StructureAlignmentJmol jmol=StructureAlignmentDisplay.display(afpChain,ca1,ca2);
    String title=jmol.getTitle();
    ConfigStrucAligParams params=algorithm.getParameters();
    if (params != null)     title+="String_Node_Str" + algorithm.getParameters().toString();
    jmol.setTitle(title);
    DisplayAFP.showAlignmentImage(afpChain,ca1,ca2,jmol);
    System.out.println(afpChain.toCE(ca1,ca2));
  }
 catch (  StructureException e) {
    e.printStackTrace();
    logger.warning(e.getMessage());
  }
  parent.notifyCalcFinished();
}
Program: 17133
Project: 17133
Buggy source:
private void showAlignment(String name1,String name2){
  StructureAlignment algorithm;
  try {
    algorithm=StructureAlignmentFactory.getAlgorithm(algorithmName);
  }
 catch (  Exception e) {
    e.printStackTrace();
    System.err.println("String_Node_Str");
    try {
      algorithm=StructureAlignmentFactory.getAlgorithm(CeMain.algorithmName);
    }
 catch (    Exception ex) {
      ex.printStackTrace();
      return;
    }
  }
  try {
    Structure structure1=cache.getStructure(name1);
    Structure structure2=cache.getStructure(name2);
    Atom[] ca1;
    Atom[] ca2;
    List<Group> hetatms1=structure1.getChain(0).getAtomGroups("String_Node_Str");
    List<Group> nucs1=structure1.getChain(0).getAtomGroups("String_Node_Str");
    List<Group> hetatms2=new ArrayList<Group>();
    List<Group> nucs2=new ArrayList<Group>();
    ca1=StructureTools.getAtomCAArray(structure1);
    ca2=StructureTools.getAtomCAArray(structure2);
    AFPChain afpChain;
    afpChain=algorithm.align(ca1,ca2);
    afpChain.setName1(name1);
    afpChain.setName2(name2);
    if ((afpChain.getBlockNum() - 1) == 0) {
      hetatms2=structure2.getChain(0).getAtomGroups("String_Node_Str");
      nucs2=structure2.getChain(0).getAtomGroups("String_Node_Str");
    }
    StructureAlignmentJmol jmol=StructureAlignmentDisplay.display(afpChain,ca1,ca2,hetatms1,nucs1,hetatms2,nucs2);
    DisplayAFP.showAlignmentImage(afpChain,ca1,ca2,jmol);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
private void showAlignment(String name1,String name2){
  StructureAlignment algorithm;
  try {
    algorithm=StructureAlignmentFactory.getAlgorithm(algorithmName);
  }
 catch (  Exception e) {
    e.printStackTrace();
    System.err.println("String_Node_Str");
    try {
      algorithm=StructureAlignmentFactory.getAlgorithm(CeMain.algorithmName);
    }
 catch (    Exception ex) {
      ex.printStackTrace();
      return;
    }
  }
  try {
    Structure structure1=cache.getStructure(name1);
    Structure structure2=cache.getStructure(name2);
    Atom[] ca1;
    Atom[] ca2;
    ca1=StructureTools.getAtomCAArray(structure1);
    ca2=StructureTools.getAtomCAArray(structure2);
    AFPChain afpChain;
    afpChain=algorithm.align(ca1,ca2);
    afpChain.setName1(name1);
    afpChain.setName2(name2);
    StructureAlignmentJmol jmol=StructureAlignmentDisplay.display(afpChain,ca1,ca2);
    DisplayAFP.showAlignmentImage(afpChain,ca1,ca2,jmol);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 17134
Project: 17134
Buggy source:
/** 
 * Note: ca2, hetatoms2 and nucleotides2 should not be rotated. This will be done here...
 */
public static final StructureAlignmentJmol display(AFPChain afpChain,Group[] twistedGroups,Atom[] ca1,Atom[] ca2,List<Group> hetatms,List<Group> nucleotides,List<Group> hetatms2,List<Group> nucleotides2) throws StructureException {
  List<Atom> twistedAs=new ArrayList<Atom>();
  for (  Group g : twistedGroups) {
    if (g == null)     continue;
    if (g.size() < 1)     continue;
    Atom a=g.getAtom(0);
    twistedAs.add(a);
  }
  Atom[] twistedAtoms=(Atom[])twistedAs.toArray(new Atom[twistedAs.size()]);
  Atom[] arr1=getAtomArray(ca1,hetatms,nucleotides);
  Atom[] arr2=getAtomArray(twistedAtoms,hetatms2,nucleotides2);
  if (afpChain.getBlockNum() == 1) {
    if ((hetatms2.size() > 0) || (nucleotides2.size() > 0)) {
      if (afpChain.getBlockRotationMatrix().length > 0) {
        Matrix m1=afpChain.getBlockRotationMatrix()[0];
        Atom vector1=afpChain.getBlockShiftVector()[0];
        for (        Group g : hetatms2) {
          Calc.rotate(g,m1);
          Calc.shift(g,vector1);
        }
        for (        Group g : nucleotides2) {
          Calc.rotate(g,m1);
          Calc.shift(g,vector1);
        }
      }
    }
  }
  String title=afpChain.getAlgorithmName() + "String_Node_Str" + afpChain.getVersion()+ "String_Node_Str"+ afpChain.getName1()+ "String_Node_Str"+ afpChain.getName2();
  StructureAlignmentJmol jmol=new StructureAlignmentJmol(afpChain,arr1,arr2);
  jmol.setTitle(title);
  return jmol;
}

Fixed version (ground truth):
/** 
 * Note: ca2, hetatoms2 and nucleotides2 should not be rotated. This will be done here...
 */
public static final StructureAlignmentJmol display(AFPChain afpChain,Group[] twistedGroups,Atom[] ca1,Atom[] ca2,List<Group> hetatms,List<Group> nucleotides,List<Group> hetatms2,List<Group> nucleotides2) throws StructureException {
  List<Atom> twistedAs=new ArrayList<Atom>();
  for (  Group g : twistedGroups) {
    if (g == null)     continue;
    if (g.size() < 1)     continue;
    Atom a=g.getAtom(0);
    twistedAs.add(a);
  }
  Atom[] twistedAtoms=(Atom[])twistedAs.toArray(new Atom[twistedAs.size()]);
  Atom[] arr1=getAtomArray(ca1,hetatms,nucleotides);
  Atom[] arr2=getAtomArray(twistedAtoms,hetatms2,nucleotides2);
  if (afpChain.getBlockNum() > 0) {
    if ((hetatms2.size() > 0) || (nucleotides2.size() > 0)) {
      if (afpChain.getBlockRotationMatrix().length > 0) {
        Matrix m1=afpChain.getBlockRotationMatrix()[0];
        Atom vector1=afpChain.getBlockShiftVector()[0];
        for (        Group g : hetatms2) {
          Calc.rotate(g,m1);
          Calc.shift(g,vector1);
        }
        for (        Group g : nucleotides2) {
          Calc.rotate(g,m1);
          Calc.shift(g,vector1);
        }
      }
    }
  }
  String title=afpChain.getAlgorithmName() + "String_Node_Str" + afpChain.getVersion()+ "String_Node_Str"+ afpChain.getName1()+ "String_Node_Str"+ afpChain.getName2();
  StructureAlignmentJmol jmol=new StructureAlignmentJmol(afpChain,arr1,arr2);
  jmol.setTitle(title);
  return jmol;
}
Program: 17136
Project: 17136
Buggy source:
public static StructureAlignmentJmol display(AFPChain afpChain,Atom[] ca1,Atom[] ca2,List<Group> hetatms,List<Group> nucs1,List<Group> hetatms2,List<Group> nucs2) throws StructureException {
  Group[] twistedGroups=new Group[ca2.length];
  if (afpChain.getBlockRotationMatrix().length == 0) {
    throw new StructureException("String_Node_Str");
  }
  int blockNum=afpChain.getBlockNum();
  int i=-1;
  if (blockNum == 1) {
    Matrix m=afpChain.getBlockRotationMatrix()[0];
    Atom shift=afpChain.getBlockShiftVector()[0];
    shiftAll(afpChain,ca2,hetatms2,nucs2,m,shift,twistedGroups);
  }
 else {
    for (    Atom a : ca2) {
      i++;
      twistedGroups[i]=a.getParent();
    }
    twistedGroups=AFPTwister.twistOptimized(afpChain,ca1,ca2);
    Matrix m=afpChain.getBlockRotationMatrix()[0];
    Atom shift=afpChain.getBlockShiftVector()[0];
    for (    Group g : hetatms2) {
      Calc.rotate(g,m);
      Calc.shift(g,shift);
    }
    for (    Group g : nucs2) {
      Calc.rotate(g,m);
      Calc.shift(g,shift);
    }
  }
  return DisplayAFP.display(afpChain,twistedGroups,ca1,ca2,hetatms,nucs1,hetatms2,nucs2);
}

Fixed version (ground truth):
private static StructureAlignmentJmol display(AFPChain afpChain,Atom[] ca1,Atom[] ca2,List<Group> hetatms,List<Group> nucs1,List<Group> hetatms2,List<Group> nucs2) throws StructureException {
  Group[] twistedGroups=new Group[ca2.length];
  if (afpChain.getBlockRotationMatrix().length == 0) {
    throw new StructureException("String_Node_Str");
  }
  int blockNum=afpChain.getBlockNum();
  int i=-1;
  if ((blockNum == 1) || (afpChain.getAlgorithmName().equals(CeCPMain.algorithmName))) {
    Matrix m=afpChain.getBlockRotationMatrix()[0];
    Atom shift=afpChain.getBlockShiftVector()[0];
    shiftAll(afpChain,ca2,hetatms2,nucs2,m,shift,twistedGroups);
  }
 else {
    for (    Atom a : ca2) {
      i++;
      twistedGroups[i]=a.getParent();
    }
    twistedGroups=AFPTwister.twistOptimized(afpChain,ca1,ca2);
  }
  return DisplayAFP.display(afpChain,twistedGroups,ca1,ca2,hetatms,nucs1,hetatms2,nucs2);
}
Program: 17137
Project: 17137
Buggy source:
/** 
 * Note: ca2, hetatoms2 and nucleotides2 should not be rotated. This will be done here...
 */
public static final StructureAlignmentJmol display(AFPChain afpChain,Group[] twistedGroups,Atom[] ca1,Atom[] ca2,List<Group> hetatms,List<Group> nucleotides,List<Group> hetatms2,List<Group> nucleotides2) throws StructureException {
  List<Atom> twistedAs=new ArrayList<Atom>();
  for (  Group g : twistedGroups) {
    if (g == null)     continue;
    if (g.size() < 1)     continue;
    Atom a=g.getAtom(0);
    twistedAs.add(a);
  }
  Atom[] twistedAtoms=(Atom[])twistedAs.toArray(new Atom[twistedAs.size()]);
  Atom[] arr1=getAtomArray(ca1,hetatms,nucleotides);
  Atom[] arr2=getAtomArray(twistedAtoms,hetatms2,nucleotides2);
  if (afpChain.getBlockNum() > 0) {
    if ((hetatms2.size() > 0) || (nucleotides2.size() > 0)) {
      if (afpChain.getBlockRotationMatrix().length > 0) {
        Matrix m1=afpChain.getBlockRotationMatrix()[0];
        Atom vector1=afpChain.getBlockShiftVector()[0];
        for (        Group g : hetatms2) {
          Calc.rotate(g,m1);
          Calc.shift(g,vector1);
        }
        for (        Group g : nucleotides2) {
          Calc.rotate(g,m1);
          Calc.shift(g,vector1);
        }
      }
    }
  }
  String title=afpChain.getAlgorithmName() + "String_Node_Str" + afpChain.getVersion()+ "String_Node_Str"+ afpChain.getName1()+ "String_Node_Str"+ afpChain.getName2();
  StructureAlignmentJmol jmol=new StructureAlignmentJmol(afpChain,arr1,arr2);
  jmol.setTitle(title);
  return jmol;
}

Fixed version (ground truth):
/** 
 * Note: ca2, hetatoms2 and nucleotides2 should not be rotated. This will be done here...
 */
public static final StructureAlignmentJmol display(AFPChain afpChain,Group[] twistedGroups,Atom[] ca1,Atom[] ca2,List<Group> hetatms,List<Group> nucleotides,List<Group> hetatms2,List<Group> nucleotides2) throws StructureException {
  List<Atom> twistedAs=new ArrayList<Atom>();
  for (  Group g : twistedGroups) {
    if (g == null)     continue;
    if (g.size() < 1)     continue;
    Atom a=g.getAtom(0);
    twistedAs.add(a);
  }
  Atom[] twistedAtoms=(Atom[])twistedAs.toArray(new Atom[twistedAs.size()]);
  Atom[] arr1=getAtomArray(ca1,hetatms,nucleotides);
  Atom[] arr2=getAtomArray(twistedAtoms,hetatms2,nucleotides2);
  String title=afpChain.getAlgorithmName() + "String_Node_Str" + afpChain.getVersion()+ "String_Node_Str"+ afpChain.getName1()+ "String_Node_Str"+ afpChain.getName2();
  StructureAlignmentJmol jmol=new StructureAlignmentJmol(afpChain,arr1,arr2);
  jmol.setTitle(title);
  return jmol;
}
Program: 17138
Project: 17138
Buggy source:
private static final List<Chain> getAlignedModel(Atom[] ca){
  List<Chain> model=new ArrayList<Chain>();
  for (  Atom a : ca) {
    Group g=a.getParent();
    Chain parentC=g.getParent();
    Chain newChain=null;
    for (    Chain c : model) {
      if (c.getName().equals(parentC.getName())) {
        newChain=c;
        break;
      }
    }
    if (newChain == null) {
      newChain=new ChainImpl();
      newChain.setName(parentC.getName());
      model.add(newChain);
    }
    newChain.addGroup(g);
  }
  return model;
}

Fixed version (ground truth):
/** 
 * get an artifical List of chains containing the Atoms and groups. Does NOT rotate anything.
 * @param ca1
 * @param ca2
 * @return
 * @throws StructureException
 */
private static final List<Chain> getAlignedModel(Atom[] ca){
  List<Chain> model=new ArrayList<Chain>();
  for (  Atom a : ca) {
    Group g=a.getParent();
    Chain parentC=g.getParent();
    Chain newChain=null;
    for (    Chain c : model) {
      if (c.getName().equals(parentC.getName())) {
        newChain=c;
        break;
      }
    }
    if (newChain == null) {
      newChain=new ChainImpl();
      newChain.setName(parentC.getName());
      model.add(newChain);
    }
    newChain.addGroup(g);
  }
  return model;
}
Program: 17139
Project: 17139
Buggy source:
public static final Structure getAlignedStructure(Atom[] ca1,Atom[] ca2) throws StructureException {
  Structure s=new StructureImpl();
  s.setNmr(true);
  List<Chain> model1=getAlignedModel(ca1);
  List<Chain> model2=getAlignedModel(ca2);
  s.addModel(model1);
  s.addModel(model2);
  return s;
}

Fixed version (ground truth):
/** 
 * get an artifical Structure containing both chains. Does NOT rotate anything
 * @param ca1
 * @param ca2
 * @return
 * @throws StructureException
 */
public static final Structure getAlignedStructure(Atom[] ca1,Atom[] ca2) throws StructureException {
  Structure s=new StructureImpl();
  s.setNmr(true);
  List<Chain> model1=getAlignedModel(ca1);
  List<Chain> model2=getAlignedModel(ca2);
  s.addModel(model1);
  s.addModel(model2);
  return s;
}
Program: 17140
Project: 17140
Buggy source:
private static StructureAlignmentJmol display(AFPChain afpChain,Atom[] ca1,Atom[] ca2,List<Group> hetatms,List<Group> nucs1,List<Group> hetatms2,List<Group> nucs2) throws StructureException {
  Group[] twistedGroups=new Group[ca2.length];
  if (afpChain.getBlockRotationMatrix().length == 0) {
    throw new StructureException("String_Node_Str");
  }
  int blockNum=afpChain.getBlockNum();
  int i=-1;
  if ((blockNum == 1) || (afpChain.getAlgorithmName().equals(CeCPMain.algorithmName))) {
    Matrix m=afpChain.getBlockRotationMatrix()[0];
    Atom shift=afpChain.getBlockShiftVector()[0];
    shiftAll(afpChain,ca2,hetatms2,nucs2,m,shift,twistedGroups);
  }
 else {
    for (    Atom a : ca2) {
      i++;
      twistedGroups[i]=a.getParent();
    }
    twistedGroups=AFPTwister.twistOptimized(afpChain,ca1,ca2);
  }
  return DisplayAFP.display(afpChain,twistedGroups,ca1,ca2,hetatms,nucs1,hetatms2,nucs2);
}

Fixed version (ground truth):
/** 
 * Display the alignment
 * @param afpChain
 * @param ca1
 * @param ca2
 * @return
 * @throws StructureException
 */
public static StructureAlignmentJmol display(AFPChain afpChain,Atom[] ca1,Atom[] ca2) throws StructureException {
  if (ca1.length < 1 || ca2.length < 1) {
    throw new StructureException("String_Node_Str" + ca1.length + "String_Node_Str"+ ca2.length);
  }
  Group[] twistedGroups=prepareGroupsForDisplay(afpChain,ca1,ca2);
  List<Group> hetatms=new ArrayList<Group>();
  List<Group> nucs1=new ArrayList<Group>();
  Group g1=ca1[0].getParent();
  Chain c1=null;
  if (g1 != null) {
    c1=g1.getParent();
    if (c1 != null) {
      hetatms=c1.getAtomGroups("String_Node_Str");
      ;
      nucs1=c1.getAtomGroups("String_Node_Str");
    }
  }
  List<Group> hetatms2=new ArrayList<Group>();
  List<Group> nucs2=new ArrayList<Group>();
  Group g2=ca2[0].getParent();
  Chain c2=null;
  if (g2 != null) {
    c2=g2.getParent();
    if (c2 != null) {
      hetatms2=c2.getAtomGroups("String_Node_Str");
      nucs2=c2.getAtomGroups("String_Node_Str");
    }
  }
  return DisplayAFP.display(afpChain,twistedGroups,ca1,ca2,hetatms,nucs1,hetatms2,nucs2);
}
Program: 17142
Project: 17142
Buggy source:
public void run(){
  StructureAlignment algorithm=parent.getStructureAlignment();
  try {
    Atom[] ca1=StructureTools.getAtomCAArray(structure1);
    Atom[] ca2=StructureTools.getAtomCAArray(structure2);
    AFPChain afpChain=algorithm.align(ca1,ca2);
    afpChain.setName1(name1);
    afpChain.setName2(name2);
    List<Group> hetatms=structure1.getChain(0).getAtomGroups("String_Node_Str");
    List<Group> nucs=structure1.getChain(0).getAtomGroups("String_Node_Str");
    List<Group> hetatms2=structure2.getChain(0).getAtomGroups("String_Node_Str");
    List<Group> nucs2=structure2.getChain(0).getAtomGroups("String_Node_Str");
    StructureAlignmentJmol jmol;
    if (afpChain.getAlgorithmName().startsWith("String_Node_Str")) {
      Matrix m=afpChain.getBlockRotationMatrix()[0];
      Atom s=afpChain.getBlockShiftVector()[0];
      Group[] twistedGroups=new Group[ca2.length];
      int i=-1;
      for (      Atom a : ca2) {
        i++;
        Group g=a.getParent();
        twistedGroups[i]=g;
        Calc.rotate(g,m);
        Calc.shift(g,s);
      }
      jmol=DisplayAFP.display(afpChain,twistedGroups,ca1,ca2,hetatms,nucs,hetatms2,nucs2);
    }
 else {
      jmol=StructureAlignmentDisplay.display(afpChain,ca1,ca2,hetatms,nucs,hetatms2,nucs2);
    }
    String title=jmol.getTitle();
    ConfigStrucAligParams params=algorithm.getParameters();
    if (params != null)     title+="String_Node_Str" + algorithm.getParameters().toString();
    jmol.setTitle(title);
    DisplayAFP.showAlignmentImage(afpChain,ca1,ca2,jmol);
    System.out.println(afpChain.toCE(ca1,ca2));
  }
 catch (  StructureException e) {
    e.printStackTrace();
    logger.warning(e.getMessage());
  }
  parent.notifyCalcFinished();
}

Fixed version (ground truth):
public void run(){
  StructureAlignment algorithm=parent.getStructureAlignment();
  try {
    Atom[] ca1=StructureTools.getAtomCAArray(structure1);
    Atom[] ca2=StructureTools.getAtomCAArray(structure2);
    AFPChain afpChain=algorithm.align(ca1,ca2);
    afpChain.setName1(name1);
    afpChain.setName2(name2);
    List<Group> hetatms=structure1.getChain(0).getAtomGroups("String_Node_Str");
    List<Group> nucs=structure1.getChain(0).getAtomGroups("String_Node_Str");
    List<Group> hetatms2=structure2.getChain(0).getAtomGroups("String_Node_Str");
    List<Group> nucs2=structure2.getChain(0).getAtomGroups("String_Node_Str");
    StructureAlignmentJmol jmol;
    jmol=StructureAlignmentDisplay.display(afpChain,ca1,ca2,hetatms,nucs,hetatms2,nucs2);
    String title=jmol.getTitle();
    ConfigStrucAligParams params=algorithm.getParameters();
    if (params != null)     title+="String_Node_Str" + algorithm.getParameters().toString();
    jmol.setTitle(title);
    DisplayAFP.showAlignmentImage(afpChain,ca1,ca2,jmol);
    System.out.println(afpChain.toCE(ca1,ca2));
  }
 catch (  StructureException e) {
    e.printStackTrace();
    logger.warning(e.getMessage());
  }
  parent.notifyCalcFinished();
}
Program: 17143
Project: 17143
Buggy source:
/** 
 * Get the Version information for this Algorithm.
 * @return
 */
public String getVersion();

Fixed version (ground truth):
/** 
 * Get the Version information for this Algorithm.
 * @return the version of the algorithm
 */
public String getVersion();
Program: 17144
Project: 17144
Buggy source:
/** 
 * Returns some documentation on the command line arguments for this algorithm.
 * @return
 */
public String printHelp();

Fixed version (ground truth):
/** 
 * Returns some documentation on the command line arguments for this algorithm.
 * @return the help string
 */
public String printHelp();
Program: 17145
Project: 17145
Buggy source:
/** 
 * Get the name of the Algorithm
 * @return
 */
public String getAlgorithmName();

Fixed version (ground truth):
/** 
 * Get the name of the Algorithm
 * @return the name of the algorithm
 */
public String getAlgorithmName();
Program: 17146
Project: 17146
Buggy source:
/** 
 * run an alignment and also send a bean containing the parameters.
 * @param ca1
 * @param ca2
 * @param params
 * @return
 * @throws StructureException
 */
public AFPChain align(Atom[] ca1,Atom[] ca2,Object params) throws StructureException ;

Fixed version (ground truth):
/** 
 * run an alignment and also send a bean containing the parameters.
 * @param ca1
 * @param ca2
 * @param params
 * @return the afpChain object that contains the alignment.
 * @throws StructureException
 */
public AFPChain align(Atom[] ca1,Atom[] ca2,Object params) throws StructureException ;
Program: 17147
Project: 17147
Buggy source:
public static double getTMScore(AFPChain align,Atom[] ca1,Atom[] ca2) throws StructureException {
  Atom[] ca1aligned=new Atom[align.getOptLength()];
  Atom[] ca2aligned=new Atom[align.getOptLength()];
  int pos=0;
  int[] blockLens=align.getOptLen();
  int[][][] optAln=align.getOptAln();
  assert(align.getBlockNum() == optAln.length);
  for (int block=0; block < optAln.length; block++) {
    assert(blockLens[block] == optAln[block][0].length);
    for (int i=0; i < optAln[block][0].length; i++) {
      ca1aligned[pos]=ca1[optAln[block][0][i]];
      ca2aligned[pos]=(Atom)ca2[optAln[block][1][i]].clone();
      pos++;
    }
  }
  SVDSuperimposer svd=new SVDSuperimposer(ca1aligned,ca2aligned);
  Matrix matrix=svd.getRotation();
  Atom shift=svd.getTranslation();
  for (  Atom a : ca2aligned) {
    Calc.rotate(a,matrix);
    Calc.shift(a,shift);
  }
  return SVDSuperimposer.getTMScore(ca1aligned,ca2aligned,ca1.length,ca2.length);
}

Fixed version (ground truth):
public static double getTMScore(AFPChain align,Atom[] ca1,Atom[] ca2) throws StructureException {
  Atom[] ca1aligned=new Atom[align.getOptLength()];
  Atom[] ca2aligned=new Atom[align.getOptLength()];
  int pos=0;
  int[] blockLens=align.getOptLen();
  int[][][] optAln=align.getOptAln();
  assert(align.getBlockNum() <= optAln.length);
  for (int block=0; block < align.getBlockNum(); block++) {
    assert(blockLens[block] <= optAln[block][0].length);
    for (int i=0; i < blockLens[block]; i++) {
      ca1aligned[pos]=ca1[optAln[block][0][i]];
      ca2aligned[pos]=(Atom)ca2[optAln[block][1][i]].clone();
      pos++;
    }
  }
  SVDSuperimposer svd=new SVDSuperimposer(ca1aligned,ca2aligned);
  Matrix matrix=svd.getRotation();
  Atom shift=svd.getTranslation();
  for (  Atom a : ca2aligned) {
    Calc.rotate(a,matrix);
    Calc.shift(a,shift);
  }
  return SVDSuperimposer.getTMScore(ca1aligned,ca2aligned,ca1.length,ca2.length);
}
Program: 17150
Project: 17150
Buggy source:
@Override public double calculate(MultipleAlignment reference,AFPChain align,Atom[] ca1,Atom[] ca2){
  List<Atom[]> structures=new ArrayList<Atom[]>(2);
  structures.add(ca1);
  structures.add(ca2);
  int[][] refAln;
  try {
    refAln=reference.getAlignmentMatrix(structures);
  }
 catch (  StructureException e) {
    e.printStackTrace();
    return Double.NaN;
  }
  int[][][] optAln=align.getOptAln();
  HashMap<Integer,Integer> optAlnMap1=new HashMap<Integer,Integer>();
  HashMap<Integer,Integer> optAlnMap2=new HashMap<Integer,Integer>();
  for (int block=0; block < align.getBlockNum(); block++) {
    for (int i=0; i < optAln[block][0].length; i++) {
      optAlnMap1.put(optAln[block][0][i],optAln[block][1][i]);
      optAlnMap2.put(optAln[block][1][i],optAln[block][0][i]);
    }
  }
  int correct=0;
  for (int i=0; i < reference.size(); i++) {
    int ca1ref=refAln[0][i];
    int ca2ref=refAln[1][i];
    if (optAlnMap1.containsKey(ca1ref)) {
      if (Math.abs(optAlnMap1.get(ca1ref).intValue() - ca2ref) <= shift) {
        correct++;
      }
    }
 else     if (optAlnMap2.containsKey(ca2ref)) {
      if (Math.abs(optAlnMap2.get(ca2ref).intValue() - ca1ref) <= shift) {
        correct++;
      }
    }
  }
  return (double)correct / reference.size();
}

Fixed version (ground truth):
@Override public double calculate(MultipleAlignment reference,AFPChain align,Atom[] ca1,Atom[] ca2){
  List<Atom[]> structures=new ArrayList<Atom[]>(2);
  structures.add(ca1);
  structures.add(ca2);
  int[][] refAln;
  try {
    refAln=reference.getAlignmentMatrix(structures);
  }
 catch (  StructureException e) {
    e.printStackTrace();
    return Double.NaN;
  }
  int[][][] optAln=align.getOptAln();
  int[] blockLens=align.getOptLen();
  HashMap<Integer,Integer> optAlnMap1=new HashMap<Integer,Integer>();
  HashMap<Integer,Integer> optAlnMap2=new HashMap<Integer,Integer>();
  for (int block=0; block < align.getBlockNum(); block++) {
    for (int i=0; i < blockLens[block]; i++) {
      optAlnMap1.put(optAln[block][0][i],optAln[block][1][i]);
      optAlnMap2.put(optAln[block][1][i],optAln[block][0][i]);
    }
  }
  int correct=0;
  for (int i=0; i < reference.size(); i++) {
    int ca1ref=refAln[0][i];
    int ca2ref=refAln[1][i];
    if (optAlnMap1.containsKey(ca1ref)) {
      if (Math.abs(optAlnMap1.get(ca1ref).intValue() - ca2ref) <= shift) {
        correct++;
      }
    }
 else     if (optAlnMap2.containsKey(ca2ref)) {
      if (Math.abs(optAlnMap2.get(ca2ref).intValue() - ca1ref) <= shift) {
        correct++;
      }
    }
  }
  return (double)correct / reference.size();
}
Program: 17151
Project: 17151
Buggy source:
@Override public double calculate(MultipleAlignment reference,AFPChain align,Atom[] ca1,Atom[] ca2){
  List<Atom[]> structures=new ArrayList<Atom[]>(2);
  structures.add(ca1);
  structures.add(ca2);
  int[][] refAln;
  try {
    refAln=reference.getAlignmentMatrix(structures);
  }
 catch (  StructureException e) {
    e.printStackTrace();
    return Double.NaN;
  }
  int[][][] optAln=align.getOptAln();
  HashMap<Integer,Integer> optAlnMap=new HashMap<Integer,Integer>();
  for (int block=0; block < align.getBlockNum(); block++) {
    for (int i=0; i < optAln[block][0].length; i++) {
      optAlnMap.put(optAln[block][0][i],optAln[block][1][i]);
    }
  }
  int correct=0;
  for (int i=0; i < reference.size(); i++) {
    if (optAlnMap.containsKey(refAln[0][i])) {
      if (optAlnMap.get(refAln[0][i]).equals(refAln[1][i])) {
        correct++;
      }
    }
  }
  return 100. * correct / reference.size();
}

Fixed version (ground truth):
@Override public double calculate(MultipleAlignment reference,AFPChain align,Atom[] ca1,Atom[] ca2){
  List<Atom[]> structures=new ArrayList<Atom[]>(2);
  structures.add(ca1);
  structures.add(ca2);
  int[][] refAln;
  try {
    refAln=reference.getAlignmentMatrix(structures);
  }
 catch (  StructureException e) {
    e.printStackTrace();
    return Double.NaN;
  }
  int[][][] optAln=align.getOptAln();
  int[] blockLens=align.getOptLen();
  HashMap<Integer,Integer> optAlnMap=new HashMap<Integer,Integer>();
  for (int block=0; block < align.getBlockNum(); block++) {
    for (int i=0; i < blockLens[block]; i++) {
      optAlnMap.put(optAln[block][0][i],optAln[block][1][i]);
    }
  }
  int correct=0;
  for (int i=0; i < reference.size(); i++) {
    if (optAlnMap.containsKey(refAln[0][i])) {
      if (optAlnMap.get(refAln[0][i]).equals(refAln[1][i])) {
        correct++;
      }
    }
  }
  return 100. * correct / reference.size();
}
Program: 17153
Project: 17153
Buggy source:
@Override public double calculate(MultipleAlignment reference,AFPChain align,Atom[] ca1,Atom[] ca2){
  Atom[] ca1aligned=new Atom[align.getOptLength()];
  Atom[] ca2aligned=new Atom[align.getOptLength()];
  int pos=0;
  int[] blockLens=align.getOptLen();
  int[][][] optAln=align.getOptAln();
  assert(align.getBlockNum() == optAln.length);
  for (int block=0; block < optAln.length; block++) {
    assert(blockLens[block] == optAln[block][0].length);
    for (int i=0; i < optAln[block][0].length; i++) {
      ca1aligned[pos]=ca1[optAln[block][0][i]];
      ca2aligned[pos]=(Atom)ca2[optAln[block][1][i]].clone();
      pos++;
    }
  }
  try {
    SVDSuperimposer svd=new SVDSuperimposer(ca1aligned,ca2aligned);
    Matrix matrix=svd.getRotation();
    Atom shift=svd.getTranslation();
    for (    Atom a : ca2aligned) {
      Calc.rotate(a,matrix);
      Calc.shift(a,shift);
    }
    return SVDSuperimposer.getRMS(ca1aligned,ca2aligned);
  }
 catch (  StructureException e) {
    e.printStackTrace();
    return Double.NaN;
  }
}

Fixed version (ground truth):
@Override public double calculate(MultipleAlignment reference,AFPChain align,Atom[] ca1,Atom[] ca2){
  Atom[] ca1aligned=new Atom[align.getOptLength()];
  Atom[] ca2aligned=new Atom[align.getOptLength()];
  int pos=0;
  int[] blockLens=align.getOptLen();
  int[][][] optAln=align.getOptAln();
  assert(align.getBlockNum() <= optAln.length);
  for (int block=0; block < align.getBlockNum(); block++) {
    assert(blockLens[block] <= optAln[block][0].length);
    for (int i=0; i < blockLens[block]; i++) {
      ca1aligned[pos]=ca1[optAln[block][0][i]];
      ca2aligned[pos]=(Atom)ca2[optAln[block][1][i]].clone();
      pos++;
    }
  }
  try {
    SVDSuperimposer svd=new SVDSuperimposer(ca1aligned,ca2aligned);
    Matrix matrix=svd.getRotation();
    Atom shift=svd.getTranslation();
    for (    Atom a : ca2aligned) {
      Calc.rotate(a,matrix);
      Calc.shift(a,shift);
    }
    return SVDSuperimposer.getRMS(ca1aligned,ca2aligned);
  }
 catch (  StructureException e) {
    e.printStackTrace();
    return Double.NaN;
  }
}
Program: 17154
Project: 17154
Buggy source:
/** 
 * @throws BioException
 */
private void init() throws BioException {
  similars=0;
  identicals=0;
  nGapsQ=0;
  nGapsS=0;
  for (int i=0; i < Math.min(queryEnd - queryStart,subjectEnd - subjectStart) + 1; i++) {
    Symbol a=query.symbolAt(i + queryStart);
    Symbol b=subject.symbolAt(i + subjectStart);
    boolean gap=false;
    if (a.equals(b))     identicals++;
    if (a.equals(query.getAlphabet().getGapSymbol())) {
      nGapsQ++;
      gap=true;
    }
    if (b.equals(subject.getAlphabet().getGapSymbol())) {
      nGapsS++;
      gap=true;
    }
    if (!gap && subMatrix != null && subMatrix.getValueAt(a,b) > 0)     similars++;
  }
}

Fixed version (ground truth):
/** 
 * @throws BioException
 */
private void init() throws BioException {
  similars=0;
  identicals=0;
  nGapsQ=0;
  nGapsS=0;
  for (int i=0; i < Math.min(queryEnd - queryStart,subjectEnd - subjectStart); i++) {
    Symbol a=query.symbolAt(i + queryStart);
    Symbol b=subject.symbolAt(i + subjectStart);
    boolean gap=false;
    if (a.equals(b))     identicals++;
    if (a.equals(query.getAlphabet().getGapSymbol())) {
      nGapsQ++;
      gap=true;
    }
    if (b.equals(subject.getAlphabet().getGapSymbol())) {
      nGapsS++;
      gap=true;
    }
    if (!gap && subMatrix != null && subMatrix.getValueAt(a,b) > 0)     similars++;
  }
}
Program: 17155
Project: 17155
Buggy source:
@BeforeClass public static void parseSequences(){
  InputStream cdsIs=new ClasspathResource("String_Node_Str").getInputStream();
  InputStream pepIs=new ClasspathResource("String_Node_Str").getInputStream();
  try {
    FastaReader<DNASequence,NucleotideCompound> dnaReader=new FastaReader<DNASequence,NucleotideCompound>(cdsIs,new GenericFastaHeaderParser<DNASequence,NucleotideCompound>(),new DNASequenceCreator(dnaCs));
    brca2Dna=dnaReader.process().iterator().next();
    FastaReader<ProteinSequence,AminoAcidCompound> pReader=new FastaReader<ProteinSequence,AminoAcidCompound>(pepIs,new GenericFastaHeaderParser<ProteinSequence,AminoAcidCompound>(),new ProteinSequenceCreator(aaCs));
    brca2Pep=pReader.process().iterator().next();
  }
 catch (  Exception e) {
    e.printStackTrace();
    Assert.fail("String_Node_Str");
  }
 finally {
    close(cdsIs);
    close(pepIs);
  }
}

Fixed version (ground truth):
@BeforeClass public static void parseSequences(){
  InputStream cdsIs=new ClasspathResource("String_Node_Str").getInputStream();
  InputStream pepIs=new ClasspathResource("String_Node_Str").getInputStream();
  try {
    FastaReader<DNASequence,NucleotideCompound> dnaReader=new FastaReader<DNASequence,NucleotideCompound>(cdsIs,new GenericFastaHeaderParser<DNASequence,NucleotideCompound>(),new DNASequenceCreator(dnaCs));
    brca2Dna=dnaReader.process().values().iterator().next();
    FastaReader<ProteinSequence,AminoAcidCompound> pReader=new FastaReader<ProteinSequence,AminoAcidCompound>(pepIs,new GenericFastaHeaderParser<ProteinSequence,AminoAcidCompound>(),new ProteinSequenceCreator(aaCs));
    brca2Pep=pReader.process().values().iterator().next();
  }
 catch (  Exception e) {
    e.printStackTrace();
    Assert.fail("String_Node_Str");
  }
 finally {
    close(cdsIs);
    close(pepIs);
  }
}
Program: 17156
Project: 17156
Buggy source:
/** 
 * Test of process method, of class FastaReader.
 */
@Test public void testProcess() throws Exception {
  System.out.println("String_Node_Str");
  InputStream inStream=this.getClass().getResourceAsStream("String_Node_Str");
  assertNotNull(inStream);
  FastaReader<ProteinSequence,AminoAcidCompound> fastaReader=new FastaReader<ProteinSequence,AminoAcidCompound>(inStream,new GenericFastaHeaderParser<ProteinSequence,AminoAcidCompound>(),new ProteinSequenceCreator(AminoAcidCompoundSet.getAminoAcidCompoundSet()));
  List<ProteinSequence> proteinSequences=fastaReader.process();
  inStream.close();
  System.out.println("String_Node_Str" + proteinSequences.size());
  assertEquals(proteinSequences.size(),283);
  ProteinSequence proteinSequence=proteinSequences.get(0);
  assertEquals(proteinSequence.getAccession().getID(),"String_Node_Str");
  assertEquals(proteinSequence.getSequenceAsString(),"String_Node_Str");
  proteinSequence=proteinSequences.get(281);
  System.out.println(proteinSequence.getAccession());
  System.out.println(proteinSequence.getSequenceAsString());
  assertEquals(proteinSequence.getAccession().getID(),"String_Node_Str");
  assertEquals(proteinSequence.getSequenceAsString(),"String_Node_Str");
  proteinSequence=proteinSequences.get(282);
  assertEquals(proteinSequence.getAccession().getID(),"String_Node_Str");
  assertEquals(proteinSequence.getSequenceAsString(),"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Test of process method, of class FastaReader.
 */
@Test public void testProcess() throws Exception {
  System.out.println("String_Node_Str");
  InputStream inStream=this.getClass().getResourceAsStream("String_Node_Str");
  assertNotNull(inStream);
  FastaReader<ProteinSequence,AminoAcidCompound> fastaReader=new FastaReader<ProteinSequence,AminoAcidCompound>(inStream,new GenericFastaHeaderParser<ProteinSequence,AminoAcidCompound>(),new ProteinSequenceCreator(AminoAcidCompoundSet.getAminoAcidCompoundSet()));
  LinkedHashMap<String,ProteinSequence> proteinSequences=fastaReader.process();
  inStream.close();
  assertEquals(proteinSequences.size(),283);
  int seqNum=0;
  for (  String id : proteinSequences.keySet()) {
    ProteinSequence proteinSequence=proteinSequences.get(id);
switch (seqNum) {
case 0:
      assertEquals(proteinSequence.getAccession().getID(),"String_Node_Str");
    assertEquals(proteinSequence.getSequenceAsString(),"String_Node_Str");
  break;
case 281:
assertEquals(proteinSequence.getAccession().getID(),"String_Node_Str");
assertEquals(proteinSequence.getSequenceAsString(),"String_Node_Str");
break;
case 282:
assertEquals(proteinSequence.getAccession().getID(),"String_Node_Str");
assertEquals(proteinSequence.getSequenceAsString(),"String_Node_Str");
break;
}
seqNum++;
}
assertEquals(seqNum,283);
}
Program: 17157
Project: 17157
Buggy source:
public Alignment subAlignment(Set labels,Location loc) throws NoSuchElementException {
  return new RelabeledAlignment(delegate.subAlignment(map(labels),loc));
}

Fixed version (ground truth):
public Alignment subAlignment(Set<String> labels,Location loc) throws NoSuchElementException {
  return new RelabeledAlignment(delegate.subAlignment(map(labels),loc));
}
Program: 17158
Project: 17158
Buggy source:
public RelabeledAlignment(Alignment delegate){
  this.delegate=delegate;
  for (Iterator i=delegate.getLabels().iterator(); i.hasNext(); ) {
    Object label=i.next();
    labelMap.put(label,label);
  }
}

Fixed version (ground truth):
public RelabeledAlignment(Alignment delegate){
  this.delegate=delegate;
  for (Iterator<String> i=delegate.getLabels().iterator(); i.hasNext(); ) {
    String label=i.next();
    labelMap.put(label,label);
  }
}
Program: 17159
Project: 17159
Buggy source:
public List getLabels(){
  return new ArrayList(labelMap.keySet());
}

Fixed version (ground truth):
public List<String> getLabels(){
  return new ArrayList<String>(labelMap.keySet());
}
Program: 17160
Project: 17160
Buggy source:
public SymbolList symbolListForLabel(Object label) throws NoSuchElementException {
  return delegate.symbolListForLabel(map(label));
}

Fixed version (ground truth):
public SymbolList symbolListForLabel(String label) throws NoSuchElementException {
  return delegate.symbolListForLabel(map(label));
}
Program: 17161
Project: 17161
Buggy source:
protected Object map(Object label){
  return labelMap.get(label);
}

Fixed version (ground truth):
protected String map(Object label){
  return labelMap.get(label);
}
Program: 17162
Project: 17162
Buggy source:
protected void setUp(){
  try {
    sa=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
    map=new HashMap(sa.length);
    for (int i=0; i < sa.length; i++) {
      map.put(new Integer(i),DNATools.createDNA(sa[i]));
    }
    a=new SimpleAlignment(map);
    random=new SimpleDistribution(DNATools.getDNA());
    DistributionTools.randomizeDistribution(random);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
protected void setUp(){
  try {
    sa=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
    map=new HashMap<String,SymbolList>(sa.length);
    for (int i=0; i < sa.length; i++) {
      map.put(i + "String_Node_Str",DNATools.createDNA(sa[i]));
    }
    a=new SimpleAlignment(map);
    random=new SimpleDistribution(DNATools.getDNA());
    DistributionTools.randomizeDistribution(random);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 17163
Project: 17163
Buggy source:
public SymListAsAlignment(List labels,SymbolList symList){
  if (labels.size() != symList.getAlphabet().getAlphabets().size()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.labels=Collections.unmodifiableList(new ArrayList(labels));
  this.symList=symList;
}

Fixed version (ground truth):
public SymListAsAlignment(List<String> labels,SymbolList symList){
  if (labels.size() != symList.getAlphabet().getAlphabets().size()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.labels=Collections.unmodifiableList(new ArrayList<String>(labels));
  this.symList=symList;
}
Program: 17164
Project: 17164
Buggy source:
public List getLabels(){
  return labels;
}

Fixed version (ground truth):
public List<String> getLabels(){
  return labels;
}
Program: 17165
Project: 17165
Buggy source:
public SymbolList symbolListForLabel(Object label){
  return new IndexedSymbolList(symList,labels.indexOf(label));
}

Fixed version (ground truth):
public SymbolList symbolListForLabel(String label){
  return new IndexedSymbolList(symList,labels.indexOf(label));
}