|
28 | 28 | import org.biojava.nbio.structure.Structure; |
29 | 29 | import org.biojava.nbio.structure.StructureException; |
30 | 30 | import org.biojava.nbio.structure.StructureIO; |
| 31 | +import org.biojava.nbio.structure.align.util.AtomCache; |
| 32 | +import org.biojava.nbio.structure.cluster.SubunitCluster; |
31 | 33 | import org.biojava.nbio.structure.cluster.SubunitClusterer; |
32 | 34 | import org.biojava.nbio.structure.cluster.SubunitClustererMethod; |
33 | 35 | import org.biojava.nbio.structure.cluster.SubunitClustererParameters; |
@@ -139,6 +141,9 @@ public void testPseudosymmetry() throws IOException, StructureException { |
139 | 141 | @Test |
140 | 142 | public void testLocal() throws IOException, StructureException { |
141 | 143 |
|
| 144 | + AtomCache atomCache = new AtomCache(); |
| 145 | + atomCache.setUseMmtf(true); |
| 146 | + |
142 | 147 | List<String> testIds = new ArrayList<>(); |
143 | 148 | List<String> testStoichiometries = new ArrayList<>(); |
144 | 149 | List<Map<String,String>> testLocalSymmetries = new ArrayList<>(); |
@@ -227,37 +232,42 @@ public void testLocal() throws IOException, StructureException { |
227 | 232 | localSymmetries.put("A6","D3"); |
228 | 233 | testLocalSymmetries.add(localSymmetries); |
229 | 234 |
|
230 | | - // temporarily commented out because it fails when running with maven, TODO debug and bring back - JD 2018-03-10 |
231 | | -// testIds.add("BIO:3JC9:1"); |
232 | | -// testStoichiometries.add("A12B12C12D12E12F12G5H2"); |
233 | | -// localSymmetries = new HashMap<>(); |
234 | | -// localSymmetries.put("A12C12D12E12F12H2","C2"); |
235 | | -// localSymmetries.put("A12B12C12D12E12F12","C12"); |
236 | | -// localSymmetries.put("G5","H"); |
237 | | -// testLocalSymmetries.add(localSymmetries); |
| 235 | + testIds.add("BIO:3JC9:1"); |
| 236 | + testStoichiometries.add("A12B12C12D12E12F12G5H2"); |
| 237 | + localSymmetries = new HashMap<>(); |
| 238 | + localSymmetries.put("A12C12D12E12F12H2","C2"); |
| 239 | + localSymmetries.put("A12B12C12D12E12F12","C12"); |
| 240 | + localSymmetries.put("G5","H"); |
| 241 | + testLocalSymmetries.add(localSymmetries); |
238 | 242 |
|
239 | 243 | QuatSymmetryParameters symmParams = new QuatSymmetryParameters(); |
240 | 244 | SubunitClustererParameters clusterParams = new SubunitClustererParameters(true); |
241 | 245 | clusterParams.setClustererMethod(SubunitClustererMethod.SEQUENCE); |
242 | 246 | clusterParams.setSequenceIdentityThreshold(0.75); |
243 | 247 |
|
244 | 248 | for(int iTest = 0; iTest<testIds.size();iTest++) { |
245 | | - logger.info(testIds.get(iTest)); |
246 | | - Structure pdb = StructureIO.getStructure(testIds.get(iTest)); |
| 249 | + logger.info("Processing "+testIds.get(iTest)); |
| 250 | + Structure pdb = atomCache.getStructure(testIds.get(iTest)); |
247 | 251 | Stoichiometry composition = SubunitClusterer.cluster(pdb,clusterParams); |
248 | 252 |
|
249 | 253 | // no global symmetry |
250 | 254 | QuatSymmetryResults globalSymmetry = QuatSymmetryDetector.calcGlobalSymmetry(composition,symmParams); |
251 | | - assertEquals("C1", globalSymmetry.getSymmetry()); |
252 | | - assertEquals(testStoichiometries.get(iTest), globalSymmetry.getStoichiometry().toString()); |
| 255 | + assertEquals("Unexpected global symmetry in "+testIds.get(iTest), |
| 256 | + "C1", globalSymmetry.getSymmetry()); |
| 257 | + assertEquals("Unexpected global stoichiometry in "+testIds.get(iTest), |
| 258 | + testStoichiometries.get(iTest), globalSymmetry.getStoichiometry().toString()); |
253 | 259 |
|
254 | 260 | List<QuatSymmetryResults> foundLocal = QuatSymmetryDetector.calcLocalSymmetries(composition, symmParams); |
255 | 261 | Map<String,String> refLocal = testLocalSymmetries.get(iTest); |
256 | 262 |
|
257 | 263 | for (QuatSymmetryResults local:foundLocal) { |
258 | | - logger.info(local.getStoichiometry().toString()); |
259 | | - assertTrue(refLocal.keySet().contains(local.getStoichiometry().toString())); |
260 | | - assertEquals(refLocal.get(local.getStoichiometry().toString()),local.getSymmetry()); |
| 264 | + logger.info("Found stoichiometry "+local.getStoichiometry().toString()+" with symmetry "+local.getSymmetry()); |
| 265 | + assertTrue("Stoichiometry "+local.getStoichiometry().toString()+" not expected for "+testIds.get(iTest), |
| 266 | + refLocal.keySet().contains(local.getStoichiometry().toString())); |
| 267 | + |
| 268 | + assertEquals("Symmetry "+local.getSymmetry()+" with stoichiometry "+local.getStoichiometry().toString()+ |
| 269 | + " not expected for "+testIds.get(iTest), |
| 270 | + refLocal.get(local.getStoichiometry().toString()),local.getSymmetry()); |
261 | 271 | } |
262 | 272 | } |
263 | 273 | } |
|
0 commit comments