Skip to content

Commit 73c98a4

Browse files
committed
Simple integration test for superposition methods
1 parent be15fe1 commit 73c98a4

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
package org.biojava.nbio.structure.test.geometry;
2+
3+
import static org.junit.Assert.*;
4+
5+
import java.io.IOException;
6+
7+
import javax.vecmath.Point3d;
8+
9+
import org.biojava.nbio.structure.Calc;
10+
import org.biojava.nbio.structure.Chain;
11+
import org.biojava.nbio.structure.Structure;
12+
import org.biojava.nbio.structure.StructureException;
13+
import org.biojava.nbio.structure.StructureIO;
14+
import org.biojava.nbio.structure.StructureTools;
15+
import org.biojava.nbio.structure.geometry.SuperPosition;
16+
import org.biojava.nbio.structure.geometry.SuperPositionQCP;
17+
import org.biojava.nbio.structure.geometry.SuperPositionQuat;
18+
import org.biojava.nbio.structure.geometry.SuperPositionSVD;
19+
import org.junit.BeforeClass;
20+
import org.junit.Test;
21+
22+
public class TestProteinSuperposition {
23+
24+
private static Point3d[] chain1;
25+
private static Point3d[] chain2;
26+
27+
@BeforeClass
28+
public static void setUpBeforeClass() throws StructureException, IOException {
29+
Structure s = StructureIO.getStructure("1smt");
30+
Chain origChainA = s.getPolyChainByPDB("A");
31+
Chain clonedChainA = (Chain) origChainA.clone();
32+
33+
chain1 = Calc.atomsToPoints(StructureTools.getAtomCAArray(origChainA));
34+
chain2 = Calc.atomsToPoints(StructureTools.getAtomCAArray(clonedChainA));
35+
36+
}
37+
38+
private Point3d[] clonePoints(Point3d[] points) {
39+
Point3d[] newpoints = new Point3d[points.length];
40+
for (int i=0;i<points.length;i++) {
41+
newpoints[i] = new Point3d(points[i]);
42+
}
43+
return newpoints;
44+
}
45+
46+
@Test
47+
public void testSuperpositionSVD() {
48+
49+
SuperPosition sup = new SuperPositionSVD(false);
50+
51+
// making sure tests are independent by cloning
52+
Point3d[] points1 = clonePoints(chain1);
53+
Point3d[] points2 = clonePoints(chain2);
54+
55+
double rmsd = sup.getRmsd(points1, points2);
56+
57+
assertEquals(0.0, rmsd, 0.0001);
58+
}
59+
60+
@Test
61+
public void testSuperpositionQCP() {
62+
63+
SuperPosition sup = new SuperPositionQCP(false);
64+
65+
// making sure tests are independent by cloning
66+
Point3d[] points1 = clonePoints(chain1);
67+
Point3d[] points2 = clonePoints(chain2);
68+
69+
double rmsd = sup.getRmsd(points1, points2);
70+
71+
assertEquals(0.0, rmsd, 0.0001);
72+
}
73+
74+
@Test
75+
public void testSuperpositionQuat() {
76+
77+
SuperPosition sup = new SuperPositionQuat(false);
78+
79+
// making sure tests are independent by cloning
80+
Point3d[] points1 = clonePoints(chain1);
81+
Point3d[] points2 = clonePoints(chain2);
82+
83+
double rmsd = sup.getRmsd(points1, points2);
84+
85+
assertEquals(0.0, rmsd, 0.0001);
86+
}
87+
}

0 commit comments

Comments
 (0)