merge from develop
[jalview.git] / test / jalview / io / AnnotatedPDBFileInputTest.java
index 31bfd9d..91e816a 100644 (file)
@@ -11,9 +11,6 @@ import jalview.datamodel.PDBEntry;
 import jalview.datamodel.SequenceFeature;
 import jalview.datamodel.SequenceI;
 import jalview.gui.AlignFrame;
-import jalview.gui.Desktop;
-import jalview.structure.StructureMapping;
-import jalview.structure.StructureSelectionManager;
 
 import java.io.File;
 
@@ -28,10 +25,14 @@ public class AnnotatedPDBFileInputTest
 
   AlignmentI al;
 
-  String pdbStr = "examples/1gaq.txt";
-
   String pdbId;
 
+  /**
+   * Ensure 'process secondary structure from PDB and add annotations' are set
+   * in preferences, and load PDB example file 1gaq
+   * 
+   * @throws Exception
+   */
  @BeforeMethod(alwaysRun = true)
   public void setup() throws Exception
   {
@@ -40,10 +41,10 @@ public class AnnotatedPDBFileInputTest
     Cache.applicationProperties.setProperty("ADD_SS_ANN",
             Boolean.TRUE.toString());
     FileLoader loader = new FileLoader(false);
-    AlignFrame af = loader.LoadFileWaitTillLoaded(pdbStr,
+    AlignFrame af = loader.LoadFileWaitTillLoaded("examples/1gaq.txt",
             FormatAdapter.FILE);
     al = af.getViewport().getAlignment();
-    pdbId = al.getSequenceAt(0).getDatasetSequence().getPDBId()
+    pdbId = al.getSequenceAt(0).getDatasetSequence().getAllPDBEntries()
             .get(0).getId();
   }
 
@@ -88,20 +89,15 @@ public class AnnotatedPDBFileInputTest
   @Test(groups ={ "Functional" })
   public void checkPDBSequenceFeatures()
   {
-    StructureSelectionManager ssm = StructureSelectionManager
-            .getStructureSelectionManager(Desktop.instance);
-    StructureMapping[] mappings = ssm.getMapping("1gaq");
-    // suspect we really want to make assertions on sequence features
-    // in these mappings' sequencess
     /*
      * 1GAQ/A
      */
     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
@@ -109,9 +105,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
@@ -119,9 +115,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" })
@@ -159,8 +155,8 @@ public class AnnotatedPDBFileInputTest
   @BeforeClass(alwaysRun = true)
   public static void setUpBeforeClass() throws Exception
   {
-    jalview.bin.Jalview.main(new String[]
-    { "-props", "test/src/jalview/io/testProps.jvprops" });
+    jalview.bin.Jalview.main(new String[] { "-props",
+        "test/jalview/io/testProps.jvprops" });
   }
 
   /**
@@ -197,9 +193,9 @@ public class AnnotatedPDBFileInputTest
       {
         sq = sq.getDatasetSequence();
       }
-      assertNotNull(sq.getPDBId());
-      assertEquals("Expected only one PDB ID", sq.getPDBId().size(), 1);
-      for (PDBEntry pdbentry : sq.getPDBId())
+      assertNotNull(sq.getAllPDBEntries());
+      assertEquals("Expected only one PDB ID", sq.getAllPDBEntries().size(), 1);
+      for (PDBEntry pdbentry : sq.getAllPDBEntries())
       {
         System.err.println("PDB Entry " + pdbentry.getId() + " "
                 + pdbentry.getFile());