@@ -165,13 +165,13 @@ public void testNucleotideBonds() throws IOException, StructureException {
165165 */
166166 @ Test
167167 public void testHeavyAtomBondMissing () throws IOException , StructureException {
168- assertEquals (testMissingBonds ("3jtm" ), 0 );
169- assertEquals (testMissingBonds ("3jq8" ), 0 );
170- assertEquals (testMissingBonds ("3jq9" ), 0 );
171- assertEquals (testMissingBonds ("3i06" ), 0 );
172- assertEquals (testMissingBonds ("3nu3" ), 0 );
173- assertEquals (testMissingBonds ("3nu4" ), 0 );
174- assertEquals (testMissingBonds ("3nvd" ), 0 );
168+ assertEquals (0 , countAtomsWithoutBonds ("3jtm" ));
169+ assertEquals (0 , countAtomsWithoutBonds ("3jq8" ));
170+ assertEquals (0 , countAtomsWithoutBonds ("3jq9" ));
171+ assertEquals (0 , countAtomsWithoutBonds ("3i06" ));
172+ assertEquals (0 , countAtomsWithoutBonds ("3nu3" ));
173+ assertEquals (0 , countAtomsWithoutBonds ("3nu4" ));
174+ assertEquals (0 , countAtomsWithoutBonds ("3nvd" ));
175175 }
176176
177177
@@ -182,8 +182,8 @@ public void testHeavyAtomBondMissing() throws IOException, StructureException {
182182 */
183183 @ Test
184184 public void testHydrogenToProteinBondMissing () throws IOException , StructureException {
185- assertEquals (testMissingBonds ("4txr" ), 0 );
186- assertEquals (testMissingBonds ("3nvd" ), 0 );
185+ assertEquals (0 , countAtomsWithoutBonds ("4txr" ));
186+ assertEquals (0 , countAtomsWithoutBonds ("3nvd" ));
187187 }
188188
189189 /**
@@ -193,18 +193,19 @@ public void testHydrogenToProteinBondMissing() throws IOException, StructureExce
193193 */
194194 @ Test
195195 public void testAltLocBondMissing () throws IOException , StructureException {
196- assertEquals (testMissingBonds ("4cup" ), 0 );
196+ assertEquals (0 , countAtomsWithoutBonds ("4cup" ));
197197 }
198198
199199 /**
200- *
200+ * Loops through whole structure counting all atoms (in groups larger than 1 atom)
201+ * that have no bonds.
201202 * @throws IOException
202203 * @throws StructureException
203204 */
204- private int testMissingBonds (String pdbId ) throws IOException , StructureException {
205+ private int countAtomsWithoutBonds (String pdbId ) throws IOException , StructureException {
205206 Structure inputStructure = StructureIO .getStructure (pdbId );
206207 // Loop through the structure
207- int nonBondedCounter =0 ;
208+ int nonBondedCounter = 0 ;
208209 for (int i =0 ;i <inputStructure .nrModels ();i ++){
209210 for (Chain c : inputStructure .getChains (i )){
210211 for (Group g : c .getAtomGroups ()){
@@ -230,7 +231,7 @@ private int testMissingBonds(String pdbId) throws IOException, StructureExceptio
230231 return nonBondedCounter ;
231232 }
232233
233- private int testBondedToSelf (String pdbId ) throws IOException , StructureException {
234+ private int countBondedToSelf (String pdbId ) throws IOException , StructureException {
234235 Structure inputStructure = StructureIO .getStructure (pdbId );
235236 int bondedToSelf =0 ;
236237 for (int i =0 ;i <inputStructure .nrModels ();i ++){
@@ -248,12 +249,12 @@ private int testBondedToSelf(String pdbId) throws IOException, StructureExceptio
248249 // Check they all have bonds
249250 for (Atom a : atomsList ){
250251 if (a .getBonds ()!=null ){
251- for (Bond b : a .getBonds ()){
252- if (b .getAtomA ().equals (b .getAtomB ())){
253- bondedToSelf +=1 ;
252+ for (Bond b : a .getBonds ()){
253+ if (b .getAtomA ().equals (b .getAtomB ())){
254+ bondedToSelf +=1 ;
255+ }
254256 }
255257 }
256- }
257258 }
258259 }
259260 }
@@ -299,10 +300,10 @@ public void test1BDX() throws IOException, StructureException {
299300 @ Test
300301 public void testDeuterated () throws IOException , StructureException {
301302 // The terminal Hydrogen D3 - is missing (from the CCD)
302- assertEquals (testMissingBonds ("1GKT" ), 2 );
303- assertEquals (testMissingBonds ("1IO5" ), 2 );
303+ assertEquals (2 , countAtomsWithoutBonds ("1GKT" ));
304+ assertEquals (2 , countAtomsWithoutBonds ("1IO5" ));
304305 // All H/D2,H/D3 errors
305- assertEquals (testMissingBonds ("5E5J" ), 13 );
306+ assertEquals (13 , countAtomsWithoutBonds ("5E5J" ));
306307 }
307308
308309 /**
@@ -313,7 +314,7 @@ public void testDeuterated() throws IOException, StructureException {
313314 */
314315 @ Test
315316 public void testWeirdCase () throws IOException , StructureException {
316- assertEquals (testMissingBonds ("1IU6" ), 6 );
317+ assertEquals (6 , countAtomsWithoutBonds ("1IU6" ));
317318 }
318319
319320
@@ -325,7 +326,7 @@ public void testWeirdCase() throws IOException, StructureException {
325326 @ Test
326327 public void testSSBonds () throws IOException , StructureException {
327328 for (String pdbCode : new String []{"3ZXW" ,"1NTY" , "4H2I" , "2K6D" , "2MLM" }){
328- assertEquals (testBondedToSelf (pdbCode ), 0 );
329+ assertEquals (0 , countBondedToSelf (pdbCode ));
329330 }
330331 }
331332
0 commit comments