Program: 17149
Project: 17149
Buggy source:
/** 
 * Converts the PDB coordinates stored locally (accessible via   {@link #getAlignmentMatrix()}) into internal residue numbers. <p> The conversion can be run for just a subset of the MultipleAlignment by  specifying the appropriate protein indices.
 * @param structures A list of structures for proteins in this MultipleAlignment.Used to map PDB residue numbers to internal coordinates.
 * @param proteinIndices For each entry in structures, specifies what alignmentprotein each structure corresponds to. This should be the same length as structures, and should specify the row index of each structure into the  {@link #getAlignmentResidues()} matrix.
 * @return A matrix with a row for each item in structures. Columns correspondto aligned residues between the specified proteins.
 * @throws StructureException If a pdb number does not appear in the corresponding Structure.
 */
public int[][] getAlignmentMatrix(int[] proteinIndices,List<Atom[]> structures) throws StructureException {
  if (proteinIndices.length != structures.size()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  int[][] alignMat=new int[proteinIndices.length][];
  for (int prot=0; prot < proteinIndices.length; prot++) {
    int protIndex=proteinIndices[prot];
    alignMat[prot]=new int[residues[protIndex].length];
    Atom[] struct=structures.get(protIndex);
    int atomIndexGuess=0;
    for (int res=0; res < residues[protIndex].length; res++) {
      int groupNr=findGroup(struct,residues[protIndex][res],atomIndexGuess);
      if (groupNr < 0) {
        throw new StructureException(String.format("String_Node_Str",residues[protIndex][res].toString(),protIndex));
      }
      alignMat[prot][res]=groupNr;
    }
  }
  return alignMat;
}

Fixed version (ground truth):
/** 
 * Converts the PDB coordinates stored locally (accessible via   {@link #getAlignmentMatrix()}) into internal residue numbers. <p> The conversion can be run for just a subset of the MultipleAlignment by  specifying the appropriate protein indices.
 * @param structures A list of structures for proteins in this MultipleAlignment.Used to map PDB residue numbers to internal coordinates.
 * @param proteinIndices For each entry in structures, specifies what alignmentprotein each structure corresponds to. This should be the same length as structures, and should specify the row index of each structure into the  {@link #getAlignmentResidues()} matrix.
 * @return A matrix with a row for each item in structures. Columns correspondto aligned residues between the specified proteins.
 * @throws StructureException If a pdb number does not appear in the corresponding Structure.
 */
public int[][] getAlignmentMatrix(int[] proteinIndices,List<Atom[]> structures) throws StructureException {
  if (proteinIndices.length != structures.size()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  int[][] alignMat=new int[proteinIndices.length][];
  for (int prot=0; prot < proteinIndices.length; prot++) {
    int protIndex=proteinIndices[prot];
    alignMat[prot]=new int[residues[protIndex].length];
    Atom[] struct=structures.get(protIndex);
    int atomIndexGuess=0;
    for (int res=0; res < residues[protIndex].length; res++) {
      int groupNr=findGroup(struct,residues[protIndex][res],atomIndexGuess);
      if (groupNr < 0) {
        throw new StructureException(String.format("String_Node_Str",residues[protIndex][res].toString(),struct[0].getParent().getParent().getParent().getPDBCode()));
      }
      alignMat[prot][res]=groupNr;
    }
  }
  return alignMat;
}