Skip to content

Commit 0c43e70

Browse files
committed
Fix compilation errors from SuperPosition interface change #558
1 parent 8cc31b0 commit 0c43e70

33 files changed

+662
-625
lines changed

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

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@
2121
package org.biojava.nbio.structure.test;
2222

2323
import org.biojava.nbio.structure.*;
24-
import org.biojava.nbio.structure.geometry.SuperPositionSVD;
24+
import org.biojava.nbio.structure.geometry.SuperPositions;
2525
import org.biojava.nbio.structure.io.FileParsingParameters;
2626
import org.biojava.nbio.structure.io.PDBFileParser;
2727
import org.biojava.nbio.structure.io.SSBondImpl;
28-
import org.biojava.nbio.structure.jama.Matrix;
29-
3028
import java.io.IOException;
3129
import java.io.InputStream;
3230
import java.util.List;
3331
import java.util.Set;
3432

33+
import javax.vecmath.Matrix4d;
34+
3535
import org.junit.BeforeClass;
3636
import org.junit.Test;
3737

@@ -42,8 +42,6 @@
4242
* @author Andreas Prlic
4343
* @since 1.5
4444
*/
45-
46-
4745
public class StructureTest {
4846

4947
private static Structure structure;
@@ -267,18 +265,12 @@ public void testMutation() throws Exception {
267265
atoms2[1] = g2.getAtom("CA");
268266
atoms2[2] = g2.getAtom("CB");
269267

268+
Matrix4d transform = SuperPositions.superpose(
269+
Calc.atomsToPoints(atoms1), Calc.atomsToPoints(atoms2));
270270

271-
SuperPositionSVD svds = new SuperPositionSVD(atoms1,atoms2);
272-
273-
274-
Matrix rotMatrix = svds.getRotation();
275-
Atom tran = svds.getTranslation();
276-
277-
Group newGroup = (Group)g2.clone();
278-
279-
Calc.rotate(newGroup,rotMatrix);
271+
Group newGroup = (Group) g2.clone();
280272

281-
Calc.shift(newGroup,tran);
273+
Calc.transform(newGroup, transform);
282274

283275
Atom ca1 = g1.getAtom("CA");
284276
Atom oldca2 = g2.getAtom("CA");

biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/align/FlipAFPChainTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import org.biojava.nbio.structure.align.xml.AFPChainFlipper;
3838
import org.biojava.nbio.structure.align.xml.AFPChainXMLConverter;
3939
import org.biojava.nbio.structure.align.xml.AFPChainXMLParser;
40-
import org.biojava.nbio.structure.geometry.SuperPositionSVD;
4140
import org.biojava.nbio.structure.jama.Matrix;
4241

4342
import java.io.IOException;
@@ -152,7 +151,7 @@ private double getRMSD(AFPChain afpChain, Atom[] ca1, Atom[] ca2)
152151

153152
assertTrue(catmp1.length == afpChain.getNrEQR());
154153

155-
return SuperPositionSVD.getRMS(catmp1,catmp2);
154+
return Calc.rmsd(catmp1,catmp2);
156155
}
157156

158157
public static void rotateAtoms2(AFPChain afpChain,Atom[] ca2){

biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/align/fatcat/FlipAFPChainTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
import org.biojava.nbio.structure.align.xml.AFPChainFlipper;
4242
import org.biojava.nbio.structure.align.xml.AFPChainXMLConverter;
4343
import org.biojava.nbio.structure.align.xml.AFPChainXMLParser;
44-
import org.biojava.nbio.structure.geometry.SuperPositionSVD;
4544
import org.biojava.nbio.structure.jama.Matrix;
4645

4746
import java.io.IOException;
@@ -173,7 +172,7 @@ private double getRMSD(AFPChain afpChain, Atom[] ca1, Atom[] ca2)
173172

174173
assertTrue(catmp1.length == afpChain.getNrEQR());
175174

176-
return SuperPositionSVD.getRMS(catmp1,catmp2);
175+
return Calc.rmsd(catmp1,catmp2);
177176
}
178177

179178
public static void rotateAtoms2(AFPChain afpChain,Atom[] ca2){

biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/align/fatcat/TestFlexibleRotationMatrices.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,18 @@
3535
import org.biojava.nbio.structure.align.util.AtomCache;
3636
import org.biojava.nbio.structure.align.xml.AFPChainXMLConverter;
3737
import org.biojava.nbio.structure.align.xml.AFPChainXMLParser;
38-
import org.biojava.nbio.structure.geometry.SuperPositionSVD;
38+
import org.biojava.nbio.structure.geometry.Matrices;
39+
import org.biojava.nbio.structure.geometry.SuperPositions;
3940
import org.biojava.nbio.structure.jama.Matrix;
4041

4142
import java.io.IOException;
4243
import java.util.ArrayList;
4344
import java.util.List;
4445

45-
46+
import javax.vecmath.Matrix4d;
4647

4748
public class TestFlexibleRotationMatrices extends TestCase{
4849

49-
50-
51-
5250
public void testFlexibleRotationMatrices(){
5351

5452
String name1 = "1a21.A";
@@ -202,7 +200,7 @@ private void compareBlock(int blockNr, AFPChain afpChain, AFPChain newChain,
202200
// calc RMSD
203201

204202

205-
double rmsdFile = SuperPositionSVD.getRMS(blockSet1, blockSet2);
203+
double rmsdFile = Calc.rmsd(blockSet1, blockSet2);
206204

207205
// this is the value from the file. it never seems to match precisely, probably is calculated from initial block.
208206
// we can't reproduce the initial block, since we don;t serialize it.
@@ -211,10 +209,12 @@ private void compareBlock(int blockNr, AFPChain afpChain, AFPChain newChain,
211209

212210
// THIS IS CALCULATING THE "correct" rotation matrix, that should be in the file
213211

214-
SuperPositionSVD svd = new SuperPositionSVD(blockSet1, blockSet2copy);
212+
Matrix4d transform = SuperPositions.superpose(Calc.atomsToPoints(blockSet1),
213+
Calc.atomsToPoints(blockSet2copy));
214+
215215
//double rmsdForce = SVDSuperimposer.getRMS(atomSet1, atomSet2);
216-
Matrix m = svd.getRotation();
217-
Atom s = svd.getTranslation();
216+
Matrix m = Matrices.getRotationJAMA(transform);
217+
Atom s = Calc.getTranslationVector(transform);
218218

219219
Matrix max = maxs2[blockNr];
220220
Atom shift = shifts2[blockNr];
@@ -233,7 +233,7 @@ private void compareBlock(int blockNr, AFPChain afpChain, AFPChain newChain,
233233
Calc.rotate(a, m);
234234
Calc.shift( a, s);
235235
}
236-
double rmsd3 = SuperPositionSVD.getRMS(blockSet1,blockSet2copy);
236+
double rmsd3 = Calc.rmsd(blockSet1,blockSet2copy);
237237

238238
assertTrue("The RMSD values don;t match after rotation / shift for block " + blockNr + "! should be: " + rmsd3 + " but found: " +rmsdFile, compareRmsd(rmsd3, rmsdFile));
239239

0 commit comments

Comments
 (0)