nus-yam/ex-repair huggingface dataset:
Program: 16249
Project: 16249
Buggy source:
private boolean isValidPermutation(List<Integer> permutation){
  if (permutation.size() == 0) {
    return false;
  }
  if (hashCodes.contains(permutation)) {
    return false;
  }
  if (!isAllowedPermutation(permutation)) {
    return false;
  }
  return hashCodes.add(permutation);
}

Fixed version (ground truth):
/** 
 * Checks if a particular permutation is allowed and superimposes well. Caches results.
 * @param permutation
 * @return null if invalid, or a rotation if valid
 */
private Rotation isValidPermutation(List<Integer> permutation){
  if (permutation.size() == 0) {
    return null;
  }
  if (evaluatedPermutations.containsKey(permutation)) {
    return evaluatedPermutations.get(permutation);
  }
  if (!isAllowedPermutation(permutation)) {
    evaluatedPermutations.put(permutation,null);
    return null;
  }
  Rotation rot=superimposePermutation(permutation);
  return rot;
}
Program: 16250
Project: 16250
Buggy source:
private List<Double> getAngles(){
  int n=subunits.getSubunitCount();
  if (n % 60 == 0 && isSpherical()) {
    n=60;
  }
  List<Integer> folds=subunits.getFolds();
  List<Double> angles=new ArrayList<Double>(folds.size() - 1);
  for (  int fold : folds) {
    if (fold > 0 && fold <= n) {
      angles.add(2 * Math.PI / fold);
    }
  }
  return angles;
}

Fixed version (ground truth):
/** 
 * Get valid rotation angles given the number of subunits
 * @return The rotation angle corresponding to each fold of {@link Subunits#getFolds()}
 */
private List<Double> getAngles(){
  int n=subunits.getSubunitCount();
  if (n % 60 == 0 && isSpherical()) {
    n=60;
  }
  List<Integer> folds=subunits.getFolds();
  List<Double> angles=new ArrayList<Double>(folds.size() - 1);
  for (  int fold : folds) {
    if (fold > 0 && fold <= n) {
      angles.add(2 * Math.PI / fold);
    }
  }
  return angles;
}
Program: 16251
Project: 16251
Buggy source:
/** 
 * The permutation must map all subunits onto an equivalent subunit and no subunit onto itself
 * @param permutation
 * @return
 */
private boolean isAllowedPermutation(List<Integer> permutation){
  List<Integer> seqClusterId=subunits.getSequenceClusterIds();
  for (int i=0; i < permutation.size(); i++) {
    int j=permutation.get(i);
    if (i == j || seqClusterId.get(i) != seqClusterId.get(j)) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * The permutation must map all subunits onto an equivalent subunit and no subunit onto itself
 * @param permutation
 * @return
 */
private boolean isAllowedPermutation(List<Integer> permutation){
  List<Integer> seqClusterId=subunits.getSequenceClusterIds();
  int selfaligned=0;
  for (int i=0; i < permutation.size(); i++) {
    int j=permutation.get(i);
    if (seqClusterId.get(i) != seqClusterId.get(j)) {
      return false;
    }
    if (i == j) {
      selfaligned++;
    }
  }
  return selfaligned == 0 || selfaligned == permutation.size();
}
Program: 16252
Project: 16252
Buggy source:
private void solve(){
  initialize();
  int maxSymOps=subunits.getSubunitCount();
  boolean isSpherical=isSpherical();
  if (maxSymOps % 60 == 0 && isSpherical) {
    maxSymOps=60;
  }
  AxisAngle4d sphereAngle=new AxisAngle4d();
  Matrix4d transformation=new Matrix4d();
  int n=subunits.getSubunitCount();
  int sphereCount=SphereSampler.getSphereCount();
  List<Double> angles=getAngles();
  for (int i=0; i < sphereCount; i++) {
    SphereSampler.getAxisAngle(i,sphereAngle);
    for (    double angle : angles) {
      sphereAngle.angle=angle;
      transformation.set(sphereAngle);
      transformation.setElement(3,3,1.0);
      for (int j=0; j < n; j++) {
        transformedCoords[j].set(originalCoords[j]);
        transformation.transform(transformedCoords[j]);
      }
      List<Integer> permutation=getPermutation();
      boolean isValidPermuation=isValidPermutation(permutation);
      if (!isValidPermuation) {
        continue;
      }
      boolean newPermutation=evaluatePermutation(permutation);
      if (newPermutation) {
        completeRotationGroup();
      }
      if (rotations.getOrder() >= maxSymOps) {
        return;
      }
    }
  }
}

Fixed version (ground truth):
private void solve(){
  initialize();
  int maxSymOps=subunits.getSubunitCount();
  boolean isSpherical=isSpherical();
  if (maxSymOps % 60 == 0 && isSpherical) {
    maxSymOps=60;
  }
  AxisAngle4d sphereAngle=new AxisAngle4d();
  Matrix4d transformation=new Matrix4d();
  int n=subunits.getSubunitCount();
  int sphereCount=SphereSampler.getSphereCount();
  List<Double> angles=getAngles();
  for (int i=0; i < sphereCount; i++) {
    SphereSampler.getAxisAngle(i,sphereAngle);
    for (    double angle : angles) {
      sphereAngle.angle=angle;
      transformation.set(sphereAngle);
      transformation.setElement(3,3,1.0);
      for (int j=0; j < n; j++) {
        transformedCoords[j].set(originalCoords[j]);
        transformation.transform(transformedCoords[j]);
      }
      List<Integer> permutation=getPermutation();
      if (evaluatedPermutations.containsKey(permutation)) {
        continue;
      }
      Rotation newPermutation=isValidPermutation(permutation);
      if (newPermutation != null) {
        completeRotationGroup(newPermutation);
      }
      if (rotations.getOrder() >= maxSymOps) {
        return;
      }
    }
  }
}
Program: 16253
Project: 16253
Buggy source:
private Rotation createSymmetryOperation(List<Integer> permutation,Matrix4d transformation,AxisAngle4d axisAngle,int fold,QuatSymmetryScores scores){
  Rotation s=new Rotation();
  s.setPermutation(new ArrayList<Integer>(permutation));
  s.setTransformation(new Matrix4d(transformation));
  s.setAxisAngle(new AxisAngle4d(axisAngle));
  s.setFold(fold);
  s.setScores(scores);
  return s;
}

Fixed version (ground truth):
private static Rotation createSymmetryOperation(List<Integer> permutation,Matrix4d transformation,AxisAngle4d axisAngle,int fold,QuatSymmetryScores scores){
  Rotation s=new Rotation();
  s.setPermutation(new ArrayList<Integer>(permutation));
  s.setTransformation(new Matrix4d(transformation));
  s.setAxisAngle(new AxisAngle4d(axisAngle));
  s.setFold(fold);
  s.setScores(scores);
  return s;
}
Program: 16254
Project: 16254
Buggy source:
/** 
 * Create and set a new structure from a given atom array.
 * @param atoms
 */
public void setAtoms(Atom[] atoms){
  Structure s=new StructureImpl();
  Chain c=new ChainImpl();
  c.setId("String_Node_Str");
  for (  Atom a : atoms) {
    c.addGroup(a.getGroup());
  }
  s.addChain(c);
  setStructure(s);
}

Fixed version (ground truth):
/** 
 * Create and set a new structure from a given atom array.
 * @param atoms
 */
public void setAtoms(Atom[] atoms){
  Structure s=new StructureImpl();
  Chain c=new ChainImpl();
  c.setChainID("String_Node_Str");
  for (  Atom a : atoms) {
    c.addGroup(a.getGroup());
  }
  s.addChain(c);
  setStructure(s);
}
Program: 16255
Project: 16255
Buggy source:
/** 
 * Returns the centroid of the set of atoms.
 * @param atomSet a set of Atoms
 * @return an Atom representing the Centroid of the set of atoms
 */
public static final Atom getCentroid(Atom[] atomSet){
  if (atomSet.length == 0)   throw new IllegalArgumentException("String_Node_Str");
  double[] coords=new double[3];
  coords[0]=0;
  coords[1]=0;
  coords[2]=0;
  for (  Atom a : atomSet) {
    coords[0]+=a.getX();
    coords[1]+=a.getY();
    coords[2]+=a.getZ();
  }
  int n=atomSet.length;
  coords[0]=coords[0] / n;
  coords[1]=coords[1] / n;
  coords[2]=coords[2] / n;
  Atom vec=new AtomImpl();
  vec.setCoords(coords);
  return vec;
}

Fixed version (ground truth):
/** 
 * Returns the centroid of the set of atoms.
 * @param atomSet a set of Atoms
 * @return an Atom representing the Centroid of the set of atoms
 */
public static final Atom getCentroid(Atom[] atomSet){
  if (atomSet.length == 0)   throw new IllegalArgumentException("String_Node_Str");
  if (atomSet.length == 0)   throw new IllegalArgumentException("String_Node_Str");
  double[] coords=new double[3];
  coords[0]=0;
  coords[1]=0;
  coords[2]=0;
  for (  Atom a : atomSet) {
    coords[0]+=a.getX();
    coords[1]+=a.getY();
    coords[2]+=a.getZ();
  }
  int n=atomSet.length;
  coords[0]=coords[0] / n;
  coords[1]=coords[1] / n;
  coords[2]=coords[2] / n;
  Atom vec=new AtomImpl();
  vec.setCoords(coords);
  return vec;
}
Program: 16256
Project: 16256
Buggy source:
private Vector3d orthogonalize(Vector3d vector1,Vector3d vector2){
  double dot=vector1.dot(vector2);
  Vector3d ref=new Vector3d(vector2);
  if (dot < 0) {
    vector2.negate();
  }
  if (Math.abs(dot) < 0.00001) {
    System.out.println("String_Node_Str");
  }
  vector2.cross(vector1,vector2);
  vector2.normalize();
  vector2.cross(vector1,vector2);
  vector2.normalize();
  if (ref.dot(vector2) < 0) {
    vector2.negate();
  }
  return vector2;
}

Fixed version (ground truth):
private Vector3d orthogonalize(Vector3d vector1,Vector3d vector2){
  double dot=vector1.dot(vector2);
  Vector3d ref=new Vector3d(vector2);
  if (dot < 0) {
    vector2.negate();
  }
  if (Math.abs(dot) < 0.00001) {
    logger.info("String_Node_Str");
  }
  vector2.cross(vector1,vector2);
  vector2.normalize();
  vector2.cross(vector1,vector2);
  vector2.normalize();
  if (ref.dot(vector2) < 0) {
    vector2.negate();
  }
  return vector2;
}
Program: 16257
Project: 16257
Buggy source:
/** 
 * Returns a vector perpendicular to the principal rotation vector for the alignment of structures in the xy-plane
 * @return reference vector
 */
private void calcReferenceVector(){
  referenceVector=getReferenceAxisCylic();
  if (referenceVector == null) {
    System.err.println("String_Node_Str");
    referenceVector=new Vector3d(Y_AXIS);
  }
  referenceVector=orthogonalize(principalRotationVector,referenceVector);
}

Fixed version (ground truth):
/** 
 * Returns a vector perpendicular to the principal rotation vector for the alignment of structures in the xy-plane
 * @return reference vector
 */
private void calcReferenceVector(){
  referenceVector=getReferenceAxisCylic();
  if (referenceVector == null) {
    logger.warn("String_Node_Str");
    referenceVector=new Vector3d(Y_AXIS);
  }
  referenceVector=orthogonalize(principalRotationVector,referenceVector);
}
Program: 16259
Project: 16259
Buggy source:
private List<Integer> deconvolute(List<Integer> orbit){
  if (rotationGroup.getOrder() < 2) {
    return orbit;
  }
  List<Integer> p0=rotationGroup.getRotation(0).getPermutation();
  List<Integer> p1=rotationGroup.getRotation(1).getPermutation();
  List<Integer> inRotationOrder=new ArrayList<Integer>(orbit.size());
  inRotationOrder.add(orbit.get(0));
  for (int i=1; i < orbit.size(); i++) {
    int current=inRotationOrder.get(i - 1);
    int index=p0.indexOf(current);
    int next=p1.get(index);
    if (!orbit.contains(next)) {
      System.err.println("String_Node_Str");
      return orbit;
    }
    inRotationOrder.add(next);
  }
  return inRotationOrder;
}

Fixed version (ground truth):
private List<Integer> deconvolute(List<Integer> orbit){
  if (rotationGroup.getOrder() < 2) {
    return orbit;
  }
  List<Integer> p0=rotationGroup.getRotation(0).getPermutation();
  List<Integer> p1=rotationGroup.getRotation(1).getPermutation();
  List<Integer> inRotationOrder=new ArrayList<Integer>(orbit.size());
  inRotationOrder.add(orbit.get(0));
  for (int i=1; i < orbit.size(); i++) {
    int current=inRotationOrder.get(i - 1);
    int index=p0.indexOf(current);
    int next=p1.get(index);
    if (!orbit.contains(next)) {
      logger.warn("String_Node_Str");
      return orbit;
    }
    inRotationOrder.add(next);
  }
  return inRotationOrder;
}
Program: 16260
Project: 16260
Buggy source:
/** 
 * Returns a vector perpendicular to the principal rotation vector for the alignment of structures in the xy-plane
 * @return reference vector
 */
private void calcReferenceVector(){
  referenceVector=null;
  if (rotationGroup.getPointGroup().startsWith("String_Node_Str")) {
    referenceVector=getReferenceAxisCylic();
  }
 else   if (rotationGroup.getPointGroup().startsWith("String_Node_Str")) {
    referenceVector=getReferenceAxisDihedral();
  }
 else   if (rotationGroup.getPointGroup().equals("String_Node_Str")) {
    referenceVector=getReferenceAxisTetrahedral();
  }
 else   if (rotationGroup.getPointGroup().equals("String_Node_Str")) {
    referenceVector=getReferenceAxisOctahedral();
  }
 else   if (rotationGroup.getPointGroup().equals("String_Node_Str")) {
    referenceVector=getReferenceAxisIcosahedral();
  }
 else   if (rotationGroup.getPointGroup().equals("String_Node_Str")) {
    referenceVector=getReferenceAxisCylic();
  }
  if (referenceVector == null) {
    System.err.println("String_Node_Str");
    referenceVector=new Vector3d(Y_AXIS);
  }
  referenceVector=orthogonalize(principalRotationVector,referenceVector);
}

Fixed version (ground truth):
/** 
 * Returns a vector perpendicular to the principal rotation vector for the alignment of structures in the xy-plane
 * @return reference vector
 */
private void calcReferenceVector(){
  referenceVector=null;
  if (rotationGroup.getPointGroup().startsWith("String_Node_Str")) {
    referenceVector=getReferenceAxisCylic();
  }
 else   if (rotationGroup.getPointGroup().startsWith("String_Node_Str")) {
    referenceVector=getReferenceAxisDihedral();
  }
 else   if (rotationGroup.getPointGroup().equals("String_Node_Str")) {
    referenceVector=getReferenceAxisTetrahedral();
  }
 else   if (rotationGroup.getPointGroup().equals("String_Node_Str")) {
    referenceVector=getReferenceAxisOctahedral();
  }
 else   if (rotationGroup.getPointGroup().equals("String_Node_Str")) {
    referenceVector=getReferenceAxisIcosahedral();
  }
 else   if (rotationGroup.getPointGroup().equals("String_Node_Str")) {
    referenceVector=getReferenceAxisCylic();
  }
  if (referenceVector == null) {
    logger.warn("String_Node_Str");
    referenceVector=new Vector3d(Y_AXIS);
  }
  referenceVector=orthogonalize(principalRotationVector,referenceVector);
}
Program: 16262
Project: 16262
Buggy source:
private List<Integer> getPermutation(){
  List<Integer> permutation=new ArrayList<Integer>(transformedCoords.length);
  double sum=0.0f;
  for (  Point3d t : transformedCoords) {
    List<Integer> neighbors=box.getNeighborsWithCache(t);
    int closest=-1;
    double minDist=Double.MAX_VALUE;
    for (    int j : neighbors) {
      double dist=t.distanceSquared(originalCoords[j]);
      if (dist < minDist) {
        closest=j;
        minDist=dist;
      }
    }
    sum+=minDist;
    if (closest == -1) {
      break;
    }
    permutation.add(closest);
  }
  double rmsd=Math.sqrt(sum / transformedCoords.length);
  if (rmsd > distanceThreshold || permutation.size() != transformedCoords.length) {
    permutation.clear();
    return permutation;
  }
  Set<Integer> set=new HashSet<Integer>(permutation);
  if (set.size() != originalCoords.length) {
    permutation.clear();
  }
  return permutation;
}

Fixed version (ground truth):
/** 
 * Compare this.transformedCoords with the original coords. For each subunit, return the transformed subunit with the closest position.
 * @return A list mapping each subunit to the closest transformed subunit
 */
private List<Integer> getPermutation(){
  List<Integer> permutation=new ArrayList<Integer>(transformedCoords.length);
  double sum=0.0f;
  for (  Point3d t : transformedCoords) {
    List<Integer> neighbors=box.getNeighborsWithCache(t);
    int closest=-1;
    double minDist=Double.MAX_VALUE;
    for (    int j : neighbors) {
      double dist=t.distanceSquared(originalCoords[j]);
      if (dist < minDist) {
        closest=j;
        minDist=dist;
      }
    }
    sum+=minDist;
    if (closest == -1) {
      break;
    }
    permutation.add(closest);
  }
  double rmsd=Math.sqrt(sum / transformedCoords.length);
  if (rmsd > distanceThreshold || permutation.size() != transformedCoords.length) {
    permutation.clear();
    return permutation;
  }
  Set<Integer> set=new HashSet<Integer>(permutation);
  if (set.size() != originalCoords.length) {
    permutation.clear();
  }
  return permutation;
}
Program: 16263
Project: 16263
Buggy source:
private void completeRotationGroup(){
  PermutationGroup g=new PermutationGroup();
  for (int i=0; i < rotations.getOrder(); i++) {
    Rotation s=rotations.getRotation(i);
    g.addPermutation(s.getPermutation());
  }
  g.completeGroup();
  if (g.getOrder() == rotations.getOrder()) {
    return;
  }
  for (int i=0; i < g.getOrder(); i++) {
    List<Integer> permutation=g.getPermutation(i);
    boolean isValidPermutation=isValidPermutation(permutation);
    if (isValidPermutation) {
      evaluatePermutation(permutation);
    }
  }
}

Fixed version (ground truth):
/** 
 * Combine current rotations to make all possible permutations. If these are all valid, add them to the rotations
 * @param additionalRots Additional rotations we are considering adding to this.rotations
 * @return whether the rotations were valid and added
 */
private boolean completeRotationGroup(Rotation... additionalRots){
}
Program: 16264
Project: 16264
Buggy source:
private boolean isValidPermutation(List<Integer> permutation){
  if (permutation.size() == 0) {
    return false;
  }
  if (hashCodes.contains(permutation)) {
    return false;
  }
  if (!isAllowedPermutation(permutation)) {
    return false;
  }
  int fold=PermutationGroup.getOrder(permutation);
  if (rotations.getOrder() > 1 && fold == 1) {
    return false;
  }
  if (fold == 0 || subunits.getSubunitCount() % fold != 0) {
    return false;
  }
  return hashCodes.add(permutation);
}

Fixed version (ground truth):
/** 
 * Checks if a particular permutation is allowed and superimposes well. Caches results.
 * @param permutation
 * @return null if invalid, or a rotation if valid
 */
private Rotation isValidPermutation(List<Integer> permutation){
  if (permutation.size() == 0) {
    return null;
  }
  if (evaluatedPermutations.containsKey(permutation)) {
    return evaluatedPermutations.get(permutation);
  }
  if (!isAllowedPermutation(permutation)) {
    evaluatedPermutations.put(permutation,null);
    return null;
  }
  Rotation rot=superimposePermutation(permutation);
  return rot;
}
Program: 16265
Project: 16265
Buggy source:
private List<Double> getAngles(){
  int n=subunits.getSubunitCount();
  if (n % 60 == 0 && isSpherical()) {
    n=60;
  }
  List<Integer> folds=subunits.getFolds();
  List<Double> angles=new ArrayList<Double>(folds.size() - 1);
  for (  int fold : folds) {
    if (fold > 0 && fold <= n) {
      angles.add(2 * Math.PI / fold);
    }
  }
  return angles;
}

Fixed version (ground truth):
/** 
 * Get valid rotation angles given the number of subunits
 * @return The rotation angle corresponding to each fold of {@link Subunits#getFolds()}
 */
private List<Double> getAngles(){
  int n=subunits.getSubunitCount();
  if (n % 60 == 0 && isSpherical()) {
    n=60;
  }
  List<Integer> folds=subunits.getFolds();
  List<Double> angles=new ArrayList<Double>(folds.size() - 1);
  for (  int fold : folds) {
    if (fold > 0 && fold <= n) {
      angles.add(2 * Math.PI / fold);
    }
  }
  return angles;
}
Program: 16266
Project: 16266
Buggy source:
private boolean isAllowedPermutation(List<Integer> permutation){
  List<Integer> seqClusterId=subunits.getSequenceClusterIds();
  for (int i=0; i < permutation.size(); i++) {
    int j=permutation.get(i);
    if (seqClusterId.get(i) != seqClusterId.get(j)) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * The permutation must map all subunits onto an equivalent subunit and no subunit onto itself
 * @param permutation
 * @return
 */
private boolean isAllowedPermutation(List<Integer> permutation){
  List<Integer> seqClusterId=subunits.getSequenceClusterIds();
  int selfaligned=0;
  for (int i=0; i < permutation.size(); i++) {
    int j=permutation.get(i);
    if (seqClusterId.get(i) != seqClusterId.get(j)) {
      return false;
    }
    if (i == j) {
      selfaligned++;
    }
  }
  return selfaligned == 0 || selfaligned == permutation.size();
}
Program: 16267
Project: 16267
Buggy source:
private void solve(){
  initialize();
  int maxSymOps=subunits.getSubunitCount();
  boolean isSpherical=isSpherical();
  if (maxSymOps % 60 == 0 && isSpherical) {
    maxSymOps=60;
  }
  AxisAngle4d sphereAngle=new AxisAngle4d();
  Matrix4d transformation=new Matrix4d();
  int n=subunits.getSubunitCount();
  int sphereCount=SphereSampler.getSphereCount();
  List<Double> angles=getAngles();
  for (int i=0; i < sphereCount; i++) {
    SphereSampler.getAxisAngle(i,sphereAngle);
    for (    double angle : angles) {
      sphereAngle.angle=angle;
      transformation.set(sphereAngle);
      transformation.setElement(3,3,1.0);
      for (int j=0; j < n; j++) {
        transformedCoords[j].set(originalCoords[j]);
        transformation.transform(transformedCoords[j]);
      }
      List<Integer> permutation=getPermutation();
      boolean isValidPermuation=isValidPermutation(permutation);
      if (!isValidPermuation) {
        continue;
      }
      boolean newPermutation=evaluatePermutation(permutation);
      if (newPermutation) {
        completeRotationGroup();
      }
      if (rotations.getOrder() >= maxSymOps) {
        return;
      }
    }
  }
}

Fixed version (ground truth):
private void solve(){
  initialize();
  int maxSymOps=subunits.getSubunitCount();
  boolean isSpherical=isSpherical();
  if (maxSymOps % 60 == 0 && isSpherical) {
    maxSymOps=60;
  }
  AxisAngle4d sphereAngle=new AxisAngle4d();
  Matrix4d transformation=new Matrix4d();
  int n=subunits.getSubunitCount();
  int sphereCount=SphereSampler.getSphereCount();
  List<Double> angles=getAngles();
  for (int i=0; i < sphereCount; i++) {
    SphereSampler.getAxisAngle(i,sphereAngle);
    for (    double angle : angles) {
      sphereAngle.angle=angle;
      transformation.set(sphereAngle);
      transformation.setElement(3,3,1.0);
      for (int j=0; j < n; j++) {
        transformedCoords[j].set(originalCoords[j]);
        transformation.transform(transformedCoords[j]);
      }
      List<Integer> permutation=getPermutation();
      if (evaluatedPermutations.containsKey(permutation)) {
        continue;
      }
      Rotation newPermutation=isValidPermutation(permutation);
      if (newPermutation != null) {
        completeRotationGroup(newPermutation);
      }
      if (rotations.getOrder() >= maxSymOps) {
        return;
      }
    }
  }
}
Program: 16268
Project: 16268
Buggy source:
private Rotation createSymmetryOperation(List<Integer> permutation,Matrix4d transformation,AxisAngle4d axisAngle,int fold,QuatSymmetryScores scores){
  Rotation s=new Rotation();
  s.setPermutation(new ArrayList<Integer>(permutation));
  s.setTransformation(new Matrix4d(transformation));
  s.setAxisAngle(new AxisAngle4d(axisAngle));
  s.setFold(fold);
  s.setScores(scores);
  return s;
}

Fixed version (ground truth):
private static Rotation createSymmetryOperation(List<Integer> permutation,Matrix4d transformation,AxisAngle4d axisAngle,int fold,QuatSymmetryScores scores){
  Rotation s=new Rotation();
  s.setPermutation(new ArrayList<Integer>(permutation));
  s.setTransformation(new Matrix4d(transformation));
  s.setAxisAngle(new AxisAngle4d(axisAngle));
  s.setFold(fold);
  s.setScores(scores);
  return s;
}
Program: 16269
Project: 16269
Buggy source:
private void downloadFile(URL u,File localFile) throws IOException {
  System.out.println("String_Node_Str" + u);
  File tmp=File.createTempFile("String_Node_Str","String_Node_Str");
  InputStream is=u.openStream();
  BufferedInputStream in=new BufferedInputStream(is);
  FileOutputStream w=new FileOutputStream(tmp);
  int i=0;
  byte[] bytesIn=new byte[300000];
  while ((i=in.read(bytesIn)) >= 0) {
    w.write(bytesIn,0,i);
  }
  in.close();
  w.close();
  copyFile(tmp,localFile);
}

Fixed version (ground truth):
public void downloadFile(URL u,File localFile) throws IOException {
  logger.info("String_Node_Str" + u);
  File tmp=File.createTempFile("String_Node_Str","String_Node_Str");
  InputStream is=u.openStream();
  BufferedInputStream in=new BufferedInputStream(is);
  FileOutputStream w=new FileOutputStream(tmp);
  int i=0;
  byte[] bytesIn=new byte[300000];
  while ((i=in.read(bytesIn)) >= 0) {
    w.write(bytesIn,0,i);
  }
  in.close();
  w.close();
  copyFile(tmp,localFile);
}
Program: 16270
Project: 16270
Buggy source:
public static void copyFile(File src,File dst) throws IOException {
  long p=0, dp, size;
  FileChannel in=null, out=null;
  try {
    if (!dst.exists())     dst.createNewFile();
    in=new FileInputStream(src).getChannel();
    out=new FileOutputStream(dst).getChannel();
    size=in.size();
    while ((dp=out.transferFrom(in,p,size)) > 0) {
      p+=dp;
    }
  }
  finally {
    try {
      if (out != null)       out.close();
    }
  finally {
      if (in != null)       in.close();
    }
  }
}

Fixed version (ground truth):
public static void copyFile(File src,File dst) throws IOException {
  Files.copy(src.toPath(),dst.toPath(),StandardCopyOption.REPLACE_EXISTING);
}
Program: 16271
Project: 16271
Buggy source:
public void download(){
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str");
  File dir=getLocalDir();
  if (!dir.exists()) {
    dir.mkdir();
  }
  String[] files=getRemoteFiles();
  for (  String f : files) {
    try {
      int slashIndex=f.lastIndexOf("String_Node_Str");
      String fileName=f.substring(slashIndex);
      File localFile=new File(dir + "String_Node_Str" + fileName);
      if (!localFile.exists()) {
        URL u=new URL(f);
        downloadFile(u,localFile);
      }
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
public void download(){
  logger.warn("String_Node_Str");
  logger.warn("String_Node_Str");
  File dir=getLocalDir();
  if (!dir.exists()) {
    dir.mkdir();
  }
  String[] files=getRemoteFiles();
  for (  String f : files) {
    try {
      int slashIndex=f.lastIndexOf("String_Node_Str");
      String fileName=f.substring(slashIndex);
      File localFile=new File(dir + "String_Node_Str" + fileName);
      if (!localFile.exists()) {
        URL u=new URL(f);
        downloadFile(u,localFile);
      }
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
}
Program: 16272
Project: 16272
Buggy source:
public static void main(String[] args){
  Dataset ds=new Dataset();
  ds.download();
  try {
    for (    File f : ds.getLocalFiles()) {
      System.out.println(f.getAbsoluteFile());
      List<Site> sites=Site.parseSites(f);
      for (      Site s : sites) {
        if (s.getUniprot().equals("String_Node_Str") || s.getUniprot().equals("String_Node_Str")) {
          System.out.println(s);
        }
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  Dataset ds=new Dataset();
  ds.download();
  try {
    for (    File f : ds.getLocalFiles()) {
      logger.info(f.getAbsolutePath());
      List<Site> sites=Site.parseSites(f);
      logger.info("String_Node_Str" + sites.size() + "String_Node_Str");
      for (      Site s : sites) {
        if (s.getUniprot().equals("String_Node_Str") || s.getUniprot().equals("String_Node_Str")) {
          logger.info(s.toString());
        }
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 16274
Project: 16274
Buggy source:
/** 
 * Calculate the HBonds between different groups. see Creighton page 147 f Modified to use only the contact map
 */
private void calculateHBonds(){
  if (groups.length < 5)   return;
  Iterator<AtomContact> otu=contactSet.iterator();
  while (otu.hasNext()) {
    AtomContact ac=otu.next();
    Pair<Atom> pair=ac.getPair();
    Group g1=pair.getFirst().getGroup();
    Group g2=pair.getSecond().getGroup();
    int i=indResMap.get(g1.getResidueNumber().getChainName() + g1.getResidueNumber().getSeqNum());
    int j=indResMap.get(g2.getResidueNumber().getChainName() + g2.getResidueNumber().getSeqNum());
    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 Modified to use only the contact map
 */
private void calculateHBonds(){
  if (groups.length < 5)   return;
  Iterator<AtomContact> otu=contactSet.iterator();
  while (otu.hasNext()) {
    AtomContact ac=otu.next();
    Pair<Atom> pair=ac.getPair();
    Group g1=pair.getFirst().getGroup();
    Group g2=pair.getSecond().getGroup();
    int i=indResMap.get(g1.getResidueNumber());
    int j=indResMap.get(g2.getResidueNumber());
    checkAddHBond(i,j);
    if (j != (i + 1))     checkAddHBond(j,i);
  }
}
Program: 16276
Project: 16276
Buggy source:
/** 
 * Function to generate the contact sets
 */
private void initContactSet(){
  atoms=new Atom[groups.length];
  indResMap=new HashMap<String,Integer>();
  for (int i=0; i < groups.length; i++) {
    SecStrucGroup one=groups[i];
    indResMap.put(one.getResidueNumber().getChainName() + one.getResidueNumber().getSeqNum(),i);
    atoms[i]=one.getCA();
  }
  Grid grid=new Grid(CA_MIN_DIST);
  if (atoms.length == 0) {
    contactSet=new AtomContactSet(CA_MIN_DIST);
  }
 else {
    grid.addAtoms(atoms);
    contactSet=grid.getAtomContacts();
  }
}

Fixed version (ground truth):
/** 
 * Function to generate the contact sets
 */
private void initContactSet(){
  atoms=new Atom[groups.length];
  indResMap=new HashMap<>();
  for (int i=0; i < groups.length; i++) {
    SecStrucGroup one=groups[i];
    indResMap.put(one.getResidueNumber(),i);
    atoms[i]=one.getCA();
  }
  Grid grid=new Grid(CA_MIN_DIST);
  if (atoms.length == 0) {
    contactSet=new AtomContactSet(CA_MIN_DIST);
  }
 else {
    grid.addAtoms(atoms);
    contactSet=grid.getAtomContacts();
  }
}
Program: 16277
Project: 16277
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","String_Node_Str","String_Node_Str");
  SecStrucCalc sec=new SecStrucCalc();
  for (  String name : names) {
    AtomCache cache=new AtomCache();
    Structure structure=cache.getStructure(name);
    List<SecStrucState> biojava=sec.calculate(structure,true);
    List<SecStrucState> dssp=DSSPParser.fetch(name,structure,false);
    assertEquals("String_Node_Str",biojava.size(),dssp.size() * structure.nrModels());
    for (int i=0; i < dssp.size(); i++) {
      assertEquals("String_Node_Str" + (i + 1) + "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","String_Node_Str","String_Node_Str","String_Node_Str");
  SecStrucCalc sec=new SecStrucCalc();
  for (  String name : names) {
    AtomCache cache=new AtomCache();
    Structure structure=cache.getStructure(name);
    List<SecStrucState> biojava=sec.calculate(structure,true);
    List<SecStrucState> dssp=DSSPParser.fetch(name,structure,false);
    assertEquals("String_Node_Str",biojava.size(),dssp.size() * structure.nrModels());
    for (int i=0; i < dssp.size(); i++) {
      assertEquals("String_Node_Str" + (i + 1) + "String_Node_Str",biojava.get(i),dssp.get(i));
    }
  }
}
Program: 16278
Project: 16278
Buggy source:
public PDBFileParser(){
  params=new FileParsingParameters();
  allModels=new ArrayList<>();
  structure=null;
  currentModel=null;
  currentChain=null;
  currentGroup=null;
  startOfMolecule=true;
  startOfModel=true;
  pdbHeader=new PDBHeader();
  crystallographicInfo=new PDBCrystallographicInfo();
  connects=new ArrayList<Map<String,Integer>>();
  helixList=new ArrayList<Map<String,String>>();
  strandList=new ArrayList<Map<String,String>>();
  turnList=new ArrayList<Map<String,String>>();
  current_compound=null;
  dbrefs=new ArrayList<DBRef>();
  siteMap=null;
  dateFormat=new SimpleDateFormat("String_Node_Str",Locale.US);
  atomCount=0;
  atomOverflow=false;
  parseCAonly=false;
  loadMaxAtoms=params.getMaxAtoms();
  atomCAThreshold=params.getAtomCaThreshold();
  blankChainIdsPresent=false;
}

Fixed version (ground truth):
public PDBFileParser(){
  params=new FileParsingParameters();
  allModels=new ArrayList<>();
  structure=null;
  currentModel=null;
  currentChain=null;
  currentGroup=null;
  startOfMolecule=true;
  startOfModel=true;
  pdbHeader=new PDBHeader();
  crystallographicInfo=new PDBCrystallographicInfo();
  connects=new ArrayList<Map<String,Integer>>();
  helixList=new ArrayList<Map<String,String>>();
  strandList=new ArrayList<Map<String,String>>();
  turnList=new ArrayList<Map<String,String>>();
  current_compound=null;
  dbrefs=new ArrayList<DBRef>();
  siteMap=null;
  dateFormat=new SimpleDateFormat("String_Node_Str",Locale.US);
  atomCount=0;
  atomOverflow=false;
  parseCAonly=false;
  loadMaxAtoms=params.getMaxAtoms();
  atomCAThreshold=params.getAtomCaThreshold();
  linkRecords=new ArrayList<LinkRecord>();
  blankChainIdsPresent=false;
}
Program: 16281
Project: 16281
Buggy source:
/** 
 * safes repeating a few lines ... 
 */
private Integer conect_helper(String line,int start,int end){
  String sbond=line.substring(start,end).trim();
  int bond=-1;
  Integer b=null;
  if (!sbond.equals("String_Node_Str")) {
    bond=Integer.parseInt(sbond);
    b=new Integer(bond);
  }
  return b;
}

Fixed version (ground truth):
/** 
 * safes repeating a few lines ... 
 */
private Integer conect_helper(String line,int start,int end){
  if (line.length() < end)   return null;
  String sbond=line.substring(start,end).trim();
  int bond=-1;
  Integer b=null;
  if (!sbond.equals("String_Node_Str")) {
    bond=Integer.parseInt(sbond);
    b=new Integer(bond);
  }
  return b;
}
Program: 16282
Project: 16282
Buggy source:
/** 
 * Handles creation of all bonds. Looks at LINK records, SSBOND (Disulfide bonds), peptide bonds, and intra-residue bonds. <p> Note: the current implementation only looks at the first model of each structure. This may need to be fixed in the future.
 */
private void formBonds(){
  BondMaker maker=new BondMaker(structure,params);
  maker.formDisulfideBonds(ssbonds);
  maker.makeBonds();
}

Fixed version (ground truth):
/** 
 * Handles creation of all bonds. Looks at LINK records, SSBOND (Disulfide bonds), peptide bonds, and intra-residue bonds. <p> Note: the current implementation only looks at the first model of each structure. This may need to be fixed in the future.
 */
private void formBonds(){
  BondMaker maker=new BondMaker(structure,params);
  for (  LinkRecord linkRecord : linkRecords) {
    maker.formLinkRecordBond(linkRecord);
  }
  maker.formDisulfideBonds(ssbonds);
  maker.makeBonds();
}
Program: 16283
Project: 16283
Buggy source:
public CrystalBuilder(Structure structure){
  this.structure=structure;
  this.crystallographicInfo=structure.getCrystallographicInfo();
  this.numChainsAu=structure.getChains().size();
  this.numOperatorsSg=1;
  if (structure.isCrystallographic()) {
    this.isCrystallographic=true;
    if (this.crystallographicInfo.isNonStandardSg()) {
      logger.warn("String_Node_Str");
      this.isCrystallographic=false;
    }
 else     if (this.crystallographicInfo.getSpaceGroup() == null) {
      logger.warn("String_Node_Str");
      this.isCrystallographic=false;
    }
 else {
      this.numOperatorsSg=this.crystallographicInfo.getSpaceGroup().getMultiplicity();
    }
    if (this.crystallographicInfo.getCrystalCell() == null) {
      logger.warn("String_Node_Str");
      this.isCrystallographic=false;
    }
    if (this.crystallographicInfo.isNonStandardCoordFrameConvention()) {
      logger.warn("String_Node_Str");
      this.isCrystallographic=false;
    }
  }
 else {
    this.isCrystallographic=false;
  }
  this.numCells=DEF_NUM_CELLS;
}

Fixed version (ground truth):
public CrystalBuilder(Structure structure){
  this.structure=structure;
  this.crystallographicInfo=structure.getCrystallographicInfo();
  this.numChainsAu=structure.getChains().size();
  this.numOperatorsSg=1;
  if (structure.isCrystallographic()) {
    this.isCrystallographic=true;
    if (this.crystallographicInfo.isNonStandardSg()) {
      logger.warn("String_Node_Str");
      this.isCrystallographic=false;
    }
 else     if (this.crystallographicInfo.getSpaceGroup() == null) {
      logger.warn("String_Node_Str");
      this.isCrystallographic=false;
    }
 else {
      this.numOperatorsSg=this.crystallographicInfo.getSpaceGroup().getMultiplicity();
    }
    if (this.crystallographicInfo.getCrystalCell() == null) {
      logger.warn("String_Node_Str");
      this.isCrystallographic=false;
    }
    if (this.crystallographicInfo.isNonStandardCoordFrameConvention()) {
      logger.warn("String_Node_Str");
      this.isCrystallographic=false;
      this.numOperatorsSg=1;
    }
  }
 else {
    this.isCrystallographic=false;
  }
  this.numCells=DEF_NUM_CELLS;
}
Program: 16284
Project: 16284
Buggy source:
public CrystalBuilder(Structure structure){
  this.structure=structure;
  this.crystallographicInfo=structure.getCrystallographicInfo();
  this.numPolyChainsAu=structure.getPolyChains().size();
  this.numOperatorsSg=1;
  if (structure.isCrystallographic()) {
    this.isCrystallographic=true;
    if (this.crystallographicInfo.isNonStandardSg()) {
      logger.warn("String_Node_Str");
      this.isCrystallographic=false;
    }
 else     if (this.crystallographicInfo.getSpaceGroup() == null) {
      logger.warn("String_Node_Str");
      this.isCrystallographic=false;
    }
 else {
      this.numOperatorsSg=this.crystallographicInfo.getSpaceGroup().getMultiplicity();
    }
    if (this.crystallographicInfo.getCrystalCell() == null) {
      logger.warn("String_Node_Str");
      this.isCrystallographic=false;
    }
    if (this.crystallographicInfo.isNonStandardCoordFrameConvention()) {
      logger.warn("String_Node_Str");
      this.isCrystallographic=false;
    }
  }
 else {
    this.isCrystallographic=false;
  }
  this.numCells=DEF_NUM_CELLS;
}

Fixed version (ground truth):
public CrystalBuilder(Structure structure){
  this.structure=structure;
  this.crystallographicInfo=structure.getCrystallographicInfo();
  this.numPolyChainsAu=structure.getPolyChains().size();
  this.numOperatorsSg=1;
  if (structure.isCrystallographic()) {
    this.isCrystallographic=true;
    if (this.crystallographicInfo.isNonStandardSg()) {
      logger.warn("String_Node_Str");
      this.isCrystallographic=false;
    }
 else     if (this.crystallographicInfo.getSpaceGroup() == null) {
      logger.warn("String_Node_Str");
      this.isCrystallographic=false;
    }
 else {
      this.numOperatorsSg=this.crystallographicInfo.getSpaceGroup().getMultiplicity();
    }
    if (this.crystallographicInfo.getCrystalCell() == null) {
      logger.warn("String_Node_Str");
      this.isCrystallographic=false;
    }
    if (this.crystallographicInfo.isNonStandardCoordFrameConvention()) {
      logger.warn("String_Node_Str");
      this.isCrystallographic=false;
      this.numOperatorsSg=1;
    }
  }
 else {
    this.isCrystallographic=false;
  }
  this.numCells=DEF_NUM_CELLS;
}
Program: 16285
Project: 16285
Buggy source:
@Test public void testSuperpositionQuat(){
  SuperPosition sup=new SuperPositionQuat(false);
  Point3d[] points1=clonePoints(chain1);
  Point3d[] points2=clonePoints(chain2);
  double rmsd=sup.getRmsd(points1,points2);
  assertEquals(0.0,rmsd,0.0001);
}

Fixed version (ground truth):
@Test public void testSuperpositionQuat(){
  SuperPosition sup=new SuperPositionQuat(false);
  double rmsd=sup.getRmsd(chain1,chain2);
  assertEquals(0.0,rmsd,0.0001);
}
Program: 16286
Project: 16286
Buggy source:
@Test public void testSuperpositionQCP(){
  SuperPosition sup=new SuperPositionQCP(false);
  Point3d[] points1=clonePoints(chain1);
  Point3d[] points2=clonePoints(chain2);
  double rmsd=sup.getRmsd(points1,points2);
  assertEquals(0.0,rmsd,0.0001);
}

Fixed version (ground truth):
@Test public void testSuperpositionQCP(){
  SuperPosition sup=new SuperPositionQCP(false);
  double rmsd=sup.getRmsd(chain1,chain2);
  assertEquals(0.0,rmsd,0.0001);
}
Program: 16287
Project: 16287
Buggy source:
@Test public void testSuperpositionSVD(){
  SuperPosition sup=new SuperPositionSVD(false);
  Point3d[] points1=clonePoints(chain1);
  Point3d[] points2=clonePoints(chain2);
  double rmsd=sup.getRmsd(points1,points2);
  assertEquals(0.0,rmsd,0.0001);
}

Fixed version (ground truth):
@Test public void testSuperpositionSVD(){
  SuperPosition sup=new SuperPositionSVD(false);
  double rmsd=sup.getRmsd(chain1,chain2);
  assertEquals(0.0,rmsd,0.0001);
}
Program: 16289
Project: 16289
Buggy source:
/** 
 * Test method to obtain the transformation matrix from superpositions.
 */
@Test public void testSuperposition(){
  for (int c=0; c < cloud1.size(); c++) {
    SuperPosition svd=new SuperPositionSVD(false);
    long svdStart=System.nanoTime();
    Matrix4d svdTransform=svd.superpose(cloud1.get(c),cloud2.get(c));
    long svdTime=(System.nanoTime() - svdStart) / 1000;
    SuperPosition quat=new SuperPositionQuat(false);
    long quatStart=System.nanoTime();
    Matrix4d quatTransform=quat.superpose(cloud1.get(c),cloud2.get(c));
    long quatTime=(System.nanoTime() - quatStart) / 1000;
    SuperPosition qcp=new SuperPositionQCP(false);
    long qcpStart=System.nanoTime();
    Matrix4d qcpTransform=qcp.superpose(cloud1.get(c),cloud2.get(c));
    long qcpTime=(System.nanoTime() - qcpStart) / 1000;
    logger.error(String.format("String_Node_Str" + "String_Node_Str",cloud1.get(c).length,svdTime,quatTime,qcpTime));
    assertTrue(transform.epsilonEquals(svdTransform,0.01));
    assertTrue(transform.epsilonEquals(quatTransform,0.01));
    assertTrue(transform.epsilonEquals(qcpTransform,0.01));
  }
}

Fixed version (ground truth):
/** 
 * Test method to obtain the transformation matrix from superpositions.
 */
@Test public void testSuperposition(){
  for (int c=0; c < cloud1.size(); c++) {
    SuperPosition svd=new SuperPositionSVD(false);
    long svdStart=System.nanoTime();
    Matrix4d svdTransform=svd.superpose(cloud1.get(c),cloud2.get(c));
    long svdTime=(System.nanoTime() - svdStart) / 1000;
    SuperPosition quat=new SuperPositionQuat(false);
    long quatStart=System.nanoTime();
    Matrix4d quatTransform=quat.superpose(cloud1.get(c),cloud2.get(c));
    long quatTime=(System.nanoTime() - quatStart) / 1000;
    SuperPosition qcp=new SuperPositionQCP(false);
    long qcpStart=System.nanoTime();
    Matrix4d qcpTransform=qcp.superpose(cloud1.get(c),cloud2.get(c));
    long qcpTime=(System.nanoTime() - qcpStart) / 1000;
    logger.error(String.format("String_Node_Str" + "String_Node_Str",cloud1.get(c).length,svdTime,quatTime,qcpTime));
    assertTrue(transform.epsilonEquals(svdTransform,0.05));
    assertTrue(transform.epsilonEquals(quatTransform,0.05));
    assertTrue(transform.epsilonEquals(qcpTransform,0.05));
  }
}
Program: 16290
Project: 16290
Buggy source:
/** 
 * Use the   {@link SuperPosition#superposeAndTransform(Point3d[],Point3d[])}method of the default static SuperPosition algorithm contained in this Class.
 */
public static Matrix4d superposeAndTransform(Point3d[] fixed,Point3d[] moved){
  superposer.setCentered(false);
  return superposer.superpose(fixed,moved);
}

Fixed version (ground truth):
/** 
 * Use the   {@link SuperPosition#superposeAndTransform(Point3d[],Point3d[])}method of the default static SuperPosition algorithm contained in this Class.
 */
public static Matrix4d superposeAndTransform(Point3d[] fixed,Point3d[] moved){
  superposer.setCentered(false);
  return superposer.superposeAndTransform(fixed,moved);
}
Program: 16291
Project: 16291
Buggy source:
/** 
 * Use the   {@link SuperPosition#superposeAndTransform(Point3d[],Point3d[])}method of the default static SuperPosition algorithm contained in this Class, assuming that the point arrays are centered at the origin.
 */
public static Matrix4d superposeAndTransformAtOrigin(Point3d[] fixed,Point3d[] moved){
  superposer.setCentered(true);
  return superposer.superpose(fixed,moved);
}

Fixed version (ground truth):
/** 
 * Use the   {@link SuperPosition#superposeAndTransform(Point3d[],Point3d[])}method of the default static SuperPosition algorithm contained in this Class, assuming that the point arrays are centered at the origin.
 */
public static Matrix4d superposeAndTransformAtOrigin(Point3d[] fixed,Point3d[] moved){
  superposer.setCentered(true);
  return superposer.superposeAndTransform(fixed,moved);
}
Program: 16292
Project: 16292
Buggy source:
/** 
 * Hemoglobin has both symmetry and pseudosymmetry: 4HHB
 * @throws StructureException
 * @throws IOException
 */
@Test public void testPseudosymmetry() throws IOException, StructureException {
  Structure pdb=StructureIO.getStructure("String_Node_Str");
  SubunitClustererParameters clusterParams=new SubunitClustererParameters();
  clusterParams.setClustererMethod(SubunitClustererMethod.SEQUENCE);
  QuatSymmetryParameters symmParams=new QuatSymmetryParameters();
  QuatSymmetryResults symmetry=QuatSymmetryDetector.calcGlobalSymmetry(pdb,symmParams,clusterParams);
  assertEquals("String_Node_Str",symmetry.getSymmetry());
  assertEquals("String_Node_Str",symmetry.getStoichiometry());
  clusterParams.setClustererMethod(SubunitClustererMethod.STRUCTURE);
  symmetry=QuatSymmetryDetector.calcGlobalSymmetry(pdb,symmParams,clusterParams);
  assertEquals("String_Node_Str",symmetry.getSymmetry());
  assertEquals("String_Node_Str",symmetry.getStoichiometry());
}

Fixed version (ground truth):
/** 
 * Hemoglobin has both symmetry and pseudosymmetry: 4HHB TODO pseudosymmetry in hemoglobin fails
 * @throws StructureException
 * @throws IOException
 */
@Test public void testPseudosymmetry() throws IOException, StructureException {
  Structure pdb=StructureIO.getStructure("String_Node_Str");
  SubunitClustererParameters clusterParams=new SubunitClustererParameters();
  clusterParams.setClustererMethod(SubunitClustererMethod.SEQUENCE);
  QuatSymmetryParameters symmParams=new QuatSymmetryParameters();
  QuatSymmetryResults symmetry=QuatSymmetryDetector.calcGlobalSymmetry(pdb,symmParams,clusterParams);
  assertEquals("String_Node_Str",symmetry.getSymmetry());
  assertEquals("String_Node_Str",symmetry.getStoichiometry());
  clusterParams.setClustererMethod(SubunitClustererMethod.STRUCTURE);
  symmetry=QuatSymmetryDetector.calcGlobalSymmetry(pdb,symmParams,clusterParams);
  assertEquals("String_Node_Str",symmetry.getSymmetry());
  assertEquals("String_Node_Str",symmetry.getStoichiometry());
}