Skip to content

Commit 637aee6

Browse files
committed
Merge branch 'bugfixes-4.2' into master
2 parents f8df9b9 + 50fa989 commit 637aee6

File tree

10 files changed

+210
-79
lines changed

10 files changed

+210
-79
lines changed

biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/StructureToolsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ public void testGetSubRangesExtended() throws StructureException {
403403
assertEquals("Wrong number of chains in "+range, 1, substr.size());
404404
chain = substr.getChainByIndex(0);
405405
assertEquals("Did not find the expected number of residues in "+range, 4, chain.getAtomLength() );
406-
406+
407407
range = "A:--1";
408408
substr = StructureTools.getSubRanges(structure2, range);
409409
assertEquals("Wrong number of chains in "+range, 1, substr.size());

biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/AbstractAlignmentJmol.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public void destroy(){
103103
public void setAtoms(Atom[] atoms){
104104
Structure s = new StructureImpl();
105105
Chain c = new ChainImpl();
106-
c.setId("A");
106+
c.setChainID("A");
107107
for (Atom a: atoms){
108108
c.addGroup(a.getGroup());
109109
}

biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,10 @@ public static final Atom getCentroid(Atom[] atomSet) {
782782
if (atomSet.length==0)
783783
throw new IllegalArgumentException("Atom array has length 0, can't calculate centroid!");
784784

785+
// if we don't catch this case, the centroid returned is (NaN,NaN,NaN), which can cause lots of problems down the line
786+
if (atomSet.length==0)
787+
throw new IllegalArgumentException("Atom array has length 0, can't calculate centroid!");
788+
785789
double[] coords = new double[3];
786790

787791
coords[0] = 0;

biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/axis/HelixAxisAligner.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ private void calcReferenceVector() {
613613
referenceVector = getReferenceAxisCylic();
614614

615615
if (referenceVector == null) {
616-
System.err.println("Warning: no reference vector found. Using y-axis.");
616+
logger.warn("no reference vector found. Using y-axis.");
617617
referenceVector = new Vector3d(Y_AXIS);
618618
}
619619
// make sure reference vector is perpendicular principal roation vector
@@ -629,7 +629,7 @@ private Vector3d orthogonalize(Vector3d vector1, Vector3d vector2) {
629629
vector2.negate();
630630
}
631631
if (Math.abs(dot) < 0.00001) {
632-
System.out.println("HelixAxisAligner: Warning: reference axis parallel");
632+
logger.info("HelixAxisAligner: reference axis parallel");
633633
}
634634
vector2.cross(vector1, vector2);
635635
// System.out.println("Intermed. refVector: " + vector2);

biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/axis/RotationAxisAligner.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ private List<Integer> alignWithReferenceAxis(List<Integer> orbit) {
331331
}
332332
Collections.reverse(orbit.subList(1, orbit.size()));
333333
if (orbit.get(1) != index2) {
334-
System.err.println("Warning: alignWithReferenceAxis failed");
334+
logger.warn("alignWithReferenceAxis failed");
335335
}
336336
// System.out.println("Orbit2: " + orbit);
337337
return orbit;
@@ -644,7 +644,7 @@ private List<Integer> deconvolute(List<Integer> orbit) {
644644
int index = p0.indexOf(current);
645645
int next = p1.get(index);
646646
if (!orbit.contains(next)) {
647-
System.err.println("deconvolute: inconsistency in permuation. Returning original order");
647+
logger.warn("deconvolute: inconsistency in permuation. Returning original order");
648648
return orbit;
649649
}
650650
inRotationOrder.add(next);
@@ -687,7 +687,7 @@ private void calcReferenceVector() {
687687
}
688688

689689
if (referenceVector == null) {
690-
System.err.println("Warning: no reference vector found. Using y-axis.");
690+
logger.warn("no reference vector found. Using y-axis.");
691691
referenceVector = new Vector3d(Y_AXIS);
692692
}
693693
// make sure reference vector is perpendicular principal roation vector

biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/PermutationGroup.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@
2323

2424
import java.util.ArrayList;
2525
import java.util.HashSet;
26+
import java.util.Iterator;
2627
import java.util.List;
2728
import java.util.Set;
2829

2930
/**
3031
*
3132
* @author Peter
3233
*/
33-
public class PermutationGroup {
34+
public class PermutationGroup implements Iterable<List<Integer>> {
3435
List<List<Integer>> permutations = new ArrayList<List<Integer>>();
3536

3637
public void addPermutation(List<Integer> permutation) {
@@ -140,6 +141,11 @@ public int hashCode() {
140141
return getGroupTable().hashCode();
141142
}
142143

144+
@Override
145+
public Iterator<List<Integer>> iterator() {
146+
return permutations.iterator();
147+
}
148+
143149
@Override
144150
public boolean equals(Object obj) {
145151
if (this == obj) {

biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/RotationGroup.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,14 @@
2727
import java.util.ArrayList;
2828
import java.util.Collections;
2929
import java.util.Comparator;
30+
import java.util.Iterator;
3031
import java.util.List;
3132

3233
/**
3334
* @see http://en.wikipedia.org/wiki/Rotation_group_SO(3)
3435
* @author Peter
3536
*/
36-
public class RotationGroup {
37+
public class RotationGroup implements Iterable<Rotation> {
3738
private List<Rotation> rotations = new ArrayList<Rotation>();
3839
private int principalAxisIndex = 0;
3940
private int higherOrderRotationAxis = 0;
@@ -369,4 +370,9 @@ public int compare(Rotation o1, Rotation o2) {
369370
}
370371
});
371372
}
373+
374+
@Override
375+
public Iterator<Rotation> iterator() {
376+
return rotations.iterator();
377+
}
372378
}

0 commit comments

Comments
 (0)