nus-yam/ex-repair huggingface dataset:
Program: 16660
Project: 16660
Buggy source:
/** 
 * Add a new multiple alignment to the end of the ensemble and set its ensemble to this.
 * @param alignment
 */
@Override public void addMultipleAlignment(MultipleAlignment alignment){
  multipleAlignments.add(alignment);
  alignment.setEnsemble(this);
}

Fixed version (ground truth):
@Override public void addMultipleAlignment(MultipleAlignment alignment){
  if (multipleAlignments == null)   multipleAlignments=new ArrayList<MultipleAlignment>();
  multipleAlignments.add(alignment);
  alignment.setEnsemble(this);
}
Program: 16662
Project: 16662
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));
  }
  MultipleMcMain algorithm=new MultipleMcMain();
  MultipleMcParameters params=(MultipleMcParameters)algorithm.getParameters();
  params.setPairwiseAlgorithm(CeCPMain.algorithmName);
  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));
  }
  MultipleMcMain algorithm=new MultipleMcMain();
  MultipleMcParameters params=(MultipleMcParameters)algorithm.getParameters();
  params.setPairwiseAlgorithm(CeCPMain.algorithmName);
  MultipleAlignment result=algorithm.align(atomArrays);
  result.getEnsemble().setStructureNames(names);
  result.getEnsemble().setAlgorithmName(algorithm.getAlgorithmName());
  result.getEnsemble().setVersion(algorithm.getVersion());
  MultipleAlignmentDisplay.display(result);
}
Program: 16664
Project: 16664
Buggy source:
/** 
 * Insert a gap in one of the structures in a random position in the alignment. The random distribution is not uniform, positions with higher distance are more likely to be gapped. A gap is a null in the Block position.
 */
private boolean insertGap(){
  Matrix residueDistances=MultipleAlignmentTools.getAverageResidueDistances(msa);
  double maxDist=Double.MIN_VALUE;
  int structure=0;
  int block=0;
  int position=0;
  int column=0;
  for (int b=0; b < blockNr; b++) {
    for (int col=0; col < msa.getBlocks().get(b).length(); col++) {
      for (int str=0; str < size; str++) {
        if (residueDistances.get(str,column) != -1) {
          if (residueDistances.get(str,column) > maxDist) {
            if (rnd.nextDouble() > 0.5) {
              structure=str;
              block=b;
              position=col;
            }
          }
        }
      }
      column++;
    }
  }
  if (msa.getBlocks().get(block).length() <= Lmin)   return false;
  Integer residueL=msa.getBlocks().get(block).getAlignRes().get(structure).get(position);
  if (residueL != null)   freePool.get(structure).add(residueL);
 else   return false;
  msa.getBlocks().get(block).getAlignRes().get(structure).set(position,null);
  checkGaps();
  return true;
}

Fixed version (ground truth):
/** 
 * Insert a gap in one of the structures in a random position in the alignment. The random distribution is not uniform, positions with higher distance are more likely to be gapped. A gap is a null in the Block position.
 */
private boolean insertGap(){
  Matrix residueDistances=MultipleAlignmentTools.getAverageResidueDistances(msa);
  double maxDist=Double.MIN_VALUE;
  int structure=0;
  int block=0;
  int position=0;
  int column=0;
  for (int b=0; b < blockNr; b++) {
    for (int col=0; col < msa.getBlocks().get(b).length(); col++) {
      for (int str=0; str < size; str++) {
        if (residueDistances.get(str,column) != -1) {
          if (residueDistances.get(str,column) > maxDist) {
            if (rnd.nextDouble() > 0.5) {
              structure=str;
              block=b;
              position=col;
              maxDist=residueDistances.get(str,column);
            }
          }
        }
      }
      column++;
    }
  }
  if (msa.getBlocks().get(block).length() <= Lmin)   return false;
  Integer residueL=msa.getBlocks().get(block).getAlignRes().get(structure).get(position);
  if (residueL != null)   freePool.get(structure).add(residueL);
 else   return false;
  msa.getBlocks().get(block).getAlignRes().get(structure).set(position,null);
  checkGaps();
  return true;
}
Program: 16665
Project: 16665
Buggy source:
/** 
 * Return the Compound for this chain.
 * @return the Compound object 
 * @see #setCompound(Compound)
 */
public Compound getCompound();

Fixed version (ground truth):
/** 
 * Returns the Compound for this chain.
 * @return the Compound object 
 * @see #setCompound(Compound)
 */
public Compound getCompound();
Program: 16666
Project: 16666
Buggy source:
/** 
 * Return the sequence of amino acids as it has been provided in the ATOM records.
 * @return amino acid sequence as string
 * @see #getSeqResSequence()
 */
public String getAtomSequence();

Fixed version (ground truth):
/** 
 * Returns the sequence of amino acids as it has been provided in the ATOM records. Non-standard residues will be present in the string only if the property   {@value PDBFileReader#LOAD_CHEM_COMP_PROPERTY} has been set.
 * @return amino acid sequence as string
 * @see #getSeqResSequence()
 */
public String getAtomSequence();
Program: 16667
Project: 16667
Buggy source:
/** 
 * Get the Swissprot id of this chain.
 * @return a String representing the swissprot id value
 * @see #setSwissprotId(String sp_id)
 */
public String getSwissprotId();

Fixed version (ground truth):
/** 
 * Gets the Swissprot id of this chain.
 * @return a String representing the swissprot id value
 * @see #setSwissprotId(String sp_id)
 */
public String getSwissprotId();
Program: 16668
Project: 16668
Buggy source:
/** 
 * Set the Compound
 * @param compound the Compound 
 * @see #getCompound()
 */
public void setCompound(Compound compound);

Fixed version (ground truth):
/** 
 * Sets the Compound
 * @param compound the Compound 
 * @see #getCompound()
 */
public void setCompound(Compound compound);
Program: 16669
Project: 16669
Buggy source:
/** 
 * Return the number of groups in the SEQRES records of the chain, i.e. the number of aminoacids/nucleotides in the construct 
 * @return the length
 * @see #getSeqResGroup(int)
 * @see #getSeqResGroups()
 * @see #getAtomLength()
 */
public int getSeqResLength();

Fixed version (ground truth):
/** 
 * Returns the number of groups in the SEQRES records of the chain, i.e. the number of aminoacids/nucleotides in the construct 
 * @return the length
 * @see #getSeqResGroup(int)
 * @see #getSeqResGroups()
 * @see #getAtomLength()
 */
public int getSeqResLength();
Program: 16670
Project: 16670
Buggy source:
/** 
 * Return the number of Groups with observed density in the chain, i.e.  those with coordinates in ATOM and HETATMs (including waters) records
 * @return the length
 * @see #getAtomGroup(int)
 * @see #getAtomGroups()
 * @see #getSeqResLength()) 
 */
public int getAtomLength();

Fixed version (ground truth):
/** 
 * Returns the number of Groups with observed density in the chain, i.e.  those with coordinates in ATOM and HETATMs (including waters) records
 * @return the length
 * @see #getAtomGroup(int)
 * @see #getAtomGroups()
 * @see #getSeqResLength()) 
 */
public int getAtomLength();
Program: 16671
Project: 16671
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public String getSeqResSequence(){
  String prop=System.getProperty(PDBFileReader.LOAD_CHEM_COMP_PROPERTY);
  if (prop != null && prop.equalsIgnoreCase("String_Node_Str")) {
    StringBuilder str=new StringBuilder();
    for (    Group g : seqResGroups) {
      ChemComp cc=g.getChemComp();
      if (cc == null) {
        logger.warn("String_Node_Str",g);
        str.append("String_Node_Str");
      }
 else       if (PolymerType.PROTEIN_ONLY.contains(cc.getPolymerType()) || PolymerType.POLYNUCLEOTIDE_ONLY.contains(cc.getPolymerType())) {
        String oneLetter=ChemCompGroupFactory.getOneLetterCode(cc);
        if (oneLetter == null || oneLetter.isEmpty() || oneLetter.equals("String_Node_Str"))         oneLetter="String_Node_Str";
        str.append(oneLetter);
      }
 else {
        str.append("String_Node_Str");
      }
    }
    return str.toString();
  }
  StringBuilder str=new StringBuilder();
  for (  Group group : seqResGroups) {
    if (group instanceof AminoAcid) {
      AminoAcid aa=(AminoAcid)group;
      str.append(aa.getAminoType());
    }
 else {
      str.append("String_Node_Str");
    }
  }
  return str.toString();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public String getSeqResSequence(){
  String prop=System.getProperty(PDBFileReader.LOAD_CHEM_COMP_PROPERTY);
  if (prop != null && prop.equalsIgnoreCase("String_Node_Str")) {
    logger.info("String_Node_Str",PDBFileReader.LOAD_CHEM_COMP_PROPERTY);
    StringBuilder str=new StringBuilder();
    for (    Group g : seqResGroups) {
      ChemComp cc=g.getChemComp();
      if (cc == null) {
        logger.warn("String_Node_Str",g);
        str.append("String_Node_Str");
      }
 else       if (PolymerType.PROTEIN_ONLY.contains(cc.getPolymerType()) || PolymerType.POLYNUCLEOTIDE_ONLY.contains(cc.getPolymerType())) {
        String oneLetter=ChemCompGroupFactory.getOneLetterCode(cc);
        if (oneLetter == null || oneLetter.isEmpty() || oneLetter.equals("String_Node_Str"))         oneLetter=Character.toString(StructureTools.UNKNOWN_GROUP_LABEL);
        str.append(oneLetter);
      }
 else {
        str.append(StructureTools.UNKNOWN_GROUP_LABEL);
      }
    }
    return str.toString();
  }
  logger.info("String_Node_Str",PDBFileReader.LOAD_CHEM_COMP_PROPERTY);
  StringBuilder str=new StringBuilder();
  for (  Group group : seqResGroups) {
    if (group instanceof AminoAcid) {
      AminoAcid aa=(AminoAcid)group;
      str.append(aa.getAminoType());
    }
 else {
      str.append(StructureTools.UNKNOWN_GROUP_LABEL);
    }
  }
  return str.toString();
}
Program: 16672
Project: 16672
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public String getAtomSequence(){
  String prop=System.getProperty(PDBFileReader.LOAD_CHEM_COMP_PROPERTY);
  if (prop != null && prop.equalsIgnoreCase("String_Node_Str")) {
    List<Group> groups=getAtomGroups();
    StringBuilder sequence=new StringBuilder();
    for (    Group g : groups) {
      ChemComp cc=g.getChemComp();
      if (PolymerType.PROTEIN_ONLY.contains(cc.getPolymerType()) || PolymerType.POLYNUCLEOTIDE_ONLY.contains(cc.getPolymerType())) {
        String oneLetter=ChemCompGroupFactory.getOneLetterCode(cc);
        if (oneLetter == null)         oneLetter="String_Node_Str";
        sequence.append(oneLetter);
      }
    }
    return sequence.toString();
  }
  List<Group> aminos=getAtomGroups(GroupType.AMINOACID);
  StringBuilder sequence=new StringBuilder();
  for (  Group amino : aminos) {
    AminoAcid a=(AminoAcid)amino;
    sequence.append(a.getAminoType());
  }
  return sequence.toString();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public String getAtomSequence(){
  String prop=System.getProperty(PDBFileReader.LOAD_CHEM_COMP_PROPERTY);
  if (prop != null && prop.equalsIgnoreCase("String_Node_Str")) {
    logger.info("String_Node_Str",PDBFileReader.LOAD_CHEM_COMP_PROPERTY);
    List<Group> groups=getAtomGroups();
    StringBuilder sequence=new StringBuilder();
    for (    Group g : groups) {
      ChemComp cc=g.getChemComp();
      if (PolymerType.PROTEIN_ONLY.contains(cc.getPolymerType()) || PolymerType.POLYNUCLEOTIDE_ONLY.contains(cc.getPolymerType())) {
        String oneLetter=ChemCompGroupFactory.getOneLetterCode(cc);
        if (oneLetter == null)         oneLetter=Character.toString(StructureTools.UNKNOWN_GROUP_LABEL);
        sequence.append(oneLetter);
      }
    }
    return sequence.toString();
  }
  logger.info("String_Node_Str",PDBFileReader.LOAD_CHEM_COMP_PROPERTY);
  List<Group> aminos=getAtomGroups(GroupType.AMINOACID);
  StringBuilder sequence=new StringBuilder();
  for (  Group amino : aminos) {
    if (amino instanceof AminoAcid) {
      AminoAcid a=(AminoAcid)amino;
      sequence.append(a.getAminoType());
    }
 else {
      logger.warn("String_Node_Str",amino.toString());
    }
  }
  return sequence.toString();
}
Program: 16673
Project: 16673
Buggy source:
/** 
 * Convert the SEQRES groups of a Chain to a Biojava Sequence object.
 * @return the SEQRES groups of the Chain as a Sequence object.
 */
@Override public Sequence<?> getBJSequence(){
  String seq=getSeqResSequence();
  Sequence<AminoAcidCompound> s=null;
  try {
    s=new ProteinSequence(seq);
  }
 catch (  CompoundNotFoundException e) {
    logger.error("String_Node_Str",e.getMessage());
  }
  return s;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
@Override public Sequence<?> getBJSequence(){
  String seq=getSeqResSequence();
  Sequence<AminoAcidCompound> s=null;
  try {
    s=new ProteinSequence(seq);
  }
 catch (  CompoundNotFoundException e) {
    logger.error("String_Node_Str",e.getMessage());
  }
  return s;
}
Program: 16674
Project: 16674
Buggy source:
private static void downloadChemCompRecord(String recordName){
  String localName=getLocalFileName(recordName);
  String u=SERVER_LOCATION + recordName + "String_Node_Str";
  try {
    URL url=new URL(u);
    HttpURLConnection uconn=HTTPConnectionTools.openHttpURLConnection(url);
    InputStream conn=uconn.getInputStream();
    FileOutputStream outPut=new FileOutputStream(localName);
    GZIPOutputStream gzOutPut=new GZIPOutputStream(outPut);
    PrintWriter pw=new PrintWriter(gzOutPut);
    BufferedReader fileBuffer=new BufferedReader(new InputStreamReader(conn));
    String line;
    while ((line=fileBuffer.readLine()) != null) {
      pw.println(line);
    }
    pw.flush();
    pw.close();
    outPut.close();
    conn.close();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
private static void downloadChemCompRecord(String recordName){
  String localName=getLocalFileName(recordName);
  String u=SERVER_LOCATION + recordName + "String_Node_Str";
  URL url=null;
  try {
    url=new URL(u);
    HttpURLConnection uconn=HTTPConnectionTools.openHttpURLConnection(url);
    InputStream conn=uconn.getInputStream();
    FileOutputStream outPut=new FileOutputStream(localName);
    GZIPOutputStream gzOutPut=new GZIPOutputStream(outPut);
    PrintWriter pw=new PrintWriter(gzOutPut);
    BufferedReader fileBuffer=new BufferedReader(new InputStreamReader(conn));
    String line;
    while ((line=fileBuffer.readLine()) != null) {
      pw.println(line);
    }
    pw.flush();
    pw.close();
    outPut.close();
    conn.close();
  }
 catch (  IOException e) {
    logger.error("String_Node_Str" + url.toString() + "String_Node_Str"+ localName,e);
  }
}
Program: 16675
Project: 16675
Buggy source:
/** 
 * Loads the definitions for this   {@link ChemComp} from a local file and instantiates a new object.
 * @param recordName the ID of the {@link ChemComp}
 * @return a new {@link ChemComp} definition.
 */
@Override public ChemComp getChemComp(String recordName){
  recordName=recordName.toUpperCase().trim();
  if (recordName.equals("String_Node_Str")) {
    return null;
  }
  try {
    if (!fileExists(recordName)) {
      checkDoFirstInstall();
    }
    if (!fileExists(recordName)) {
      downloadChemCompRecord(recordName);
    }
    String filename=getLocalFileName(recordName);
    InputStreamProvider isp=new InputStreamProvider();
    InputStream inStream=isp.getInputStream(filename);
    MMcifParser parser=new SimpleMMcifParser();
    ChemCompConsumer consumer=new ChemCompConsumer();
    parser.addMMcifConsumer(consumer);
    parser.parse(new BufferedReader(new InputStreamReader(inStream)));
    ChemicalComponentDictionary dict=consumer.getDictionary();
    ChemComp chemComp=dict.getChemComp(recordName);
    return chemComp;
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Loads the definitions for this   {@link ChemComp} from a local file and instantiates a new object.
 * @param recordName the ID of the {@link ChemComp}
 * @return a new {@link ChemComp} definition.
 */
@Override public ChemComp getChemComp(String recordName){
  recordName=recordName.toUpperCase().trim();
  if (recordName.equals("String_Node_Str")) {
    return null;
  }
  if (!fileExists(recordName)) {
    checkDoFirstInstall();
  }
  if (!fileExists(recordName)) {
    downloadChemCompRecord(recordName);
  }
  String filename=getLocalFileName(recordName);
  try {
    InputStreamProvider isp=new InputStreamProvider();
    InputStream inStream=isp.getInputStream(filename);
    MMcifParser parser=new SimpleMMcifParser();
    ChemCompConsumer consumer=new ChemCompConsumer();
    parser.addMMcifConsumer(consumer);
    parser.parse(new BufferedReader(new InputStreamReader(inStream)));
    ChemicalComponentDictionary dict=consumer.getDictionary();
    ChemComp chemComp=dict.getChemComp(recordName);
    return chemComp;
  }
 catch (  IOException e) {
    logger.error("String_Node_Str" + filename,e);
  }
  return null;
}
Program: 16676
Project: 16676
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","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","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);
}
Program: 16678
Project: 16678
Buggy source:
/** 
 * Insert a gap in one of the structures in a random position in the alignment. A gap is a null in the Block position.
 */
private boolean insertGap(){
  int str=rnd.nextInt(size);
  int bk=rnd.nextInt(blockNr);
  int res=rnd.nextInt(block.getBlocks().get(bk).length());
  Integer residueL=block.getBlocks().get(bk).getAlignRes().get(str).get(res);
  if (residueL != null)   freePool.get(str).add(residueL);
 else   return false;
  block.getBlocks().get(bk).getAlignRes().get(str).set(res,null);
  checkGaps();
  return true;
}

Fixed version (ground truth):
/** 
 * Insert a gap in one of the structures in a random position in the alignment. A gap is a null in the Block position.
 */
private boolean insertGap(){
  int str=rnd.nextInt(size);
  int bk=rnd.nextInt(blockNr);
  if (block.getBlocks().get(bk).length() <= Lmin)   return false;
  int res=rnd.nextInt(block.getBlocks().get(bk).length());
  Integer residueL=block.getBlocks().get(bk).getAlignRes().get(str).get(res);
  if (residueL != null)   freePool.get(str).add(residueL);
 else   return false;
  block.getBlocks().get(bk).getAlignRes().get(str).set(res,null);
  checkGaps();
  return true;
}
Program: 16680
Project: 16680
Buggy source:
@Test public void testFASTA(){
}

Fixed version (ground truth):
@Test public void testFASTA() throws StructureException, IOException {
  MultipleAlignment alignment=generateTestMultipleAlignment();
  String result=MultipleAlignmentWriter.toFASTA(alignment);
  System.out.println(result);
  StringBuffer expected=new StringBuffer();
  expected.append("String_Node_Str");
  expected.append("String_Node_Str");
  expected.append("String_Node_Str");
  expected.append("String_Node_Str");
  expected.append("String_Node_Str");
  expected.append("String_Node_Str");
  assertEquals(result,expected.toString());
}
Program: 16682
Project: 16682
Buggy source:
/** 
 * returns if the Connections should be added default is true;
 * @return if the printConnections flag is set
 */
public boolean doPrintConnections(){
  return printConnections;
}

Fixed version (ground truth):
/** 
 * Returns if the Connections should be added default is true;
 * @return if the printConnections flag is set
 */
public boolean doPrintConnections(){
  return printConnections;
}
Program: 16685
Project: 16685
Buggy source:
/** 
 * Return a list of pdb Strings corresponding to the aligned positions of the molecule. <p>  Adapted the method to a more general version for the multiple alignments,  using the MultipleAlignment DS.
 * @param aligPos
 * @param multAln
 * @param ca
 */
public static final List<String> getPDBresnum(int structNum,MultipleAlignment multAln,Atom[] ca){
  List<String> lst=new ArrayList<String>();
  for (  BlockSet bs : multAln.getBlockSets()) {
    for (    Block block : bs.getBlocks()) {
      for (int i=0; i < block.length(); i++) {
        Integer pos=block.getAlignRes().get(structNum).get(i);
        if (pos == null)         continue;
 else         if (pos < ca.length) {
          String pdbInfo=JmolTools.getPdbInfo(ca[pos]);
          lst.add(pdbInfo);
        }
      }
    }
  }
  return lst;
}

Fixed version (ground truth):
/** 
 * Return a list of pdb Strings corresponding to the aligned positions of the molecule.  Only supports a pairwise alignment with the AFPChain DS.
 * @param aligPos
 * @param afpChain
 * @param ca
 */
public static final List<String> getPDBresnum(int aligPos,AFPChain afpChain,Atom[] ca){
  List<String> lst=new ArrayList<String>();
  if (aligPos > 1) {
    System.err.println("String_Node_Str");
    return lst;
  }
  int blockNum=afpChain.getBlockNum();
  int[] optLen=afpChain.getOptLen();
  int[][][] optAln=afpChain.getOptAln();
  if (optLen == null)   return lst;
  for (int bk=0; bk < blockNum; bk++) {
    for (int i=0; i < optLen[bk]; i++) {
      int pos=optAln[bk][aligPos][i];
      if (pos < ca.length) {
        String pdbInfo=JmolTools.getPdbInfo(ca[pos]);
        lst.add(pdbInfo);
      }
    }
  }
  return lst;
}
Program: 16686
Project: 16686
Buggy source:
/** 
 * Given an aligned position in the sequence alignment, it returns the Atom that corresponds. It does not support gaps in the multiple alignment right now!
 * @param multAln the alignment information
 * @param str the structure
 * @param pos the position in the sequence alignment
 * @return Atom the aligned atom
 * @throws StructureAlignmentException if the atoms cannot be obtained
 */
@Deprecated public static Atom getAtomForAligPos(MultipleAlignment multAln,int str,int pos) throws StructureAlignmentException {
  List<Integer> residues=new ArrayList<Integer>();
  for (  BlockSet bs : multAln.getBlockSets()) {
    for (    Block b : bs.getBlocks())     residues.addAll(b.getAlignRes().get(str));
  }
  if (residues.size() == 0)   return null;
  String sequence=MultipleAlignmentTools.getSequenceAlignment(multAln).get(str);
  int aligpos=0;
  for (int i=0; i < pos; i++) {
    if (sequence.charAt(i) != '-')     aligpos++;
  }
  int capos=residues.get(aligpos);
  if (capos < 0 || capos > multAln.getEnsemble().getAtomArrays().get(str).length)   return null;
  return multAln.getEnsemble().getAtomArrays().get(str)[capos];
}

Fixed version (ground truth):
/** 
 * return the atom at alignment position aligPos. at the present only works with block 0
 * @param chainNr the number of the aligned pair. 0... first chain, 1... second chain.
 * @param afpChain an afpChain object
 * @param aligPos position on the alignment
 * @param getPrevious gives the previous position if false, gives the next posible atom
 * @return a CA atom that is at a particular position of the alignment 
 */
public static final Atom getAtomForAligPos(AFPChain afpChain,int chainNr,int aligPos,Atom[] ca,boolean getPrevious) throws StructureException {
  int[] optLen=afpChain.getOptLen();
  if (optLen == null)   return null;
  if (chainNr < 0 || chainNr > 1) {
    throw new StructureException("String_Node_Str" + chainNr);
  }
  int capos=getUngappedFatCatPos(afpChain,chainNr,aligPos);
  if (capos < 0) {
    capos=getNextFatCatPos(afpChain,chainNr,aligPos,getPrevious);
  }
 else {
  }
  if (capos < 0) {
    System.err.println("String_Node_Str" + aligPos + "String_Node_Str"+ chainNr+ "String_Node_Str");
    return null;
  }
  if (capos > ca.length) {
    System.err.println("String_Node_Str" + chainNr + "String_Node_Str"+ capos+ "String_Node_Str");
    return null;
  }
  return ca[capos];
}
Program: 16687
Project: 16687
Buggy source:
@Override public void actionPerformed(ActionEvent e){
  String cmd=e.getActionCommand();
  if (cmd.equals(MenuCreator.TEXT_ONLY)) {
    if (multAln == null) {
      System.err.println("String_Node_Str");
      return;
    }
    System.out.println("String_Node_Str");
  }
 else   if (cmd.equals(MenuCreator.PAIRS_ONLY)) {
    if (multAln == null) {
      System.err.println("String_Node_Str");
      return;
    }
    System.out.println("String_Node_Str");
  }
 else   if (cmd.equals(MenuCreator.ALIGNMENT_PANEL)) {
    if (multAln == null) {
      System.err.println("String_Node_Str");
      return;
    }
    try {
      DisplayAFP.showAlignmentImage(multAln,this,colors);
    }
 catch (    StructureAlignmentException e1) {
      e1.printStackTrace();
    }
catch (    StructureException e1) {
      e1.printStackTrace();
    }
  }
 else   if (cmd.equals(MenuCreator.FATCAT_TEXT)) {
    if (multAln == null) {
      System.err.println("String_Node_Str");
      return;
    }
    System.out.println("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent e){
  String cmd=e.getActionCommand();
  if (cmd.equals(MenuCreator.TEXT_ONLY)) {
    if (multAln == null) {
      System.err.println("String_Node_Str");
      return;
    }
    System.out.println("String_Node_Str");
  }
 else   if (cmd.equals(MenuCreator.PAIRS_ONLY)) {
    if (multAln == null) {
      System.err.println("String_Node_Str");
      return;
    }
    System.out.println("String_Node_Str");
  }
 else   if (cmd.equals(MenuCreator.ALIGNMENT_PANEL)) {
    if (multAln == null) {
      System.err.println("String_Node_Str");
      return;
    }
    try {
      MultipleAlignmentDisplay.showMultipleAligmentPanel(multAln,this,colors);
    }
 catch (    StructureAlignmentException e1) {
      e1.printStackTrace();
    }
catch (    StructureException e1) {
      e1.printStackTrace();
    }
  }
 else   if (cmd.equals(MenuCreator.FATCAT_TEXT)) {
    if (multAln == null) {
      System.err.println("String_Node_Str");
      return;
    }
    System.out.println("String_Node_Str");
  }
}
Program: 16690
Project: 16690
Buggy source:
/** 
 * show some info about this gui
 */
public static void showAboutDialog(){
  AboutDialog dialog=new AboutDialog();
  dialog.showDialog();
}

Fixed version (ground truth):
/** 
 * Show some info about this GUI
 */
public static void showAboutDialog(){
  AboutDialog dialog=new AboutDialog();
  dialog.showDialog();
}
Program: 16692
Project: 16692
Buggy source:
/** 
 * Creates a new Frame with the MultipleAlignment Sequence Panel. The panel can communicate with the Jmol 3D visualization by selecting the aligned residues of all structures.
 * @param multAln
 * @param jmol
 * @param colors
 * @throws StructureException
 */
public static void showMultipleAligmentPanel(MultipleAlignment multAln,AbstractAlignmentJmol jmol,Color[] colors) throws StructureException {
  MultipleAligPanel me=new MultipleAligPanel(multAln,colors,jmol);
  JFrame frame=new JFrame();
  frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  frame.setTitle("String_Node_Str");
  me.setPreferredSize(new Dimension(me.getCoordManager().getPreferredWidth(),me.getCoordManager().getPreferredHeight()));
  JMenuBar menu=MenuCreator.getAlignmentTextMenu(frame,me,multAln);
  frame.setJMenuBar(menu);
  JScrollPane scroll=new JScrollPane(me);
  scroll.setAutoscrolls(true);
  MultipleStatusDisplay status=new MultipleStatusDisplay(me);
  me.addAlignmentPositionListener(status);
  Box vBox=Box.createVerticalBox();
  vBox.add(scroll);
  vBox.add(status);
  frame.getContentPane().add(vBox);
  frame.pack();
  frame.setVisible(true);
  frame.addWindowListener(me);
  frame.addWindowListener(status);
}

Fixed version (ground truth):
/** 
 * Creates a new Frame with the MultipleAlignment Sequence Panel. The panel can communicate with the Jmol 3D visualization by selecting the aligned residues of all structures.
 * @param multAln
 * @param jmol
 * @param colors
 * @throws StructureException
 */
public static void showMultipleAligmentPanel(MultipleAlignment multAln,AbstractAlignmentJmol jmol,ColorBrewer colorPattelete) throws StructureException {
  MultipleAligPanel me=new MultipleAligPanel(multAln,jmol);
  JFrame frame=new JFrame();
  frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  frame.setTitle(jmol.getTitle());
  me.setPreferredSize(new Dimension(me.getCoordManager().getPreferredWidth(),me.getCoordManager().getPreferredHeight()));
  JMenuBar menu=MenuCreator.getAlignmentPanelMenu(frame,me,null);
  frame.setJMenuBar(menu);
  JScrollPane scroll=new JScrollPane(me);
  scroll.setAutoscrolls(true);
  MultipleStatusDisplay status=new MultipleStatusDisplay(me);
  me.addAlignmentPositionListener(status);
  Box vBox=Box.createVerticalBox();
  vBox.add(scroll);
  vBox.add(status);
  frame.getContentPane().add(vBox);
  frame.pack();
  frame.setVisible(true);
  frame.addWindowListener(me);
  frame.addWindowListener(status);
}
Program: 16693
Project: 16693
Buggy source:
/** 
 * Creates a new Frame with the String output representation of the   {@link MultipleAlignment}.
 * @param multAln
 * @param result String output
 */
public static void showAlignmentImage(MultipleAlignment multAln,String result){
  JFrame frame=new JFrame();
  String title=multAln.getEnsemble().getAlgorithmName() + "String_Node_Str" + multAln.getEnsemble().getVersion();
  frame.setTitle(title);
  frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  AlignmentTextPanel txtPanel=new AlignmentTextPanel();
  txtPanel.setText(result);
  JMenuBar menu=MenuCreator.getAlignmentTextMenu(frame,txtPanel,multAln);
  frame.setJMenuBar(menu);
  JScrollPane js=new JScrollPane();
  js.getViewport().add(txtPanel);
  js.getViewport().setBorder(null);
  frame.getContentPane().add(js);
  frame.pack();
  frame.setVisible(true);
}

Fixed version (ground truth):
/** 
 * Creates a new Frame with the String output representation of the   {@link MultipleAlignment}.
 * @param multAln
 * @param result String output
 */
public static void showAlignmentImage(MultipleAlignment multAln,String result){
  JFrame frame=new JFrame();
  String title=multAln.getEnsemble().getAlgorithmName() + "String_Node_Str" + multAln.getEnsemble().getVersion();
  frame.setTitle(title);
  frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  AlignmentTextPanel txtPanel=new AlignmentTextPanel();
  txtPanel.setText(result);
  JMenuBar menu=MenuCreator.getAlignmentTextMenu(frame,txtPanel,null);
  frame.setJMenuBar(menu);
  JScrollPane js=new JScrollPane();
  js.getViewport().add(txtPanel);
  js.getViewport().setBorder(null);
  frame.getContentPane().add(js);
  frame.pack();
  frame.setVisible(true);
}
Program: 16694
Project: 16694
Buggy source:
@Override public void actionPerformed(ActionEvent arg0){
  System.out.println("String_Node_Str");
  if (parent == null) {
    System.err.println("String_Node_Str");
    return;
  }
  if (parent.getDisTable1() != null)   showMatrix(parent.getDisTable1(),"String_Node_Str");
  if (parent.getDisTable2() != null)   showMatrix(parent.getDisTable2(),"String_Node_Str");
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent a){
  System.out.println("String_Node_Str");
  if (parent.getDistanceMatrices() == null) {
    System.err.println("String_Node_Str");
    return;
  }
  for (int i=0; i < parent.getDistanceMatrices().size(); i++) {
    if (parent.getDistanceMatrices().get(i) != null)     showMatrix(parent.getDistanceMatrices().get(i),"String_Node_Str" + (i + 1));
  }
}
Program: 16695
Project: 16695
Buggy source:
public MyDistMaxListener(AFPChain parent){
  this.parent=parent;
}

Fixed version (ground truth):
public MyDistMaxListener(AbstractAlignmentJmol parent){
  this.parent=parent;
}
Program: 16696
Project: 16696
Buggy source:
/** 
 * Constructor using a MultipleAlignment for any other kind of alignment. Default colors are used, so they might not correlate with the jmol coloring.
 * @param multAln
 * @param jmol
 */
public MultipleAligPanel(MultipleAlignment multAln,AbstractAlignmentJmol jmol){
  this(multAln,null,jmol);
}

Fixed version (ground truth):
/** 
 * Constructor using a MultipleAlignment.
 * @param multAln
 * @param colors
 */
public MultipleAligPanel(MultipleAlignment multAln,AbstractAlignmentJmol jmol){
  this();
  this.multAln=multAln;
  this.mapSeqToStruct=new ArrayList<Integer>();
  this.alnSeq=MultipleAlignmentTools.getSequenceAlignment(this.multAln,this.mapSeqToStruct);
  this.size=multAln.size();
  this.length=this.alnSeq.get(0).length();
  coordManager=new MultipleAlignmentCoordManager(size,length);
  this.jmol=jmol;
}
Program: 16698
Project: 16698
Buggy source:
public static void main(String[] args) throws IOException, StructureException, StructureAlignmentException {
  List<String> names=Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  AtomCache cache=new AtomCache();
  List<Atom[]> atomArrays=new ArrayList<Atom[]>();
  for (  String name : names)   atomArrays.add(cache.getAtoms(name));
  MultipleAlignment fakeMultAln=fakeMultipleAlignment("String_Node_Str",atomArrays);
  FatCat fatcat=new FatCat();
  AFPChain afpChain=fatcat.alignRigid(atomArrays.get(0),atomArrays.get(1));
  MultipleAlignmentEnsemble ensemble=new MultipleAlignmentEnsembleImpl(afpChain,atomArrays.get(0),atomArrays.get(1));
  MultipleAlignment pairwise=ensemble.getMultipleAlignments().get(0);
  StructureAlignmentDisplay.display(fakeMultAln);
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException, StructureException, StructureAlignmentException {
  List<String> names=Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  AtomCache cache=new AtomCache();
  List<Atom[]> atomArrays=new ArrayList<Atom[]>();
  for (  String name : names)   atomArrays.add(cache.getAtoms(name));
  MultipleAlignment fakeMultAln=fakeMultipleAlignment("String_Node_Str",atomArrays);
  fakeMultAln.getEnsemble().setStructureNames(names);
  FatCat fatcat=new FatCat();
  AFPChain afpChain=fatcat.alignRigid(atomArrays.get(0),atomArrays.get(1));
  MultipleAlignmentEnsemble ensemble=new MultipleAlignmentEnsembleImpl(afpChain,atomArrays.get(0),atomArrays.get(1));
  MultipleAlignment pairwise=ensemble.getMultipleAlignments().get(0);
  StructureAlignmentDisplay.display(fakeMultAln);
}
Program: 16699
Project: 16699
Buggy source:
@Override public int size() throws StructureAlignmentException {
  if (structureNames == null)   throw new StructureAlignmentException("String_Node_Str");
 else   return structureNames.size();
}

Fixed version (ground truth):
@Override public int size() throws StructureAlignmentException {
  if (structureNames != null)   return structureNames.size();
 else   if (atomArrays != null)   return atomArrays.size();
 else   throw new StructureAlignmentException("String_Node_Str");
}
Program: 16701
Project: 16701
Buggy source:
public static void main(String[] args) throws IOException, StructureException, StructureAlignmentException {
  List<String> names=Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  AtomCache cache=new AtomCache();
  List<Atom[]> atomArrays=new ArrayList<Atom[]>();
  for (  String name : names)   atomArrays.add(cache.getAtoms(name));
  MultipleAlignment fakeMultAln=fakeMultipleAlignment("String_Node_Str",atomArrays);
  FatCat fatcat=new FatCat();
  AFPChain afpChain=fatcat.alignRigid(atomArrays.get(0),atomArrays.get(1));
  MultipleAlignment pairwise=new MultipleAlignmentImpl(afpChain,atomArrays.get(0),atomArrays.get(1));
  StructureAlignmentDisplay.display(fakeMultAln);
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException, StructureException, StructureAlignmentException {
  List<String> names=Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  AtomCache cache=new AtomCache();
  List<Atom[]> atomArrays=new ArrayList<Atom[]>();
  for (  String name : names)   atomArrays.add(cache.getAtoms(name));
  MultipleAlignment fakeMultAln=fakeMultipleAlignment("String_Node_Str",atomArrays);
  FatCat fatcat=new FatCat();
  AFPChain afpChain=fatcat.alignRigid(atomArrays.get(0),atomArrays.get(1));
  MultipleAlignmentEnsemble ensemble=new MultipleAlignmentEnsembleImpl(afpChain,atomArrays.get(0),atomArrays.get(1));
  MultipleAlignment pairwise=ensemble.getMultipleAlignments().get(0);
  StructureAlignmentDisplay.display(fakeMultAln);
}
Program: 16702
Project: 16702
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> hetatms1,List<Group> hetatms2) 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()]);
  twistedAtoms=StructureTools.cloneAtomArray(twistedAtoms);
  Atom[] arr1=getAtomArray(ca1,hetatms1);
  Atom[] arr2=getAtomArray(twistedAtoms,hetatms2);
  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);
  System.out.format("String_Node_Str",arr2[0].getX(),arr2[0].getY(),arr2[0].getZ());
  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> hetatms1,List<Group> hetatms2) 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=twistedAs.toArray(new Atom[twistedAs.size()]);
  twistedAtoms=StructureTools.cloneAtomArray(twistedAtoms);
  Atom[] arr1=getAtomArray(ca1,hetatms1);
  Atom[] arr2=getAtomArray(twistedAtoms,hetatms2);
  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);
  System.out.format("String_Node_Str",arr2[0].getX(),arr2[0].getY(),arr2[0].getZ());
  jmol.setTitle(title);
  return jmol;
}
Program: 16703
Project: 16703
Buggy source:
/** 
 * Return a list of pdb Strings corresponding to the aligned positions of the molecule.  Adapted the method to a more general version for the multiple alignments, using the MultipleAlignment DS.
 * @param aligPos
 * @param multAln
 * @param ca
 * @throws StructureAlignmentException 
 */
public static final List<String> getPDBresnum(int structNum,MultipleAlignment multAln,Atom[] ca) throws StructureAlignmentException {
  List<String> lst=new ArrayList<String>();
  for (int bs=0; bs < multAln.getBlockSetNum(); bs++) {
    for (int b=0; b < multAln.getBlockSets().get(bs).getBlockNum(); b++) {
      for (int i=0; i < multAln.getBlockSets().get(bs).getBlocks().get(b).length(); i++) {
        Block block=multAln.getBlockSets().get(bs).getBlocks().get(b);
        Integer pos=block.getAlignRes().get(structNum).get(i);
        if (pos == null)         continue;
 else         if (pos < ca.length) {
          String pdbInfo=JmolTools.getPdbInfo(ca[pos]);
          lst.add(pdbInfo);
        }
      }
    }
  }
  return lst;
}

Fixed version (ground truth):
/** 
 * Return a list of pdb Strings corresponding to the aligned positions of the molecule.  Adapted the method to a more general version for the multiple alignments, using the MultipleAlignment DS.
 * @param aligPos
 * @param multAln
 * @param ca
 * @throws StructureAlignmentException 
 */
public static final List<String> getPDBresnum(int structNum,MultipleAlignment multAln,Atom[] ca) throws StructureAlignmentException {
  List<String> lst=new ArrayList<String>();
  for (  BlockSet bs : multAln.getBlockSets()) {
    for (    Block block : bs.getBlocks()) {
      for (int i=0; i < block.length(); i++) {
        Integer pos=block.getAlignRes().get(structNum).get(i);
        if (pos == null)         continue;
 else         if (pos < ca.length) {
          String pdbInfo=JmolTools.getPdbInfo(ca[pos]);
          lst.add(pdbInfo);
        }
      }
    }
  }
  return lst;
}
Program: 16704
Project: 16704
Buggy source:
/** 
 * Given an aligned position in the sequence alignment, it returns the Atom that corresponds. It does not support gaps in the multiple alignment right now!
 * @param multAln the alignment information
 * @param str the structure
 * @param pos the position in the sequence alignment
 * @return Atom the aligned atom
 * @throws StructureAlignmentException 
 */
public static Atom getAtomForAligPos(MultipleAlignment multAln,int str,int pos) throws StructureAlignmentException {
  List<Integer> residues=new ArrayList<Integer>();
  for (  BlockSet bs : multAln.getBlockSets()) {
    for (    Block b : bs.getBlocks())     residues.addAll(b.getAlignRes().get(str));
  }
  if (residues.size() == 0)   return null;
  String sequence=multAln.getAlnSequences().get(str);
  int aligpos=0;
  for (int i=0; i < pos; i++) {
    if (sequence.charAt(i) != '-')     aligpos++;
  }
  int capos=residues.get(aligpos);
  if (capos < 0 || capos > multAln.getParent().getAtomArrays().get(str).length)   return null;
  return multAln.getParent().getAtomArrays().get(str)[capos];
}

Fixed version (ground truth):
/** 
 * Given an aligned position in the sequence alignment, it returns the Atom that corresponds. It does not support gaps in the multiple alignment right now!
 * @param multAln the alignment information
 * @param str the structure
 * @param pos the position in the sequence alignment
 * @return Atom the aligned atom
 * @throws StructureAlignmentException 
 */
public static Atom getAtomForAligPos(MultipleAlignment multAln,int str,int pos) throws StructureAlignmentException {
  List<Integer> residues=new ArrayList<Integer>();
  for (  BlockSet bs : multAln.getBlockSets()) {
    for (    Block b : bs.getBlocks())     residues.addAll(b.getAlignRes().get(str));
  }
  if (residues.size() == 0)   return null;
  String sequence=multAln.getAlnSequences().get(str);
  int aligpos=0;
  for (int i=0; i < pos; i++) {
    if (sequence.charAt(i) != '-')     aligpos++;
  }
  int capos=residues.get(aligpos);
  if (capos < 0 || capos > multAln.getEnsemble().getAtomArrays().get(str).length)   return null;
  return multAln.getEnsemble().getAtomArrays().get(str)[capos];
}
Program: 16705
Project: 16705
Buggy source:
/** 
 * Returns the first atom for each group
 * @param ca
 * @param hetatms
 * @return
 * @throws StructureException
 */
public static final Atom[] getAtomArray(Atom[] ca,List<Group> hetatms) throws StructureException {
  List<Atom> atoms=new ArrayList<Atom>();
  Collections.addAll(atoms,ca);
  logger.debug("String_Node_Str",hetatms.size());
  for (  Group g : hetatms) {
    if (g.size() < 1)     continue;
    Atom a=g.getAtom(0);
    a.setGroup(g);
    atoms.add(a);
  }
  Atom[] arr=(Atom[])atoms.toArray(new Atom[atoms.size()]);
  return arr;
}

Fixed version (ground truth):
/** 
 * Returns the first atom for each group
 * @param ca
 * @param hetatms
 * @return
 * @throws StructureException
 */
public static final Atom[] getAtomArray(Atom[] ca,List<Group> hetatms) throws StructureException {
  List<Atom> atoms=new ArrayList<Atom>();
  Collections.addAll(atoms,ca);
  logger.debug("String_Node_Str",hetatms.size());
  for (  Group g : hetatms) {
    if (g.size() < 1)     continue;
    Atom a=g.getAtom(0);
    a.setGroup(g);
    atoms.add(a);
  }
  Atom[] arr=atoms.toArray(new Atom[atoms.size()]);
  return arr;
}
Program: 16706
Project: 16706
Buggy source:
/** 
 * Create a "fake" Structure objects that contains the two sets of atoms aligned on top of each other.
 * @param afpChain the container of the alignment
 * @param ca1 atoms for protein 1
 * @param ca2 atoms for protein 2
 * @return a protein structure with 2 models.
 * @throws StructureException
 */
public static Structure createArtificalStructure(AFPChain afpChain,Atom[] ca1,Atom[] ca2) throws StructureException {
  if (afpChain.getNrEQR() < 1) {
    return DisplayAFP.getAlignedStructure(ca1,ca2);
  }
  Group[] twistedGroups=StructureAlignmentDisplay.prepareGroupsForDisplay(afpChain,ca1,ca2);
  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()]);
  List<Group> hetatms=StructureTools.getUnalignedGroups(ca1);
  List<Group> hetatms2=StructureTools.getUnalignedGroups(ca2);
  Atom[] arr1=DisplayAFP.getAtomArray(ca1,hetatms);
  Atom[] arr2=DisplayAFP.getAtomArray(twistedAtoms,hetatms2);
  Structure artificial=DisplayAFP.getAlignedStructure(arr1,arr2);
  return artificial;
}

Fixed version (ground truth):
/** 
 * Create a "fake" Structure objects that contains the two sets of atoms aligned on top of each other.
 * @param afpChain the container of the alignment
 * @param ca1 atoms for protein 1
 * @param ca2 atoms for protein 2
 * @return a protein structure with 2 models.
 * @throws StructureException
 */
public static Structure createArtificalStructure(AFPChain afpChain,Atom[] ca1,Atom[] ca2) throws StructureException {
  if (afpChain.getNrEQR() < 1) {
    return DisplayAFP.getAlignedStructure(ca1,ca2);
  }
  Group[] twistedGroups=StructureAlignmentDisplay.prepareGroupsForDisplay(afpChain,ca1,ca2);
  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=twistedAs.toArray(new Atom[twistedAs.size()]);
  List<Group> hetatms=StructureTools.getUnalignedGroups(ca1);
  List<Group> hetatms2=StructureTools.getUnalignedGroups(ca2);
  Atom[] arr1=DisplayAFP.getAtomArray(ca1,hetatms);
  Atom[] arr2=DisplayAFP.getAtomArray(twistedAtoms,hetatms2);
  Structure artificial=DisplayAFP.getAlignedStructure(arr1,arr2);
  return artificial;
}
Program: 16708
Project: 16708
Buggy source:
public List<Atom[]> getAtomArrays() throws StructureAlignmentException {
  return multAln.getParent().getAtomArrays();
}

Fixed version (ground truth):
public List<Atom[]> getAtomArrays() throws StructureAlignmentException {
  return multAln.getEnsemble().getAtomArrays();
}