Skip to content

Commit 7f8659a

Browse files
committed
Better logging in symmetry package
1 parent afd6fcb commit 7f8659a

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,16 @@
2222

2323
import org.biojava.nbio.structure.symmetry.geometry.MomentsOfInertia;
2424
import org.biojava.nbio.structure.symmetry.geometry.SuperPosition;
25+
import org.slf4j.Logger;
26+
import org.slf4j.LoggerFactory;
2527

2628
import javax.vecmath.*;
2729
import java.util.*;
2830

2931
public class HelixAxisAligner extends AxisAligner {
32+
33+
private static final Logger LOGGER = LoggerFactory.getLogger(HelixAxisAligner.class);
34+
3035
private static final Vector3d Y_AXIS = new Vector3d(0,1,0);
3136
private static final Vector3d Z_AXIS = new Vector3d(0,0,1);
3237

@@ -480,7 +485,7 @@ private Matrix4d alignAxes(Vector3d[] axisVectors, Vector3d[] referenceVectors)
480485
ref[0] = new Point3d(referenceVectors[0]);
481486
ref[1] = new Point3d(referenceVectors[1]);
482487
if (SuperPosition.rmsd(axes, ref) > 0.1) {
483-
System.out.println("Warning: AxisTransformation: axes alignment is off. RMSD: " + SuperPosition.rmsd(axes, ref));
488+
LOGGER.info("AxisTransformation: axes alignment is off. RMSD: " + SuperPosition.rmsd(axes, ref));
484489
}
485490

486491
return m2;
@@ -600,7 +605,7 @@ private void calcReferenceVector() {
600605
referenceVector = getReferenceAxisCylic();
601606

602607
if (referenceVector == null) {
603-
System.err.println("Warning: no reference vector found. Using y-axis.");
608+
LOGGER.warn("no reference vector found. Using y-axis.");
604609
referenceVector = new Vector3d(Y_AXIS);
605610
}
606611
// make sure reference vector is perpendicular principal roation vector
@@ -616,7 +621,7 @@ private Vector3d orthogonalize(Vector3d vector1, Vector3d vector2) {
616621
vector2.negate();
617622
}
618623
if (Math.abs(dot) < 0.00001) {
619-
System.out.println("HelixAxisAligner: Warning: reference axis parallel");
624+
LOGGER.info("HelixAxisAligner: reference axis parallel");
620625
}
621626
vector2.cross(vector1, vector2);
622627
// System.out.println("Intermed. refVector: " + vector2);

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,16 @@
2222

2323
import org.biojava.nbio.structure.symmetry.geometry.MomentsOfInertia;
2424
import org.biojava.nbio.structure.symmetry.geometry.SuperPosition;
25+
import org.slf4j.Logger;
26+
import org.slf4j.LoggerFactory;
2527

2628
import javax.vecmath.*;
2729
import java.util.*;
2830

2931
public class RotationAxisAligner extends AxisAligner{
32+
33+
private static final Logger LOGGER = LoggerFactory.getLogger(RotationAxisAligner.class);
34+
3035
private static final Vector3d X_AXIS = new Vector3d(1,0,0);
3136
private static final Vector3d Y_AXIS = new Vector3d(0,1,0);
3237
private static final Vector3d Z_AXIS = new Vector3d(0,0,1);
@@ -320,7 +325,7 @@ private List<Integer> alignWithReferenceAxis(List<Integer> orbit) {
320325
}
321326
Collections.reverse(orbit.subList(1, orbit.size()));
322327
if (orbit.get(1) != index2) {
323-
System.err.println("Warning: alignWithReferenceAxis failed");
328+
LOGGER.warn("alignWithReferenceAxis failed");
324329
}
325330
// System.out.println("Orbit2: " + orbit);
326331
return orbit;
@@ -459,7 +464,7 @@ private Matrix4d alignAxes(Vector3d[] axisVectors, Vector3d[] referenceVectors)
459464
ref[0] = new Point3d(referenceVectors[0]);
460465
ref[1] = new Point3d(referenceVectors[1]);
461466
if (SuperPosition.rmsd(axes, ref) > 0.1) {
462-
System.out.println("Warning: AxisTransformation: axes alignment is off. RMSD: " + SuperPosition.rmsd(axes, ref));
467+
LOGGER.info("AxisTransformation: axes alignment is off. RMSD: " + SuperPosition.rmsd(axes, ref));
463468
}
464469

465470
return m2;
@@ -632,7 +637,7 @@ private List<Integer> deconvolute(List<Integer> orbit) {
632637
int index = p0.indexOf(current);
633638
int next = p1.get(index);
634639
if (!orbit.contains(next)) {
635-
System.err.println("deconvolute: inconsistency in permuation. Returning original order");
640+
LOGGER.warn("deconvolute: inconsistency in permuation. Returning original order");
636641
return orbit;
637642
}
638643
inRotationOrder.add(next);
@@ -675,7 +680,7 @@ private void calcReferenceVector() {
675680
}
676681

677682
if (referenceVector == null) {
678-
System.err.println("Warning: no reference vector found. Using y-axis.");
683+
LOGGER.warn("no reference vector found. Using y-axis.");
679684
referenceVector = new Vector3d(Y_AXIS);
680685
}
681686
// make sure reference vector is perpendicular principal roation vector

0 commit comments

Comments
 (0)