JAL-2164 removed unused parameters from JmolParser constructor
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 16 Sep 2016 09:31:11 +0000 (10:31 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 16 Sep 2016 09:31:11 +0000 (10:31 +0100)
src/jalview/ext/jmol/JmolParser.java
src/jalview/io/AppletFormatAdapter.java
src/jalview/io/StructureFile.java
src/jalview/structure/StructureSelectionManager.java
test/MCview/PDBfileTest.java
test/jalview/ext/jmol/JmolParserTest.java
test/jalview/ext/jmol/JmolVsJalviewPDBParserEndToEndTest.java

index ddb4492..cef552f 100644 (file)
@@ -61,15 +61,13 @@ public class JmolParser extends StructureFile implements JmolStatusListener
 {
   Viewer viewer = null;
 
-  public JmolParser(boolean addAlignmentAnnotations, boolean predictSecStr,
-          boolean externalSecStr, String inFile, String type)
+  public JmolParser(String inFile, String type)
           throws IOException
   {
     super(inFile, type);
   }
 
-  public JmolParser(boolean addAlignmentAnnotations, boolean predictSecStr,
-          boolean externalSecStr, FileParse fp) throws IOException
+  public JmolParser(FileParse fp) throws IOException
   {
     super(fp);
   }
index da7eb1d..552f00e 100755 (executable)
@@ -27,6 +27,7 @@ import jalview.datamodel.AlignmentAnnotation;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.AlignmentView;
 import jalview.datamodel.PDBEntry.Type;
+import jalview.ext.jmol.JmolParser;
 import jalview.structure.StructureImportSettings;
 import jalview.util.MessageManager;
 
@@ -277,22 +278,11 @@ public class AppletFormatAdapter
         alignFile = new JPredFile(inFile, type);
         ((JPredFile) alignFile).removeNonSequences();
       }
-      else if (format.equals("PDB"))
-      {
-
-          StructureImportSettings.addSettings(annotFromStructure,
-                  localSecondaryStruct, serviceSecondaryStruct);
-          alignFile = new jalview.ext.jmol.JmolParser(annotFromStructure,
-                  localSecondaryStruct, serviceSecondaryStruct, inFile,
-                  type);
-        ((StructureFile) alignFile).setDbRefType(format);
-      }
-      else if (format.equalsIgnoreCase("mmCIF"))
+      else if (format.equals("PDB") || format.equalsIgnoreCase("mmCIF"))
       {
         StructureImportSettings.addSettings(annotFromStructure,
                 localSecondaryStruct, serviceSecondaryStruct);
-        alignFile = new jalview.ext.jmol.JmolParser(annotFromStructure,
-                localSecondaryStruct, serviceSecondaryStruct, inFile, type);
+        alignFile = new JmolParser(inFile, type);
         ((StructureFile) alignFile).setDbRefType(format);
       }
       else if (format.equals("STH"))
@@ -426,8 +416,7 @@ public class AppletFormatAdapter
         {
           StructureImportSettings.addSettings(annotFromStructure,
                   localSecondaryStruct, serviceSecondaryStruct);
-          alignFile = new jalview.ext.jmol.JmolParser(annotFromStructure,
-                  localSecondaryStruct, serviceSecondaryStruct, source);
+          alignFile = new JmolParser(source);
         }
         else
         {
@@ -441,8 +430,7 @@ public class AppletFormatAdapter
       {
         StructureImportSettings.addSettings(annotFromStructure,
                 localSecondaryStruct, serviceSecondaryStruct);
-        alignFile = new jalview.ext.jmol.JmolParser(annotFromStructure,
-                localSecondaryStruct, serviceSecondaryStruct, source);
+        alignFile = new JmolParser(source);
         ((StructureFile) alignFile).setDbRefType(Type.MMCIF);
       }
       else if (format.equals("STH"))
index 4a6a1c2..0bc6a73 100644 (file)
@@ -285,11 +285,10 @@ public abstract class StructureFile extends AlignFile
       Class cl = Class.forName("jalview.ext.jmol.JmolParser");
       if (cl != null)
       {
-        final Constructor constructor = cl.getConstructor(new Class[] {
-            boolean.class, boolean.class, boolean.class, FileParse.class });
-        final Object[] args = new Object[] { visibleChainAnnotation,
-            predictSecondaryStructure, externalSecondaryStructure,
-            new FileParse(getDataName(), type) };
+        final Constructor constructor = cl
+                .getConstructor(new Class[] { FileParse.class });
+        final Object[] args = new Object[] { new FileParse(getDataName(),
+                type) };
 
         StructureImportSettings.setShowSeqFeatures(false);
         StructureImportSettings.setVisibleChainAnnotation(false);
index 7db85ff..7b103be 100644 (file)
@@ -32,6 +32,7 @@ import jalview.datamodel.Annotation;
 import jalview.datamodel.PDBEntry;
 import jalview.datamodel.SearchResults;
 import jalview.datamodel.SequenceI;
+import jalview.ext.jmol.JmolParser;
 import jalview.gui.IProgressIndicator;
 import jalview.io.AppletFormatAdapter;
 import jalview.io.StructureFile;
@@ -384,8 +385,7 @@ public class StructureSelectionManager
     boolean isMapUsingSIFTs = SiftsSettings.isMapWithSifts();
     try
     {
-        pdb = new jalview.ext.jmol.JmolParser(addTempFacAnnot, parseSecStr,
-                secStructServices, pdbFile, protocol);
+      pdb = new JmolParser(pdbFile, protocol);
 
       if (pdb.getId() != null && pdb.getId().trim().length() > 0
               && AppletFormatAdapter.FILE.equals(protocol))
index a6a1de4..8e2e2fe 100644 (file)
@@ -26,6 +26,7 @@ import static org.testng.AssertJUnit.assertNull;
 import static org.testng.AssertJUnit.assertSame;
 import static org.testng.AssertJUnit.assertTrue;
 
+import jalview.bin.Cache;
 import jalview.datamodel.Alignment;
 import jalview.datamodel.AlignmentAnnotation;
 import jalview.datamodel.AlignmentI;
@@ -33,10 +34,12 @@ import jalview.datamodel.PDBEntry;
 import jalview.datamodel.Sequence;
 import jalview.datamodel.SequenceI;
 import jalview.io.AppletFormatAdapter;
+import jalview.structure.StructureImportSettings;
 
 import java.io.IOException;
 import java.util.List;
 
+import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
 public class PDBfileTest
@@ -307,4 +310,19 @@ public class PDBfileTest
     pf.addAnnotations(al);
     return al.getAlignmentAnnotation();
   }
+
+  //@formatter:on
+  
+  @BeforeMethod(alwaysRun = true)
+  public void setUp()
+  {
+    Cache.loadProperties("test/jalview/io/testProps.jvprops");
+    Cache.applicationProperties.setProperty("STRUCT_FROM_PDB",
+            Boolean.TRUE.toString());
+    Cache.applicationProperties.setProperty("ADD_TEMPFACT_ANN",
+            Boolean.TRUE.toString());
+    Cache.applicationProperties.setProperty("ADD_SS_ANN",
+            Boolean.TRUE.toString());
+    StructureImportSettings.setDefaultStructureFileFormat("PDB");
+  }
 }
index 43b23a2..8788609 100644 (file)
@@ -114,8 +114,7 @@ public class JmolParserTest
     {
       PDBfile mctest = new PDBfile(false, false, false, pdbStr,
               AppletFormatAdapter.FILE);
-      JmolParser jtest = new JmolParser(false, false, false, pdbStr,
-              jalview.io.AppletFormatAdapter.FILE);
+      JmolParser jtest = new JmolParser(pdbStr, AppletFormatAdapter.FILE);
       Vector<SequenceI> seqs = jtest.getSeqs(), mcseqs = mctest.getSeqs();
 
       assertTrue(
@@ -182,13 +181,8 @@ public class JmolParserTest
     PDBfile mctest = new PDBfile(false, false, false,
             pastePDBDataWithChainBreak,
             AppletFormatAdapter.PASTE);
-    boolean annotFromStructure = false;
-    boolean localSecondaryStruct = false;
-    boolean serviceSecondaryStruct = false;
-    JmolParser jtest = new JmolParser(annotFromStructure,
-            localSecondaryStruct, serviceSecondaryStruct,
-            pastePDBDataWithChainBreak,
-            jalview.io.AppletFormatAdapter.PASTE);
+    JmolParser jtest = new JmolParser(pastePDBDataWithChainBreak,
+            AppletFormatAdapter.PASTE);
     Vector<SequenceI> seqs = jtest.getSeqs();
     Vector<SequenceI> mcseqs = mctest.getSeqs();
 
@@ -210,12 +204,8 @@ public class JmolParserTest
   {
     PDBfile mctest = new PDBfile(false, false, false, pdbWithAltLoc,
             AppletFormatAdapter.PASTE);
-    boolean annotFromStructure = false;
-    boolean localSecondaryStruct = false;
-    boolean serviceSecondaryStruct = false;
-    JmolParser jtest = new JmolParser(annotFromStructure,
-            localSecondaryStruct, serviceSecondaryStruct, pdbWithAltLoc,
-            jalview.io.AppletFormatAdapter.PASTE);
+    JmolParser jtest = new JmolParser(pdbWithAltLoc,
+            AppletFormatAdapter.PASTE);
     Vector<SequenceI> seqs = jtest.getSeqs();
     Vector<SequenceI> mcseqs = mctest.getSeqs();
   
index 8a89830..c984b3a 100644 (file)
@@ -53,8 +53,7 @@ public class JmolVsJalviewPDBParserEndToEndTest
       {
         mctest = new PDBfile(false, false, false, testFile,
                 AppletFormatAdapter.FILE);
-        jtest = new JmolParser(false, false, false, testFile,
-                jalview.io.AppletFormatAdapter.FILE);
+        jtest = new JmolParser(testFile, AppletFormatAdapter.FILE);
       } catch (IOException e)
       {
         System.err.println("Exception thrown while parsing : " + pdbStr);