JAL-1919 Added improvement to ensure consistence of annotations parsed via JmolParser...
authortcofoegbu <tcnofoegbu@dundee.ac.uk>
Mon, 15 Aug 2016 13:53:58 +0000 (14:53 +0100)
committertcofoegbu <tcnofoegbu@dundee.ac.uk>
Mon, 15 Aug 2016 13:53:58 +0000 (14:53 +0100)
src/MCview/Atom.java
src/jalview/ext/jmol/JmolParser.java
test/MCview/AtomTest.java
test/jalview/io/AnnotatedPDBFileInputTest.java
test/jalview/structure/StructureSelectionManagerTest.java

index ab038a0..fe6a0ac 100755 (executable)
@@ -81,7 +81,7 @@ public class Atom
     chain = str.substring(21, 22);
 
     resNumber = Integer.parseInt(str.substring(22, 26).trim());
-    resNumIns = str.substring(22, 27);
+    resNumIns = str.substring(22, 27).trim();
     insCode = str.substring(26, 27).charAt(0);
     this.x = (new Float(str.substring(30, 38).trim()).floatValue());
     this.y = (new Float(str.substring(38, 46).trim()).floatValue());
index ea969ff..848e7db 100644 (file)
@@ -217,7 +217,8 @@ public class JmolParser extends StructureFile implements JmolStatusListener
         curAtom.resNumber = atom.getResno();
         curAtom.occupancy = ms.occupancies != null ? ms.occupancies[atom
                 .getIndex()] : Float.valueOf(atom.getOccupancy100());
-        curAtom.resNumIns = "" + curAtom.resNumber + curAtom.insCode;
+        curAtom.resNumIns = ("" + curAtom.resNumber + curAtom.insCode)
+                .trim();
         curAtom.tfactor = atom.getBfactor100() / 100f;
         curAtom.type = 0;
         // significantAtoms.add(curAtom);
index 33d332a..21a79fe 100644 (file)
@@ -42,7 +42,7 @@ public class AtomTest
     assertEquals("GLN", a.resName);
     assertEquals("A", a.chain);
     assertEquals(48, a.resNumber);
-    assertEquals("  48 ", a.resNumIns);
+    assertEquals("48", a.resNumIns);
     assertEquals(' ', a.insCode);
     assertEquals(22.290, a.x, 0.00001);
     assertEquals(8.595, a.y, 0.00001);
index e6019aa..d3d9ff8 100644 (file)
@@ -68,8 +68,8 @@ public class AnnotatedPDBFileInputTest
     pdbId = al.getSequenceAt(0).getDatasetSequence().getAllPDBEntries()
             .get(0).getId();
     StructureImportSettings.setDefaultStructureFileFormat("PDB");
-    StructureImportSettings
-            .setDefaultPDBFileParser(StructureParser.JALVIEW_PARSER);
+    // StructureImportSettings
+    // .setDefaultPDBFileParser(StructureParser.JALVIEW_PARSER);
   }
 
   @Test(groups = { "Functional" })
@@ -101,7 +101,11 @@ public class AnnotatedPDBFileInputTest
       {
 
         System.out.println("CalcId: " + aa.getCalcId());
+        if (StructureImportSettings.getDefaultPDBFileParser().equals(
+                StructureParser.JALVIEW_PARSER))
+        {
         assertTrue(MCview.PDBfile.isCalcIdForFile(aa, pdbId));
+        }
       }
     }
   }
@@ -118,9 +122,9 @@ public class AnnotatedPDBFileInputTest
     SequenceFeature[] sf = al.getSequenceAt(0).getSequenceFeatures();
     assertEquals(296, sf.length);
     assertEquals("RESNUM", sf[0].getType());
-    assertEquals("GLU:  19  1gaqA", sf[0].getDescription());
+    assertEquals("GLU:19 1gaqA", sf[0].getDescription());
     assertEquals("RESNUM", sf[295].getType());
-    assertEquals("TYR: 314  1gaqA", sf[295].getDescription());
+    assertEquals("TYR:314 1gaqA", sf[295].getDescription());
 
     /*
      * 1GAQ/B
@@ -128,9 +132,9 @@ public class AnnotatedPDBFileInputTest
     sf = al.getSequenceAt(1).getSequenceFeatures();
     assertEquals(98, sf.length);
     assertEquals("RESNUM", sf[0].getType());
-    assertEquals("ALA:   1  1gaqB", sf[0].getDescription());
+    assertEquals("ALA:1 1gaqB", sf[0].getDescription());
     assertEquals("RESNUM", sf[97].getType());
-    assertEquals("ALA:  98  1gaqB", sf[97].getDescription());
+    assertEquals("ALA:98 1gaqB", sf[97].getDescription());
 
     /*
      * 1GAQ/C
@@ -138,9 +142,9 @@ public class AnnotatedPDBFileInputTest
     sf = al.getSequenceAt(2).getSequenceFeatures();
     assertEquals(296, sf.length);
     assertEquals("RESNUM", sf[0].getType());
-    assertEquals("GLU:  19  1gaqC", sf[0].getDescription());
+    assertEquals("GLU:19 1gaqC", sf[0].getDescription());
     assertEquals("RESNUM", sf[295].getType());
-    assertEquals("TYR: 314  1gaqC", sf[295].getDescription());
+    assertEquals("TYR:314 1gaqC", sf[295].getDescription());
   }
 
   @Test(groups = { "Functional" })
index 2074fb4..baaa96b 100644 (file)
@@ -138,7 +138,7 @@ public class StructureSelectionManagerTest
     SequenceFeature sf = pmap.getSeqs().get(0).getSequenceFeatures()[0];
     assertEquals("RESNUM", sf.getType());
     assertEquals("1gaq", sf.getFeatureGroup());
-    assertEquals("GLU:  19  1gaqA", sf.getDescription());
+    assertEquals("GLU:19 1gaqA", sf.getDescription());
 
     /*
      * Verify a RESNUM sequence feature in the StructureSelectionManager mapped
@@ -148,6 +148,6 @@ public class StructureSelectionManagerTest
     sf = map.sequence.getSequenceFeatures()[0];
     assertEquals("RESNUM", sf.getType());
     assertEquals("1gaq", sf.getFeatureGroup());
-    assertEquals("ALA:   1  1gaqB", sf.getDescription());
+    assertEquals("ALA:1 1gaqB", sf.getDescription());
   }
 }