3131import java .util .List ;
3232import java .util .Map ;
3333
34- import static org .junit .Assert .assertEquals ;
35- import static org .junit .Assert .assertTrue ;
34+ import static org .junit .Assert .*;
3635
3736public class TestQuaternaryStructureProviders {
3837
@@ -51,35 +50,20 @@ public void test3FAD() throws IOException, StructureException{
5150 public void test5LDH () throws IOException , StructureException {
5251 comparePdbVsMmcif ("5LDH" ,1 , 4 );
5352
54- // the pdb file of 5ldh contains only 1 bioassembly, whilst the mmcif contains 2,
55- // thus we can't test here the comparison between the 2
56- //testID("5LDH",2, 2);
53+ // Note 1: since v5 remediation there's 4 bioassemblies with numerical ids for 5ldh, no more PAU and XAU
54+ // Note 2: before March 2024 remediation, this entry had 4 assemblies. Now only 1
5755
58- // since v5 remediation there's 4 bioassemblies with numerical ids for 5ldh, no more PAU and XAU
56+ // bioassembly 1 does exist in mmcif file, let's check that
5957 boolean gotException = false ;
6058 try {
6159 AtomCache cache = new AtomCache ();
6260 cache .setFiletype (StructureFiletype .CIF );
6361 StructureIO .setAtomCache (cache );
64- StructureIO .getBiologicalAssembly ("5LDH" ,3 );
62+ StructureIO .getBiologicalAssembly ("5LDH" ,1 );
6563 } catch (StructureException e ) {
6664 gotException = true ;
6765 }
68-
69- assertTrue ("Bioassembly 3 for PDB id 5LDH should fail with a StructureException!" , !gotException );
70-
71- // bioassembly 2 does exist in mmcif file, let's check that
72- gotException = false ;
73- try {
74- AtomCache cache = new AtomCache ();
75- cache .setFiletype (StructureFiletype .CIF );
76- StructureIO .setAtomCache (cache );
77- StructureIO .getBiologicalAssembly ("5LDH" ,2 );
78- } catch (StructureException e ) {
79- gotException = true ;
80- }
81- assertTrue ("Bioassembly 2 for PDB id 5LDH should not fail with a StructureException!" , !gotException );
82-
66+ assertFalse ("Bioassembly 1 for PDB id 5LDH should exist and not fail with a StructureException!" , gotException );
8367 }
8468
8569 @ Test
@@ -94,17 +78,9 @@ public void test1A29() throws IOException, StructureException{
9478
9579 @ Test
9680 public void test1EI7 () throws IOException , StructureException {
97-
9881 comparePdbVsMmcif ("1ei7" ,1 , 68 );
99-
10082 }
10183
102- @ Test
103- public void testGetNrBioAssemblies5LDH () throws IOException , StructureException {
104- assertEquals ("There should be 4 bioassemblies for 5LDH, see github issue #230" , 4 , StructureIO .getBiologicalAssemblies ("5LDH" ).size ());
105- }
106-
107-
10884 /**
10985 * Bioassembly tests for a single PDB entry
11086 * @param pdbId
@@ -115,9 +91,7 @@ public void testGetNrBioAssemblies5LDH() throws IOException, StructureException
11591 */
11692 private void comparePdbVsMmcif (String pdbId , int bioMolecule , int mmSize ) throws IOException , StructureException {
11793
118-
11994 Structure pdbS = getPdbBioAssembly (pdbId , bioMolecule , true );
120-
12195 Structure mmcifS = getMmcifBioAssembly (pdbId , bioMolecule , true );
12296
12397 PDBHeader pHeader = pdbS .getPDBHeader ();
@@ -129,16 +103,13 @@ private void comparePdbVsMmcif(String pdbId, int bioMolecule, int mmSize) throws
129103 // mmcif files contain sometimes partial virus assemblies, so they can contain more info than pdb
130104 assertTrue (pHeader .getNrBioAssemblies () <= mHeader .getNrBioAssemblies ());
131105
132-
133106 Map <Integer , BioAssemblyInfo > pMap = pHeader .getBioAssemblies ();
134107 Map <Integer , BioAssemblyInfo > mMap = mHeader .getBioAssemblies ();
135108
136-
137109 assertTrue (pMap .keySet ().size ()<= mMap .keySet ().size ());
138110
139111 assertEquals (mmSize , mMap .get (bioMolecule ).getMacromolecularSize ());
140112
141-
142113 for ( int k : pMap .keySet ()) {
143114 assertTrue (mMap .containsKey (k ));
144115
@@ -154,45 +125,32 @@ private void comparePdbVsMmcif(String pdbId, int bioMolecule, int mmSize) throws
154125
155126 //assertEquals(pL.size(), mL.size());
156127
157-
158- for (BiologicalAssemblyTransformation m1 : pL ){
159-
128+ for (BiologicalAssemblyTransformation m1 : pL ) {
160129 boolean found = false ;
161- for ( BiologicalAssemblyTransformation m2 : mL ){
162-
163- if (! m1 .getChainId ().equals (m2 .getChainId ()))
130+ for (BiologicalAssemblyTransformation m2 : mL ) {
131+ if (! m1 .getChainId ().equals (m2 .getChainId ()))
164132 continue ;
165133
166- if ( ! m1 .getTransformationMatrix ().epsilonEquals (m2 .getTransformationMatrix (), 0.0001 ))
134+ if (! m1 .getTransformationMatrix ().epsilonEquals (m2 .getTransformationMatrix (), 0.0001 ))
167135 continue ;
168136
169137 found = true ;
170-
171138 }
172-
173- if ( ! found ){
139+ if (! found ) {
174140 System .err .println ("did not find matching matrix " + m1 );
175141 System .err .println (mL );
176142 }
177143 assertTrue (found );
178-
179144 }
180145 }
181146
182-
183147 assertEquals ("Not the same number of chains!" , pdbS .size (),mmcifS .size ());
184148
185149 Atom [] pdbA = StructureTools .getAllAtomArray (pdbS );
186-
187150 Atom [] mmcifA = StructureTools .getAllAtomArray (mmcifS );
188151
189152 assertEquals (pdbA .length , mmcifA .length );
190-
191153 assertEquals (pdbA [0 ].toPDB (), mmcifA [0 ].toPDB ());
192-
193-
194-
195-
196154 }
197155
198156 private Structure getPdbBioAssembly (String pdbId , int bioMolecule , boolean multiModel ) throws IOException , StructureException {
@@ -213,6 +171,4 @@ private Structure getMmcifBioAssembly(String pdbId, int bioMolecule, boolean mul
213171 return mmcifS ;
214172 }
215173
216-
217-
218174}
0 commit comments