nus-yam/ex-repair huggingface dataset:
Program: 16612
Project: 16612
Buggy source:
@Override public String toString(){
  StringBuffer buf=new StringBuffer();
  String nl=System.getProperty("String_Node_Str");
  buf.append("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
  for (int i=0; i < groups.length; i++) {
    buf.append(nl);
    SecStrucState ss=(SecStrucState)groups[i].getProperty(Group.SEC_STRUC);
    buf.append(ss.printDSSPline(i));
  }
  return buf.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  StringBuffer buf=new StringBuffer();
  String nl=System.getProperty("String_Node_Str");
  buf.append("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
  for (int i=0; i < groups.length; i++) {
    buf.append(nl);
    SecStrucState ss=getSecStrucState(i);
    buf.append(ss.printDSSPline(i));
  }
  return buf.toString();
}
Program: 16613
Project: 16613
Buggy source:
private boolean shouldExtendLadder(Ladder ladder,int start,int end,BridgeType btype){
  return ((btype.equals(ladder.btype)) && (start == ladder.to + 1) && (((end == ladder.lto + 1) && (btype.equals(BridgeType.parallel))) || ((end == ladder.lfrom - 1) && (btype.equals(BridgeType.parallel)))));
}

Fixed version (ground truth):
/** 
 * Conditions to extend a ladder with a given beta Bridge: <li>The bridge and ladder are of the same type. <li>The smallest bridge residue is sequential to the first strand ladder. <li>The second bridge residue is either sequential (parallel) or previous (antiparallel) to the second strand of the ladder </li>
 * @param ladder the ladder candidate to extend
 * @param i index of the first bridge residue
 * @param j index of the second bridge residue
 * @param btype type of beta bridge
 * @return true if the bridge (i,j) extends the ladder
 */
private boolean shouldExtendLadder(Ladder ladder,int i,int j,BridgeType btype){
  boolean sameType=btype.equals(ladder.btype);
  if (!sameType)   return false;
  boolean sequential=(i == ladder.to + 1);
  if (!sequential)   return false;
switch (btype) {
case parallel:
    if (j == ladder.lto + 1)     return true;
  break;
case antiparallel:
if (j == ladder.lfrom - 1) return true;
break;
}
return false;
}
Program: 16614
Project: 16614
Buggy source:
public static List<SecStrucElement> getSSE(Structure s){
  List<SecStrucElement> listSSE=new ArrayList<SecStrucElement>();
  GroupIterator iter=new GroupIterator(s);
  while (iter.hasNext()) {
    Group g=iter.next();
    if (g instanceof AminoAcid) {
      AminoAcid aa=(AminoAcid)g;
    }
  }
  return listSSE;
}

Fixed version (ground truth):
public static List<SecStrucElement> getSSE(Structure s){
  List<SecStrucElement> listSSE=new ArrayList<SecStrucElement>();
  GroupIterator iter=new GroupIterator(s);
  while (iter.hasNext()) {
    Group g=iter.next();
    if (g.hasAminoAtoms()) {
    }
  }
  return listSSE;
}
Program: 16615
Project: 16615
Buggy source:
@Test public void testDSSPParser() throws IOException, StructureException {
  List<String> names=Arrays.asList("String_Node_Str");
  for (  String name : names) {
    AtomCache cache=new AtomCache();
    Structure s=cache.getStructure(name);
    List<SecStrucState> file=DSSPParser.parseFile("String_Node_Str" + name + "String_Node_Str",s,false);
    List<SecStrucState> pdb=DSSPParser.fetch(name,s,false);
    SecStrucPred sec=new SecStrucPred();
    List<SecStrucState> pred=sec.predict(s,false);
    List<SecStrucState> parseBack=DSSPParser.parseString(sec.toString(),s,false);
    assertTrue("String_Node_Str",file.size() == pdb.size() && pred.size() == parseBack.size() && pred.size() == file.size());
    for (int i=0; i < file.size(); i++) {
      assertEquals("String_Node_Str" + i + "String_Node_Str",file.get(i),pdb.get(i));
      assertEquals("String_Node_Str" + i + "String_Node_Str",pred.get(i),parseBack.get(i));
      assertEquals("String_Node_Str" + i + "String_Node_Str",file.get(i),pred.get(i));
    }
  }
}

Fixed version (ground truth):
@Test public void testDSSPParser() throws IOException, StructureException {
  List<String> names=Arrays.asList("String_Node_Str");
  for (  String name : names) {
    AtomCache cache=new AtomCache();
    Structure s=cache.getStructure(name);
    List<SecStrucState> file=DSSPParser.parseFile("String_Node_Str" + name + "String_Node_Str",s,false);
    List<SecStrucState> pdb=DSSPParser.fetch(name,s,false);
    SecStrucPred sec=new SecStrucPred();
    List<SecStrucState> pred=sec.predict(s,false);
    List<SecStrucState> parseBack=DSSPParser.parseString(sec.toString(),s,false);
    assertTrue("String_Node_Str",file.size() == pdb.size() && pred.size() == parseBack.size() && pred.size() == file.size());
    for (int i=0; i < file.size(); i++) {
      assertEquals("String_Node_Str" + (i + 1) + "String_Node_Str",file.get(i),pdb.get(i));
      assertEquals("String_Node_Str" + (i + 1) + "String_Node_Str",pred.get(i),parseBack.get(i));
      assertEquals("String_Node_Str" + (i + 1) + "String_Node_Str",file.get(i),pred.get(i));
    }
  }
}
Program: 16616
Project: 16616
Buggy source:
@Test public void testSecStrucPred() throws StructureException, IOException {
  List<String> names=Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  for (  String name : names) {
    AtomCache cache=new AtomCache();
    Structure s=cache.getStructure(name);
    SecStrucPred sec=new SecStrucPred();
    List<SecStrucState> biojava=sec.predict(s,false);
    List<SecStrucState> dssp=DSSPParser.fetch(name,s,false);
    assertTrue("String_Node_Str",biojava.size() == dssp.size());
    for (int i=0; i < dssp.size(); i++) {
      assertEquals("String_Node_Str" + i + "String_Node_Str",biojava.get(i),dssp.get(i));
    }
  }
}

Fixed version (ground truth):
@Test public void testSecStrucPred() throws StructureException, IOException {
  List<String> names=Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  for (  String name : names) {
    AtomCache cache=new AtomCache();
    Structure s=cache.getStructure(name);
    SecStrucPred sec=new SecStrucPred();
    List<SecStrucState> biojava=sec.predict(s,false);
    System.out.println(sec);
    List<SecStrucState> dssp=DSSPParser.fetch(name,s,false);
    assertTrue("String_Node_Str",biojava.size() == dssp.size());
    for (int i=0; i < dssp.size(); i++) {
      assertEquals("String_Node_Str" + (i + 1) + "String_Node_Str",biojava.get(i),dssp.get(i));
    }
  }
}
Program: 16617
Project: 16617
Buggy source:
/** 
 * Detect helical turn patterns.
 */
private void calculateTurns(){
  for (int i=0; i < groups.length; i++) {
    for (int turn=3; turn <= 5; turn++) {
      if (i + turn >= groups.length)       continue;
      if (isBonded(i + turn,i)) {
        logger.debug("String_Node_Str" + i + "String_Node_Str"+ (i + turn)+ "String_Node_Str"+ turn);
        getSecStrucState(i).setTurn('>',turn);
        getSecStrucState(i + turn).setTurn('<',turn);
        for (int j=i + 1; j < i + turn; j++) {
          Integer t=turn;
          char helix=t.toString().charAt(0);
          getSecStrucState(j).setTurn(helix,turn);
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Detect helical turn patterns.
 */
private void calculateTurns(){
  for (int i=0; i < groups.length; i++) {
    for (int turn=3; turn <= 5; turn++) {
      if (i + turn >= groups.length)       continue;
      if (isBonded(i,i + turn)) {
        logger.debug("String_Node_Str" + i + "String_Node_Str"+ (i + turn)+ "String_Node_Str"+ turn);
        getSecStrucState(i).setTurn('>',turn);
        getSecStrucState(i + turn).setTurn('<',turn);
        for (int j=i + 1; j < i + turn; j++) {
          Integer t=turn;
          char helix=t.toString().charAt(0);
          getSecStrucState(j).setTurn(helix,turn);
        }
      }
    }
  }
}
Program: 16618
Project: 16618
Buggy source:
private void detectBends(){
  for (int i=2; i < groups.length - 2; i++) {
    SecStrucGroup im2=groups[i - 2];
    SecStrucGroup g=groups[i];
    SecStrucGroup ip2=groups[i + 2];
    Atom caim2=im2.getCA();
    Atom cag=g.getCA();
    Atom caip2=ip2.getCA();
    Atom caminus2=Calc.subtract(caim2,cag);
    Atom caplus2=Calc.subtract(cag,caip2);
    double angle=Calc.angle(caminus2,caplus2);
    SecStrucState state=getSecStrucState(i);
    state.setKappa((float)angle);
    if (angle > 70.0 && angle < 359.9) {
      if (state.getType().equals(SecStrucType.coil)) {
        state.setType(SecStrucType.bend);
      }
      state.setBend(true);
    }
  }
}

Fixed version (ground truth):
private void detectBends(){
  for (int i=2; i < groups.length - 2; i++) {
    boolean bonded=true;
    for (int k=0; k < 4; k++) {
      int index=i + k - 2;
      Atom C=groups[index].getC();
      Atom N=groups[index + 1].getN();
      if (Calc.getDistance(C,N) > MAX_PEPTIDE_BOND_LENGTH) {
        bonded=false;
        break;
      }
    }
    if (!bonded)     continue;
    SecStrucGroup im2=groups[i - 2];
    SecStrucGroup g=groups[i];
    SecStrucGroup ip2=groups[i + 2];
    Atom caim2=im2.getCA();
    Atom cag=g.getCA();
    Atom caip2=ip2.getCA();
    Atom caminus2=Calc.subtract(caim2,cag);
    Atom caplus2=Calc.subtract(cag,caip2);
    double angle=Calc.angle(caminus2,caplus2);
    SecStrucState state=getSecStrucState(i);
    state.setKappa((float)angle);
    if (angle > 70.0 && angle < 359.99) {
      setSecStrucType(i,SecStrucType.bend);
      state.setBend(true);
    }
  }
}
Program: 16619
Project: 16619
Buggy source:
private void checkSetTurns(){
  SecStrucType type=SecStrucType.turn;
  for (int idx=0; idx < 3; idx++) {
    for (int i=0; i < groups.length; i++) {
      SecStrucState state=getSecStrucState(i);
      char[] turn=state.getTurn();
      if (turn[idx] == '>') {
        if (!DSSP_HELICES)         setSecStrucType(i,type);
        setSecStrucType(i + 1,type);
        i+=2;
        SecStrucState nextState=getSecStrucState(i);
        char nturn=nextState.getTurn()[idx];
        boolean closing=false;
        boolean stop=false;
        while (!stop) {
          setSecStrucType(i - 1,type);
          i++;
          nextState=getSecStrucState(i);
          nturn=nextState.getTurn()[idx];
          if (!closing && nturn == '<')           closing=true;
          if (closing && nturn == '>')           stop=true;
          if (nturn == ' ')           stop=true;
        }
        if (!DSSP_HELICES)         setSecStrucType(i - 1,type);
      }
    }
  }
}

Fixed version (ground truth):
private void checkSetTurns(){
  SecStrucType type=SecStrucType.turn;
  for (int idx=0; idx < 3; idx++) {
    for (int i=0; i < groups.length; i++) {
      SecStrucState state=getSecStrucState(i);
      char[] turn=state.getTurn();
      if (turn[idx] == '>' || turn[idx] == 'X') {
        if (!DSSP_HELICES)         setSecStrucType(i,type);
        setSecStrucType(i + 1,type);
        i+=2;
        SecStrucState nextState=getSecStrucState(i);
        char nturn=nextState.getTurn()[idx];
        boolean closing=false;
        boolean stop=false;
        while (!stop) {
          setSecStrucType(i - 1,type);
          i++;
          nextState=getSecStrucState(i);
          nturn=nextState.getTurn()[idx];
          if (!closing && nturn == '<')           closing=true;
          if (closing && (nturn != '<' && nturn != 'X'))           stop=true;
          if (nturn == ' ')           stop=true;
        }
        i--;
        if (!DSSP_HELICES)         setSecStrucType(i,type);
        i-=2;
      }
    }
  }
}
Program: 16620
Project: 16620
Buggy source:
private boolean hasBulge(Ladder l1,Ladder l2){
  boolean bulge=((l1.btype.equals(l2.btype)) && (l2.from - l1.to < 6) && (l1.to < l2.from)&& (l2.connectedTo == 0));
  if (!bulge)   return bulge;
switch (l1.btype) {
case parallel:
    bulge=((l2.lfrom - l1.lto > 0) && (((l2.lfrom - l1.lto < 6) && (l2.from - l1.to < 3)) || (l2.lfrom - l1.lto < 3)));
  break;
case antiparallel:
bulge=((l1.lfrom - l2.lto > 0) && (((l1.lfrom - l2.lto < 6) && (l2.from - l1.to < 3)) || (l1.lfrom - l2.lto < 3)));
break;
}
return bulge;
}

Fixed version (ground truth):
/** 
 * For beta structures, we define explicitly: a bulge-linked  ladder consists of two (perfect) ladder or bridges of the  same type connected by at most one extra residue on one  strand and at most four extra residues on the other strand, all residues in bulge-linked ladders are marked "E," including the extra residues.
 */
private boolean hasBulge(Ladder l1,Ladder l2){
  boolean bulge=((l1.btype.equals(l2.btype)) && (l2.from - l1.to < 6) && (l1.to < l2.from)&& (l2.connectedTo == 0));
  if (!bulge)   return bulge;
switch (l1.btype) {
case parallel:
    bulge=((l2.lfrom - l1.lto > 0) && (((l2.lfrom - l1.lto < 6) && (l2.from - l1.to < 3)) || (l2.lfrom - l1.lto < 3)));
  break;
case antiparallel:
bulge=((l1.lfrom - l2.lto > 0) && (((l1.lfrom - l2.lto < 6) && (l2.from - l1.to < 3)) || (l1.lfrom - l2.lto < 3)));
break;
}
return bulge;
}
Program: 16621
Project: 16621
Buggy source:
/** 
 * Test if two groups are forming an H-Bond. The bond tested is from the NH of group i to the CO of group j. DSSP defines H-Bonds if the energy < -500 cal/mol.
 * @param one group one
 * @param two group two
 * @return flag if the two are forming an Hbond
 */
private boolean isBonded(int i,int j){
  SecStrucState stateOne=getSecStrucState(i);
  double acc1e=stateOne.getAccept1().getEnergy();
  double acc2e=stateOne.getAccept2().getEnergy();
  int partnerAcc1=stateOne.getAccept1().getPartner();
  int partnerAcc2=stateOne.getAccept2().getPartner();
  if (((partnerAcc1 == j) && (acc1e < HBONDHIGHENERGY)) || ((partnerAcc2 == j) && (acc2e < HBONDHIGHENERGY))) {
    logger.debug("String_Node_Str" + i + "String_Node_Str"+ j);
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Test if two groups are forming an H-Bond. The bond tested is from the CO of group i to the NH of group j. Acceptor (i) and donor (j). The donor of i has to be j, and the acceptor of j  has to be i. DSSP defines H-Bonds if the energy < -500 cal/mol.
 * @param one group one
 * @param two group two
 * @return flag if the two are forming an Hbond
 */
private boolean isBonded(int i,int j){
  SecStrucState one=getSecStrucState(i);
  SecStrucState two=getSecStrucState(j);
  double don1e=one.getDonor1().getEnergy();
  double don2e=one.getDonor2().getEnergy();
  double acc1e=two.getAccept1().getEnergy();
  double acc2e=two.getAccept2().getEnergy();
  int don1p=one.getDonor1().getPartner();
  int don2p=one.getDonor2().getPartner();
  int acc1p=two.getAccept1().getPartner();
  int acc2p=two.getAccept2().getPartner();
  boolean hbond=(don1p == j && don1e < HBONDHIGHENERGY) || (don2p == j && don2e < HBONDHIGHENERGY) || (acc1p == i && acc1e < HBONDHIGHENERGY)|| (acc2p == i && acc2e < HBONDHIGHENERGY);
  if (hbond) {
    logger.debug("String_Node_Str" + i + "String_Node_Str"+ j);
    return true;
  }
  return false;
}
Program: 16623
Project: 16623
Buggy source:
private void findBridges(int i){
  for (int j=i + 3; j < groups.length - 1; j++) {
    BridgeType btype=null;
    if ((isBonded(i - 1,j) && isBonded(j,i + 1)) || (isBonded(j - 1,i) && isBonded(i,j + 1))) {
      btype=BridgeType.parallel;
    }
 else     if ((isBonded(i,j) && isBonded(j,i)) || (isBonded(i - 1,j + 1) && (isBonded(j - 1,i + 1)))) {
      btype=BridgeType.antiparallel;
    }
    if (btype != null) {
      registerBridge(i,j,btype);
    }
  }
}

Fixed version (ground truth):
/** 
 * Two nonoverlapping stretches of three residues each, i-1,i,i+1 and j-1,j,j+1, form either a parallel or antiparallel bridge, depending on which of two basic patterns is matched. We assign a bridge between residues i and j if there are two H bonds characteristic of beta- structure; in particular: <p> Parallel Bridge(i,j) =: [Hbond(i-1,j) and Hbond(j,i+1)]  or [Hbond(j-1,i) and Hbond(i,j+1)] <p> Antiparallel Bridge(i,j) =: [Hbond(i,j) and Hbond(j,i)]  or [Hbond(i-1,j+1) and Hbond(j-1,i+1)]
 */
private void findBridges(int i){
  for (int j=i + 3; j < groups.length - 1; j++) {
    BridgeType btype=null;
    if ((isBonded(i - 1,j) && isBonded(j,i + 1)) || (isBonded(j - 1,i) && isBonded(i,j + 1))) {
      btype=BridgeType.parallel;
    }
 else     if ((isBonded(i,j) && isBonded(j,i)) || (isBonded(i - 1,j + 1) && (isBonded(j - 1,i + 1)))) {
      btype=BridgeType.antiparallel;
    }
    if (btype != null) {
      registerBridge(i,j,btype);
    }
  }
}
Program: 16624
Project: 16624
Buggy source:
private void registerBridge(int i,int j,BridgeType btype){
  if (i > j) {
    logger.error("String_Node_Str" + "String_Node_Str");
    int tmp=i;
    i=j;
    j=tmp;
  }
  BetaBridge bridge=new BetaBridge();
  bridge.partner1=i;
  bridge.partner2=j;
  bridge.type=btype;
  getSecStrucState(i).setBridge(bridge);
  getSecStrucState(j).setBridge(bridge);
  bridges.add(bridge);
}

Fixed version (ground truth):
private void registerBridge(int i,int j,BridgeType btype){
  BetaBridge bridge=new BetaBridge(i,j,btype);
  getSecStrucState(i).setBridge(bridge);
  getSecStrucState(j).setBridge(bridge);
  bridges.add(bridge);
}
Program: 16625
Project: 16625
Buggy source:
/** 
 * Calculate the HBonds between different groups. see Creighton page 147 f
 */
private void calculateHBonds() throws StructureException {
  if (groups.length < 5)   return;
  for (int i=1; i < groups.length; i++) {
    SecStrucGroup one=groups[i];
    if (!one.hasAtom("String_Node_Str")) {
      logger.warn("String_Node_Str" + one.getResidueNumber() + "String_Node_Str");
      continue;
    }
    for (int j=i + 1; j < groups.length; j++) {
      SecStrucGroup two=groups[j];
      double dist=Calc.getDistance(one.getCA(),two.getCA());
      if (dist >= CA_MIN_DIST)       continue;
      checkAddHBond(i,j);
      if (j != (i + 1))       checkAddHBond(j,i);
    }
  }
}

Fixed version (ground truth):
/** 
 * Calculate the HBonds between different groups. see Creighton page 147 f
 */
private void calculateHBonds() throws StructureException {
  if (groups.length < 5)   return;
  for (int i=0; i < groups.length; i++) {
    SecStrucGroup one=groups[i];
    for (int j=i + 1; j < groups.length; j++) {
      SecStrucGroup two=groups[j];
      double dist=Calc.getDistance(one.getCA(),two.getCA());
      if (dist >= CA_MIN_DIST)       continue;
      checkAddHBond(i,j);
      if (j != (i + 1))       checkAddHBond(j,i);
    }
  }
}
Program: 16626
Project: 16626
Buggy source:
/** 
 * Test if two groups are forming an H-Bond. DSSP defines H-Bonds if the energy < -500 cal/mol
 * @param one group one
 * @param two group two
 * @return flag if the two are forming an Hbond
 */
private boolean isBonded(int i,int j){
  Group one=groups[i];
  SecStrucState stateOne=(SecStrucState)one.getProperty(Group.SEC_STRUC);
  double acc1e=stateOne.getAccept1().getEnergy();
  double acc2e=stateOne.getAccept2().getEnergy();
  int partnerAcc1=stateOne.getAccept1().getPartner();
  int partnerAcc2=stateOne.getAccept2().getPartner();
  if (((partnerAcc1 == j) && (acc1e < HBONDHIGHENERGY)) || ((partnerAcc2 == j) && (acc2e < HBONDHIGHENERGY))) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Test if two groups are forming an H-Bond. DSSP defines H-Bonds if the energy < -500 cal/mol
 * @param one group one
 * @param two group two
 * @return flag if the two are forming an Hbond
 */
private boolean isBonded(int i,int j){
  Group one=groups[i];
  SecStrucState stateOne=(SecStrucState)one.getProperty(Group.SEC_STRUC);
  double acc1e=stateOne.getAccept1().getEnergy();
  double acc2e=stateOne.getAccept2().getEnergy();
  int partnerAcc1=stateOne.getAccept1().getPartner();
  int partnerAcc2=stateOne.getAccept2().getPartner();
  if (((partnerAcc1 == j) && (acc1e < HBONDHIGHENERGY)) || ((partnerAcc2 == j) && (acc2e < HBONDHIGHENERGY))) {
    logger.debug("String_Node_Str" + i + "String_Node_Str"+ j);
    return true;
  }
  return false;
}
Program: 16627
Project: 16627
Buggy source:
private void checkAddHBond(int i,int j){
  SecStrucGroup one=groups[i];
  if (one.getPDBName().equals("String_Node_Str")) {
    logger.debug("String_Node_Str" + one.getResidueNumber());
    return;
  }
  SecStrucGroup two=groups[j];
  if (!two.hasAtom("String_Node_Str")) {
    logger.warn("String_Node_Str" + two.getResidueNumber() + "String_Node_Str");
    return;
  }
  double energy=0;
  try {
    energy=calculateHBondEnergy(one,two);
  }
 catch (  Exception e) {
    logger.warn("String_Node_Str",e);
    return;
  }
  logger.debug("String_Node_Str" + i + "String_Node_Str"+ j+ "String_Node_Str"+ energy);
  trackHBondEnergy(i,j,energy);
}

Fixed version (ground truth):
private void checkAddHBond(int i,int j){
  SecStrucGroup one=groups[i];
  if (one.getPDBName().equals("String_Node_Str")) {
    logger.debug("String_Node_Str" + one.getResidueNumber());
    return;
  }
  if (!one.hasAtom("String_Node_Str")) {
    logger.warn("String_Node_Str" + one.getResidueNumber() + "String_Node_Str");
    return;
  }
  SecStrucGroup two=groups[j];
  double energy=0;
  try {
    energy=calculateHBondEnergy(one,two);
  }
 catch (  Exception e) {
    logger.warn("String_Node_Str",e);
    return;
  }
  logger.debug("String_Node_Str" + i + "String_Node_Str"+ j+ "String_Node_Str"+ energy);
  trackHBondEnergy(i,j,energy);
}
Program: 16628
Project: 16628
Buggy source:
/** 
 * Find valid symmetry orders for a given stoichiometry. For instance, an A6B4 protein would give [1,2] because (A6B4)1 and (A3B2)2 are valid decompositions.
 * @param stoichiometry List giving the number of copies in each chain cluster
 * @return The common factors of the stoichiometry
 */
public static List<Integer> getValidFolds(List<Integer> stoichiometry){
  List<Integer> denominators=new ArrayList<Integer>();
  int nChains=stoichiometry.size();
  Set<Integer> nominators=new TreeSet<Integer>(stoichiometry);
  for (int d=1; d <= nChains; d++) {
    int count=0;
    for (Iterator<Integer> iter=nominators.iterator(); iter.hasNext(); ) {
      if (iter.next() % d == 0) {
        count++;
      }
    }
    if (count == nominators.size()) {
      denominators.add(d);
    }
  }
  return denominators;
}

Fixed version (ground truth):
/** 
 * Find valid symmetry orders for a given stoichiometry. For instance, an A6B4 protein would give [1,2] because (A6B4)1 and (A3B2)2 are valid decompositions.
 * @param stoichiometry List giving the number of copies in each chain cluster
 * @return The common factors of the stoichiometry
 */
public static List<Integer> getValidFolds(List<Integer> stoichiometry){
  List<Integer> denominators=new ArrayList<Integer>();
  int nChains=Collections.max(stoichiometry);
  Set<Integer> nominators=new TreeSet<Integer>(stoichiometry);
  for (int d=1; d <= nChains; d++) {
    boolean isDivisable=true;
    for (    Integer n : nominators) {
      if (n % d != 0) {
        isDivisable=false;
        break;
      }
    }
    if (isDivisable) {
      denominators.add(d);
    }
  }
  return denominators;
}
Program: 16629
Project: 16629
Buggy source:
private void storeUnAlignedSeqRes(Structure structure,List<Chain> seqResChains){
  for (int i=0; i < structure.nrModels(); i++) {
    List<Chain> atomList=structure.getModel(i);
    for (    Chain seqRes : seqResChains) {
      Chain atomRes;
      atomRes=SeqRes2AtomAligner.getMatchingAtomRes(seqRes,atomList);
      atomRes.setSeqResGroups(seqRes.getAtomGroups());
    }
  }
}

Fixed version (ground truth):
private void storeUnAlignedSeqRes(Structure structure,List<Chain> seqResChains){
  for (int i=0; i < structure.nrModels(); i++) {
    List<Chain> atomList=structure.getModel(i);
    for (    Chain seqRes : seqResChains) {
      Chain atomRes;
      atomRes=SeqRes2AtomAligner.getMatchingAtomRes(seqRes,atomList);
      if (atomRes != null)       atomRes.setSeqResGroups(seqRes.getAtomGroups());
 else       logger.warn("String_Node_Str" + seqRes.getChainID());
    }
  }
}
Program: 16631
Project: 16631
Buggy source:
/** 
 * This method uses iteratively CeSymm to calculate all  symmetries in the input array of atoms and organize  them in a multiple alignment of the subunits.
 * @param atoms atoms 
 * @return MultipleAlignment of the subunits
 * @throws StructureException  
 */
public MultipleAlignment execute(Atom[] atoms) throws StructureException {
  allAtoms=atoms;
  for (Integer res=0; res < allAtoms.length; res++) {
    alignment.add(new ArrayList<Integer>());
  }
  iterate(atoms,0);
  buildAlignment();
  recoverAxes();
  try {
    SymmOptimizer optimizer=new SymmOptimizer(msa,axes,params,params.getSeed());
    msa=optimizer.optimize();
    msa.putScore("String_Node_Str",1.0);
  }
 catch (  RefinerFailedException e) {
    e.printStackTrace();
  }
  return msa;
}

Fixed version (ground truth):
/** 
 * This method uses iteratively CeSymm to calculate all  symmetries in the input array of atoms and organize  them in a multiple alignment of the subunits.
 * @param atoms atoms 
 * @return MultipleAlignment of the subunits
 * @throws StructureException  
 */
public MultipleAlignment execute(Atom[] atoms) throws StructureException {
  allAtoms=atoms;
  for (Integer res=0; res < allAtoms.length; res++) {
    alignment.add(new ArrayList<Integer>());
  }
  iterate(atoms,0);
  buildAlignment();
  recoverAxes();
  return msa;
}
Program: 16632
Project: 16632
Buggy source:
/** 
 * Returns true if the symmetry alignment has been refined,  false otherwise.  <p> For a refined alignment only one Block with no repeated  residues is necessary. Sufficient condition is not tested  (only known from the algorithm).
 * @param symm the symmetry alignment
 * @return true if the alignment is refined
 */
public static boolean isRefined(MultipleAlignment symm){
  if (symm.getScore("String_Node_Str") != null) {
    if (symm.getScore("String_Node_Str") > 0)     return true;
 else     return false;
  }
 else {
    if (symm.getBlocks().size() > 1) {
      symm.putScore("String_Node_Str",0.0);
      return false;
    }
 else {
      List<Integer> alreadySeen=new ArrayList<Integer>();
      List<List<Integer>> align=symm.getBlock(0).getAlignRes();
      for (int str=0; str < symm.size(); str++) {
        for (int res=0; res < align.get(str).size(); res++) {
          Integer residue=align.get(str).get(res);
          if (residue == null)           continue;
          if (alreadySeen.contains(residue)) {
            symm.putScore("String_Node_Str",0.0);
            return false;
          }
 else {
            alreadySeen.add(residue);
          }
        }
      }
      return true;
    }
  }
}

Fixed version (ground truth):
/** 
 * Returns true if the symmetry alignment has been refined,  false otherwise.  <p> For a refined alignment only one Block with no repeated  residues is necessary. Sufficient condition is not tested  (only known from the algorithm).
 * @param symm the symmetry alignment
 * @return true if the alignment is refined
 */
public static boolean isRefined(MultipleAlignment symm){
  if (symm.getScore("String_Node_Str") != null) {
    if (symm.getScore("String_Node_Str") > 0)     return true;
 else     return false;
  }
 else {
    if (symm.getBlocks().size() > 1) {
      symm.putScore("String_Node_Str",0.0);
      return false;
    }
 else     if (symm.size() < 2)     return false;
 else {
      List<Integer> alreadySeen=new ArrayList<Integer>();
      List<List<Integer>> align=symm.getBlock(0).getAlignRes();
      for (int str=0; str < symm.size(); str++) {
        for (int res=0; res < align.get(str).size(); res++) {
          Integer residue=align.get(str).get(res);
          if (residue == null)           continue;
          if (alreadySeen.contains(residue)) {
            symm.putScore("String_Node_Str",0.0);
            return false;
          }
 else {
            alreadySeen.add(residue);
          }
        }
      }
      return true;
    }
  }
}
Program: 16634
Project: 16634
Buggy source:
/** 
 * If available, get the list of subalignments.<p> Should be length one unless   {@link CESymmParameters#getMaxSymmOrder()}was set.
 * @return List of AFP alignments
 */
public List<AFPChain> getAfpAlignments(){
  return afpAlignments;
}

Fixed version (ground truth):
/** 
 * If available, get the list of subalignments.<p> Should be length one unless using the MULTIPLE refiner.
 * @return List of AFP alignments
 */
public List<AFPChain> getAfpAlignments(){
  return afpAlignments;
}
Program: 16638
Project: 16638
Buggy source:
public MultipleAlignment analyze(Atom[] atoms,CESymmParameters param) throws StructureException {
  if (atoms.length < 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.params=param;
  if (params.isMultipleAxes() && params.getRefineMethod() != RefineMethod.NOT_REFINED) {
    logger.warn("String_Node_Str");
    CeSymmIterative iterative=new CeSymmIterative(params.clone());
    msa=iterative.execute(atoms);
    axes=iterative.getSymmetryAxes();
    if (SymmetryTools.isRefined(msa)) {
      refined=true;
    }
 else {
      afpChain=align(atoms,atoms,params);
    }
  }
 else {
    afpChain=align(atoms,atoms,params);
  }
  if (refined) {
    if (msa == null)     msa=SymmetryTools.fromAFP(afpChain,ca1);
    msa.putScore("String_Node_Str",1.0);
    if (this.params.getOptimization()) {
      try {
        SymmOptimizer optimizer=new SymmOptimizer(msa,axes,params,params.getSeed());
        msa=optimizer.optimize();
      }
 catch (      RefinerFailedException e) {
        logger.warn("String_Node_Str",e);
      }
    }
  }
 else {
    MultipleAlignmentEnsemble e=new MultipleAlignmentEnsembleImpl(afpChain,ca1,ca1,false);
    msa=e.getMultipleAlignment(0);
    logger.warn("String_Node_Str");
    msa.putScore("String_Node_Str",0.0);
  }
  return msa;
}

Fixed version (ground truth):
public MultipleAlignment analyze(Atom[] atoms,CESymmParameters param) throws StructureException {
  if (atoms.length < 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.params=param;
  if (params.isMultipleAxes() && params.getRefineMethod() != RefineMethod.NOT_REFINED) {
    logger.warn("String_Node_Str");
    CeSymmIterative iterative=new CeSymmIterative(params.clone());
    msa=iterative.execute(atoms);
    axes=iterative.getSymmetryAxes();
    if (SymmetryTools.isRefined(msa)) {
      refined=true;
    }
 else {
      afpChain=align(atoms,atoms,params);
      msa=null;
    }
  }
 else {
    afpChain=align(atoms,atoms,params);
  }
  if (refined) {
    if (msa == null)     msa=SymmetryTools.fromAFP(afpChain,ca1);
    msa.putScore("String_Node_Str",1.0);
    if (this.params.getOptimization()) {
      try {
        SymmOptimizer optimizer=new SymmOptimizer(msa,axes,params,params.getSeed());
        msa=optimizer.optimize();
      }
 catch (      RefinerFailedException e) {
        logger.warn("String_Node_Str",e);
      }
    }
  }
 else {
    MultipleAlignmentEnsemble e=new MultipleAlignmentEnsembleImpl(afpChain,ca1,ca1,false);
    msa=e.getMultipleAlignment(0);
    logger.warn("String_Node_Str");
    msa.putScore("String_Node_Str",0.0);
  }
  return msa;
}
Program: 16639
Project: 16639
Buggy source:
/** 
 * For the iterative algorithm to work properly the refinement and  optimization options should be turned on, because the alignment has to be consistent at every recursive step.
 * @param params CeSymm parameters
 */
public CeSymmIterative(CESymmParameters params){
  this.params=params;
  params.setMultipleAxes(false);
  msa=new MultipleAlignmentImpl();
  msa.getEnsemble().setAtomArrays(new ArrayList<Atom[]>());
  msa.getEnsemble().setAlgorithmName(CeSymm.algorithmName);
  msa.getEnsemble().setVersion(CeSymm.version);
  msa.getEnsemble().setStructureNames(new ArrayList<String>());
  BlockSet bs=new BlockSetImpl(msa);
  Block b=new BlockImpl(bs);
  b.setAlignRes(new ArrayList<List<Integer>>());
  alignment=new ArrayList<List<Integer>>();
  levels=new ArrayList<MultipleAlignment>();
  axes=new SymmetryAxes();
  name=null;
}

Fixed version (ground truth):
/** 
 * For the iterative algorithm to work properly the refinement and  optimization options should be turned on, because the alignment has to be consistent at every recursive step.
 * @param params CeSymm parameters, make sure they are cloned
 */
public CeSymmIterative(CESymmParameters params){
  this.params=params;
  params.setMultipleAxes(false);
  msa=new MultipleAlignmentImpl();
  msa.getEnsemble().setAtomArrays(new ArrayList<Atom[]>());
  msa.getEnsemble().setAlgorithmName(CeSymm.algorithmName);
  msa.getEnsemble().setVersion(CeSymm.version);
  msa.getEnsemble().setStructureNames(new ArrayList<String>());
  BlockSet bs=new BlockSetImpl(msa);
  Block b=new BlockImpl(bs);
  b.setAlignRes(new ArrayList<List<Integer>>());
  alignment=new ArrayList<List<Integer>>();
  levels=new ArrayList<MultipleAlignment>();
  axes=new SymmetryAxes();
  name=null;
}
Program: 16641
Project: 16641
Buggy source:
public MultipleAlignment analyze(Atom[] atoms,CESymmParameters param) throws StructureException {
  if (atoms.length < 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.params=param;
  if (params.isMultipleAxes() && params.getRefineMethod() != RefineMethod.NOT_REFINED) {
    logger.warn("String_Node_Str");
    CeSymmIterative iterative=new CeSymmIterative(params.clone());
    msa=iterative.execute(atoms);
    axes=iterative.getSymmetryAxes();
    if (SymmetryTools.isRefined(msa)) {
      refined=true;
    }
 else {
      afpChain=align(atoms,atoms,params);
      msa=null;
    }
  }
 else {
    afpChain=align(atoms,atoms,params);
  }
  if (refined) {
    if (msa == null)     msa=SymmetryTools.fromAFP(afpChain,ca1);
    MultipleAlignmentScorer.calculateScores(msa);
    msa.putScore("String_Node_Str",1.0);
    if (this.params.getOptimization()) {
      try {
        SymmOptimizer optimizer=new SymmOptimizer(msa,axes,params,params.getSeed());
        msa=optimizer.optimize();
        msa.putScore("String_Node_Str",1.0);
      }
 catch (      RefinerFailedException e) {
        logger.warn("String_Node_Str",e);
      }
    }
  }
 else {
    MultipleAlignmentEnsemble e=new MultipleAlignmentEnsembleImpl(afpChain,ca1,ca1,false);
    msa=e.getMultipleAlignment(0);
    logger.warn("String_Node_Str");
    msa.putScore("String_Node_Str",0.0);
  }
  return msa;
}

Fixed version (ground truth):
public MultipleAlignment analyze(Atom[] atoms,CESymmParameters param) throws StructureException {
  if (atoms.length < 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.params=param;
  if (params.isMultipleAxes() && params.getRefineMethod() != RefineMethod.NOT_REFINED) {
    logger.warn("String_Node_Str");
    CeSymmIterative iterative=new CeSymmIterative(params.clone());
    msa=iterative.execute(atoms);
    axes=iterative.getSymmetryAxes();
    if (SymmetryTools.isRefined(msa)) {
      refined=true;
    }
 else {
      afpChain=align(atoms,atoms,params);
      msa=null;
    }
  }
 else {
    afpChain=align(atoms,atoms,params);
  }
  if (refined) {
    if (msa == null)     msa=SymmetryTools.fromAFP(afpChain,ca1);
    CoreSuperimposer imposer=new CoreSuperimposer();
    imposer.superimpose(msa);
    MultipleAlignmentScorer.calculateScores(msa);
    msa.putScore("String_Node_Str",1.0);
    if (this.params.getOptimization()) {
      try {
        SymmOptimizer optimizer=new SymmOptimizer(msa,axes,params,params.getSeed());
        msa=optimizer.optimize();
        msa.putScore("String_Node_Str",1.0);
      }
 catch (      RefinerFailedException e) {
        logger.warn("String_Node_Str",e);
      }
    }
  }
 else {
    MultipleAlignmentEnsemble e=new MultipleAlignmentEnsembleImpl(afpChain,ca1,ca1,false);
    msa=e.getMultipleAlignment(0);
    logger.warn("String_Node_Str");
    msa.putScore("String_Node_Str",0.0);
  }
  return msa;
}
Program: 16642
Project: 16642
Buggy source:
public static void main(String[] args) throws IOException, StructureException {
  String name="String_Node_Str";
  List<Atom[]> atoms=new ArrayList<Atom[]>();
  AtomCache cache=new AtomCache();
  Atom[] ca=cache.getAtoms(name);
  atoms.add(ca);
  CeSymm ceSymm=new CeSymm();
  CESymmParameters params=(CESymmParameters)ceSymm.getParameters();
  params.setRefineMethod(RefineMethod.SINGLE);
  params.setSymmetryType(SymmetryType.AUTO);
  params.setOptimization(true);
  params.setMultipleAxes(true);
  MultipleAlignment symmetry=ceSymm.align(atoms);
  System.out.println(MultipleAlignmentWriter.toFatCat(symmetry));
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException, StructureException {
  String name="String_Node_Str";
  List<Atom[]> atoms=new ArrayList<Atom[]>();
  AtomCache cache=new AtomCache();
  Structure s=cache.getStructure(name);
  Atom[] array=StructureTools.getRepresentativeAtomArray(s);
  atoms.add(array);
  CeSymm ceSymm=new CeSymm();
  CESymmParameters params=(CESymmParameters)ceSymm.getParameters();
  params.setRefineMethod(RefineMethod.SINGLE);
  params.setSymmetryType(SymmetryType.AUTO);
  params.setOptimization(true);
  params.setMultipleAxes(true);
  MultipleAlignment symmetry=ceSymm.align(atoms);
  System.out.println(MultipleAlignmentWriter.toFatCat(symmetry));
}
Program: 16643
Project: 16643
Buggy source:
public static void main(String[] args) throws IOException, StructureException, InterruptedException, ExecutionException {
  List<String> names=Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  AtomCache cache=new AtomCache();
  List<Atom[]> atomArrays=new ArrayList<Atom[]>();
  for (  String name : names) {
    atomArrays.add(cache.getAtoms(name));
  }
  MultipleMcMain algorithm=new MultipleMcMain(new CeCPMain());
  MultipleMcParameters params=(MultipleMcParameters)algorithm.getParameters();
  params.setMinBlockLen(10);
  MultipleAlignment result=algorithm.align(atomArrays);
  result.getEnsemble().setStructureNames(names);
  result.getEnsemble().setAlgorithmName(algorithm.getAlgorithmName());
  result.getEnsemble().setVersion(algorithm.getVersion());
  MultipleAlignmentDisplay.display(result);
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException, StructureException, InterruptedException, ExecutionException {
  List<String> names=Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  AtomCache cache=new AtomCache();
  List<Atom[]> atomArrays=new ArrayList<Atom[]>();
  for (  String name : names) {
    atomArrays.add(cache.getAtoms(name));
  }
  StructureAlignment pairwise=new FatCatFlexible();
  MultipleMcMain algorithm=new MultipleMcMain(pairwise);
  MultipleMcParameters params=(MultipleMcParameters)algorithm.getParameters();
  params.setMinBlockLen(10);
  params.setGapExtension(20.0);
  MultipleAlignment result=algorithm.align(atomArrays);
  result.getEnsemble().setStructureNames(names);
  result.getEnsemble().setAlgorithmName(algorithm.getAlgorithmName());
  result.getEnsemble().setVersion(algorithm.getVersion());
  MultipleAlignmentDisplay.display(result);
}
Program: 16644
Project: 16644
Buggy source:
public static void main(String[] args) throws IOException, StructureException, InterruptedException, ExecutionException {
  List<String> names=Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  AtomCache cache=new AtomCache();
  List<Atom[]> atomArrays=new ArrayList<Atom[]>();
  for (  String name : names) {
    atomArrays.add(cache.getAtoms(name));
  }
  MultipleMcMain algorithm=new MultipleMcMain(new CeCPMain());
  MultipleMcParameters params=(MultipleMcParameters)algorithm.getParameters();
  params.setMinBlockLen(15);
  params.setMinAlignedStructures(10);
  MultipleAlignment result=algorithm.align(atomArrays);
  result.getEnsemble().setStructureNames(names);
  result.getEnsemble().setAlgorithmName(algorithm.getAlgorithmName());
  result.getEnsemble().setVersion(algorithm.getVersion());
  System.out.println(MultipleAlignmentWriter.toFatCat(result));
  System.out.println(MultipleAlignmentWriter.toTransformMatrices(result));
  System.out.println(MultipleAlignmentWriter.toXML(result.getEnsemble()));
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException, StructureException, InterruptedException, ExecutionException {
  List<String> names=Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  AtomCache cache=new AtomCache();
  List<Atom[]> atomArrays=new ArrayList<Atom[]>();
  for (  String name : names) {
    atomArrays.add(cache.getAtoms(name));
  }
  MultipleMcMain algorithm=new MultipleMcMain(new CeMain());
  MultipleMcParameters params=(MultipleMcParameters)algorithm.getParameters();
  params.setMinBlockLen(15);
  params.setMinAlignedStructures(10);
  MultipleAlignment result=algorithm.align(atomArrays);
  result.getEnsemble().setStructureNames(names);
  result.getEnsemble().setAlgorithmName(algorithm.getAlgorithmName());
  result.getEnsemble().setVersion(algorithm.getVersion());
  System.out.println(MultipleAlignmentWriter.toFatCat(result));
  System.out.println(MultipleAlignmentWriter.toTransformMatrices(result));
  System.out.println(MultipleAlignmentWriter.toXML(result.getEnsemble()));
}
Program: 16646
Project: 16646
Buggy source:
@Override public void reset(){
  randomSeed=0;
  minBlockLen=10;
  minAlignedStructures=0;
  gapOpen=10.0;
  gapExtension=5.0;
  convergenceSteps=0;
  nrThreads=4;
}

Fixed version (ground truth):
@Override public void reset(){
  randomSeed=0;
  minBlockLen=10;
  minAlignedStructures=0;
  gapOpen=20.0;
  gapExtension=15.0;
  convergenceSteps=0;
  nrThreads=4;
}
Program: 16647
Project: 16647
Buggy source:
private void initResSerialsMap(Chain c){
  if (c.getSeqResGroups() == null || c.getSeqResGroups().isEmpty()) {
    logger.warn("String_Node_Str" + "String_Node_Str",c.getChainID());
    chains2pdbResNums2ResSerials.put(c.getChainID(),null);
    return;
  }
  Map<ResidueNumber,Integer> resNums2ResSerials=new HashMap<ResidueNumber,Integer>();
  chains2pdbResNums2ResSerials.put(c.getChainID(),resNums2ResSerials);
  for (int i=0; i < c.getSeqResGroups().size(); i++) {
    resNums2ResSerials.put(c.getSeqResGroup(i).getResidueNumber(),i + 1);
  }
}

Fixed version (ground truth):
private void initResSerialsMap(Chain c){
  if (c.getSeqResGroups() == null || c.getSeqResGroups().isEmpty()) {
    logger.warn("String_Node_Str" + "String_Node_Str",c.getChainID());
    chains2pdbResNums2ResSerials.put(c.getChainID(),null);
    return;
  }
  Map<ResidueNumber,Integer> resNums2ResSerials=new HashMap<ResidueNumber,Integer>();
  chains2pdbResNums2ResSerials.put(c.getChainID(),resNums2ResSerials);
  for (int i=0; i < c.getSeqResGroups().size(); i++) {
    ResidueNumber resNum=c.getSeqResGroup(i).getResidueNumber();
    if (resNum == null) {
      resNum=findResNumInOtherChains(i,c);
    }
    resNums2ResSerials.put(resNum,i + 1);
  }
}
Program: 16649
Project: 16649
Buggy source:
public void resetDisplay(){
  if (multAln != null) {
    String script=getJmolString(multAln,transformedAtoms,colorPalette,colorByBlocks.isSelected());
    evalString(script);
    jmolPanel.evalString("String_Node_Str");
  }
}

Fixed version (ground truth):
public void resetDisplay(){
  if (multAln != null && transformedAtoms != null) {
    String script=getJmolString(multAln,transformedAtoms,colorPalette,colorByBlocks.isSelected());
    evalString(script);
    jmolPanel.evalString("String_Node_Str");
  }
}
Program: 16651
Project: 16651
Buggy source:
/** 
 * Convert JAMA rotation and translation to a Vecmath transformation matrix
 * @param rot 3x3 Rotation matrix
 * @param trans 3x1 Translation matrix
 * @return 4x4 transformation matrix
 */
public static Matrix4d getTransformation(Matrix rot,Atom trans){
  return new Matrix4d(new Matrix3d(rot.getColumnPackedCopy()),new Vector3d(trans.getCoords()),1.0);
}

Fixed version (ground truth):
/** 
 * Convert JAMA rotation and translation to a Vecmath transformation matrix
 * @param rot 3x3 Rotation matrix
 * @param trans 3x1 Translation matrix
 * @return 4x4 transformation matrix
 */
public static Matrix4d getTransformation(Matrix rot,Atom trans){
  return new Matrix4d(new Matrix3d(rot.getRowPackedCopy()),new Vector3d(trans.getCoords()),1.0);
}
Program: 16653
Project: 16653
Buggy source:
public static void main(String[] args) throws IOException, StructureException, InterruptedException, ExecutionException {
  List<String> names=Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  AtomCache cache=new AtomCache();
  List<Atom[]> atomArrays=new ArrayList<Atom[]>();
  for (  String name : names) {
    atomArrays.add(cache.getAtoms(name));
  }
  CeMcMain algorithm=new CeMcMain();
  MultipleAlignment result=algorithm.align(atomArrays);
  result.getEnsemble().setStructureNames(names);
  result.getEnsemble().setAlgorithmName(algorithm.getAlgorithmName());
  result.getEnsemble().setVersion(algorithm.getVersion());
  MultipleAlignmentDisplay.display(result);
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException, StructureException, InterruptedException, ExecutionException {
  List<String> names=Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str");
  AtomCache cache=new AtomCache();
  List<Atom[]> atomArrays=new ArrayList<Atom[]>();
  for (  String name : names) {
    atomArrays.add(cache.getAtoms(name));
  }
  CeMcMain algorithm=new CeMcMain();
  MultipleAlignment result=algorithm.align(atomArrays);
  result.getEnsemble().setStructureNames(names);
  result.getEnsemble().setAlgorithmName(algorithm.getAlgorithmName());
  result.getEnsemble().setVersion(algorithm.getVersion());
  MultipleAlignmentDisplay.display(result);
}
Program: 16654
Project: 16654
Buggy source:
/** 
 * Get a collection of all scores which have been set
 * @return Set of all score names
 */
@Override public Set<String> getScores(){
  return Collections.unmodifiableSet(scores.keySet());
}

Fixed version (ground truth):
/** 
 * Get a collection of all scores which have been set
 * @return Set of all score names
 */
@Override public Set<String> getScores(){
  if (scores == null)   return Collections.emptySet();
  return Collections.unmodifiableSet(scores.keySet());
}
Program: 16655
Project: 16655
Buggy source:
/** 
 * Returns the double List containing the aligned residues for each structure. alignRes.get(structure).get(residue) = alignRes.get(size).get(length). <p> Initializes the variable if it is null.
 * @return List a double List of aligned residues for each structure.
 * @see #setAlignRes()
 */
public List<List<Integer>> getAlignRes();

Fixed version (ground truth):
/** 
 * Returns the double List containing the aligned residues for each structure. alignRes.get(structure).get(residue) = alignRes.get(size).get(length).
 * @return List a double List of aligned residues for each structure.
 * @see #setAlignRes()
 */
public List<List<Integer>> getAlignRes();
Program: 16656
Project: 16656
Buggy source:
@Override public List<List<Integer>> getAlignRes(){
  if (alignRes == null)   alignRes=new ArrayList<List<Integer>>();
  return alignRes;
}

Fixed version (ground truth):
@Override public List<List<Integer>> getAlignRes(){
  return alignRes;
}
Program: 16657
Project: 16657
Buggy source:
/** 
 * Add a new multiple alignment to the end of the ensemble and set its ensemble to this.
 * @param alignment
 */
public void addMultipleAlignment(MultipleAlignment alignment);

Fixed version (ground truth):
/** 
 * Add a new MultipleAlignment to the end of the ensemble and set its parent ensemble to this.
 * @param alignment
 */
public void addMultipleAlignment(MultipleAlignment alignment);
Program: 16658
Project: 16658
Buggy source:
/** 
 * Clear scores and distance matrix. Recursively clears member alignments.
 */
@Override public void clear(){
  super.clear();
  distanceMatrix=null;
  for (  MultipleAlignment a : getMultipleAlignments()) {
    a.clear();
  }
}

Fixed version (ground truth):
@Override public void clear(){
  super.clear();
  distanceMatrix=null;
  for (  MultipleAlignment a : getMultipleAlignments()) {
    a.clear();
  }
}
Program: 16659
Project: 16659
Buggy source:
@Override public List<Matrix> getDistanceMatrix(){
  if (distanceMatrix == null)   updateDistanceMatrix();
  return distanceMatrix;
}

Fixed version (ground truth):
@Override public List<Matrix> getDistanceMatrix(){
  return distanceMatrix;
}