JAL-1919 updated PDBSequenceFetcherTest and JMol parser config settings to enable...
authortcofoegbu <tcnofoegbu@dundee.ac.uk>
Thu, 30 Jun 2016 09:46:51 +0000 (10:46 +0100)
committertcofoegbu <tcnofoegbu@dundee.ac.uk>
Thu, 30 Jun 2016 09:46:51 +0000 (10:46 +0100)
src/MCview/PDBChain.java
src/jalview/bin/Cache.java
src/jalview/ext/jmol/JmolParser.java
src/jalview/io/AppletFormatAdapter.java
src/jalview/structure/StructureViewSettings.java
src/jalview/ws/dbsources/Pdb.java
test/jalview/ws/PDBSequenceFetcherTest.java

index 3b84ee3..073772a 100755 (executable)
@@ -357,18 +357,6 @@ public class PDBChain
       else
       {
 
-        // boolean baseDetected = false;
-        // for (Atom resAtom : resAtoms)
-        // {
-        // if (resAtom.insCode == ' ')
-        // {
-        // baseDetected = true;
-        // }
-        // }
-        // if (!baseDetected)
-        // {
-        // continue;
-        // }
       // Make a new Residue object with the new atoms vector
       residues.addElement(new Residue(resAtoms, resNumber - 1, count));
 
@@ -378,7 +366,6 @@ public class PDBChain
         SequenceFeature sf = new SequenceFeature("RESNUM", tmpat.resName
               + ":" + tmpat.resNumIns + " " + pdbid + id, "", offset
               + count, offset + count, pdbid);
-      // MCview.PDBChain.PDBFILEFEATURE);
       resFeatures.addElement(sf);
       resAnnotation.addElement(new Annotation(tmpat.tfactor));
       // Keep totting up the sequence
index 38aa55f..dde67de 100755 (executable)
@@ -21,7 +21,7 @@
 package jalview.bin;
 
 import jalview.datamodel.DBRefSource;
-import jalview.ws.dbsources.Pdb;
+import jalview.structure.StructureViewSettings;
 import jalview.ws.dbsources.das.api.DasSourceRegistryI;
 import jalview.ws.dbsources.das.datamodel.DasSourceRegistry;
 import jalview.ws.sifts.SiftsSettings;
@@ -426,7 +426,8 @@ public class Cache
     System.out
             .println("Jalview Version: " + codeVersion + codeInstallation);
 
-    Pdb.setCurrentDefaultFormat(jalview.bin.Cache.getDefault(
+    StructureViewSettings.setCurrentDefaultFormat(jalview.bin.Cache
+            .getDefault(
             "DEFAULT_STRUCTURE_FORMAT", DEFAULT_STRUCTURE_FORMAT));
     // jnlpVersion will be null if we're using InstallAnywhere
     // Dont do this check if running in headless mode
index 0cbd620..31ed1b7 100644 (file)
@@ -206,6 +206,12 @@ public class JmolParser extends StructureFile implements JmolStatusListener
     List<Atom> significantAtoms = new ArrayList<Atom>();
     for (org.jmol.modelset.Atom atom : ms.at)
     {
+      System.out.println("Seq Id : " + atom.getSeqID());
+      System.out.println("To String : " + atom.toString());
+      if (atom.isHetero())
+      {
+        continue;
+      }
       if (atom.getAtomName().equalsIgnoreCase("CA")
               || atom.getAtomName().equalsIgnoreCase("P"))
       {
index 1a639f1..42a8ead 100755 (executable)
@@ -280,7 +280,8 @@ public class AppletFormatAdapter
       {
         // TODO obtain config value from preference settings.
         // Set value to 'true' to test PDB processing with Jmol: JAL-1213
-        boolean isParseWithJMOL = false;
+        boolean isParseWithJMOL = !StructureViewSettings
+                .getCurrentDefaultFormat().equalsIgnoreCase("PDB");
         if (isParseWithJMOL)
         {
           StructureViewSettings.addSettings(annotFromStructure,
@@ -291,6 +292,8 @@ public class AppletFormatAdapter
         }
         else
         {
+          StructureViewSettings.addSettings(annotFromStructure,
+                  localSecondaryStruct, serviceSecondaryStruct);
           StructureViewSettings.setShowSeqFeatures(true);
           alignFile = new MCview.PDBfile(annotFromStructure,
                   localSecondaryStruct, serviceSecondaryStruct, inFile,
index 2fcb3e5..5880d0f 100644 (file)
@@ -1,5 +1,7 @@
 package jalview.structure;
 
+import jalview.datamodel.DBRefSource;
+
 public class StructureViewSettings
 {
   private String dbRefType;
@@ -24,6 +26,8 @@ public class StructureViewSettings
 
   private static boolean showSeqFeatures = true;
 
+  private static String currentDefaultFormat = DBRefSource.PDB;
+
   public static void addSettings(boolean addAlignmentAnnotations,
           boolean predictSecStr, boolean externalSecStr)
   {
@@ -76,4 +80,14 @@ public class StructureViewSettings
     StructureViewSettings.showSeqFeatures = showSeqFeatures;
   }
 
+  public static String getCurrentDefaultFormat()
+  {
+    return currentDefaultFormat;
+  }
+
+  public static void setCurrentDefaultFormat(String currentDefaultFormat)
+  {
+    StructureViewSettings.currentDefaultFormat = currentDefaultFormat;
+  }
+
 }
index b0b5e92..d3a6238 100644 (file)
@@ -30,6 +30,7 @@ import jalview.datamodel.PDBEntry;
 import jalview.datamodel.SequenceI;
 import jalview.io.FormatAdapter;
 import jalview.io.PDBFeatureSettings;
+import jalview.structure.StructureViewSettings;
 import jalview.util.MessageManager;
 import jalview.ws.ebi.EBIFetchClient;
 
@@ -54,8 +55,6 @@ public class Pdb extends EbiFileRetrievedProxy
 
   public static final String FEATURE_RES_NUM = "RESNUM";
 
-  private static String currentDefaultFormat = DBRefSource.PDB;
-
   /*
    * (non-Javadoc)
    * 
@@ -133,11 +132,13 @@ public class Pdb extends EbiFileRetrievedProxy
       stopQuery();
       return null;
     }
-    String ext = getCurrentDefaultFormat().equalsIgnoreCase("mmcif") ? ".cif"
+    String ext = StructureViewSettings.getCurrentDefaultFormat()
+            .equalsIgnoreCase("mmcif") ? ".cif"
             : ".xml";
     EBIFetchClient ebi = new EBIFetchClient();
     file = ebi.fetchDataAsFile("pdb:" + id,
-            getCurrentDefaultFormat().toLowerCase(), ext)
+            StructureViewSettings.getCurrentDefaultFormat().toLowerCase(),
+            ext)
             .getAbsolutePath();
     stopQuery();
     if (file == null)
@@ -149,7 +150,7 @@ public class Pdb extends EbiFileRetrievedProxy
 
       pdbAlignment = new FormatAdapter().readFile(file,
               jalview.io.AppletFormatAdapter.FILE,
-              getCurrentDefaultFormat());
+              StructureViewSettings.getCurrentDefaultFormat());
       if (pdbAlignment != null)
       {
         List<SequenceI> toremove = new ArrayList<SequenceI>();
@@ -264,15 +265,6 @@ public class Pdb extends EbiFileRetrievedProxy
     return 0;
   }
 
-  public static String getCurrentDefaultFormat()
-  {
-    return currentDefaultFormat;
-  }
-
-  public static void setCurrentDefaultFormat(String currentDefaultFomart)
-  {
-    Pdb.currentDefaultFormat = currentDefaultFomart;
-  }
 
   /**
    * Returns a descriptor for suitable feature display settings with
index b560f01..27d2643 100644 (file)
@@ -25,6 +25,7 @@ import static org.testng.AssertJUnit.assertTrue;
 import jalview.bin.Cache;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.SequenceI;
+import jalview.structure.StructureViewSettings;
 import jalview.ws.seqfetcher.DbSourceProxy;
 
 import java.util.List;
@@ -60,6 +61,10 @@ public class PDBSequenceFetcherTest
   @Test(groups = { "Network" }, enabled = true)
   public void testRnaSeqRetrieve() throws Exception
   {
+    Cache.applicationProperties.setProperty("STRUCT_FROM_PDB",
+            Boolean.TRUE.toString());
+    Cache.applicationProperties.setProperty("DEFAULT_STRUCTURE_FORMAT",
+            "PDB");
     List<DbSourceProxy> sps = sf.getSourceProxy("PDB");
     AlignmentI response = sps.get(0).getSequenceRecords("2GIS");
     assertTrue(response != null);
@@ -81,6 +86,8 @@ public class PDBSequenceFetcherTest
   {
     Cache.applicationProperties.setProperty("STRUCT_FROM_PDB",
             Boolean.TRUE.toString());
+    StructureViewSettings.setCurrentDefaultFormat("PDB");
+
     testRetrieveProteinSeqFromPDB();
   }
 
@@ -88,7 +95,8 @@ public class PDBSequenceFetcherTest
   public void testmmCifSeqRetrieve() throws Exception
   {
     Cache.applicationProperties.setProperty("STRUCT_FROM_PDB",
-            Boolean.FALSE.toString());
+            Boolean.TRUE.toString());
+    StructureViewSettings.setCurrentDefaultFormat("mmCIF");
     testRetrieveProteinSeqFromPDB();
   }