JAL-1919 refined structure view annotation settings to work for both PDB and mmCIF
[jalview.git] / src / jalview / ext / jmol / JmolParser.java
index a339c6b..c9243ed 100644 (file)
@@ -22,10 +22,12 @@ package jalview.ext.jmol;
 
 import jalview.datamodel.AlignmentAnnotation;
 import jalview.datamodel.Annotation;
+import jalview.datamodel.DBRefSource;
 import jalview.datamodel.SequenceI;
 import jalview.io.FileParse;
 import jalview.io.StructureFile;
 import jalview.schemes.ResidueProperties;
+import jalview.structure.StructureViewSettings;
 import jalview.util.MessageManager;
 
 import java.io.IOException;
@@ -57,34 +59,19 @@ public class JmolParser extends StructureFile implements JmolStatusListener
 {
   Viewer viewer = null;
 
-  public JmolParser(boolean addAlignmentAnnotations,
-          boolean predictSecondaryStructure, boolean externalSecStr,
-          String inFile, String type) throws IOException
+  public JmolParser(boolean addAlignmentAnnotations, boolean predictSecStr,
+          boolean externalSecStr, String inFile, String type)
+          throws IOException
   {
     super(inFile, type);
-    this.visibleChainAnnotation = addAlignmentAnnotations;
-    this.predictSecondaryStructure = predictSecondaryStructure;
-    this.externalSecondaryStructure = externalSecStr;
+    // addSettings(addAlignmentAnnotations, predictSecStr, externalSecStr);
   }
 
-  public JmolParser(boolean addAlignmentAnnotations,
-          boolean predictSecondaryStructure, boolean externalSecStr,
-          FileParse fp) throws IOException
+  public JmolParser(boolean addAlignmentAnnotations, boolean predictSecStr,
+          boolean externalSecStr, FileParse fp) throws IOException
   {
     super(fp);
-    this.visibleChainAnnotation = addAlignmentAnnotations;
-    this.predictSecondaryStructure = predictSecondaryStructure;
-    this.externalSecondaryStructure = externalSecStr;
-  }
-
-  public JmolParser(FileParse fp) throws IOException
-  {
-    super(fp);
-  }
-
-  public JmolParser(String inFile, String type) throws IOException
-  {
-    super(inFile, type);
+    // addSettings(addAlignmentAnnotations, predictSecStr, externalSecStr);
   }
 
   public JmolParser()
@@ -102,7 +89,15 @@ public class JmolParser extends StructureFile implements JmolStatusListener
   @Override
   public void parse() throws IOException
   {
-
+    String dataName = getDataName();
+    if (dataName.endsWith(".cif"))
+    {
+      setDbRefType(DBRefSource.MMCIF);
+    }
+    else
+    {
+      setDbRefType(DBRefSource.PDB);
+    }
     setChains(new Vector<PDBChain>());
     Viewer jmolModel = getJmolData();
     jmolModel.openReader(getDataName(), getDataName(), getReader());
@@ -182,7 +177,6 @@ public class JmolParser extends StructureFile implements JmolStatusListener
       for (PDBChain chain : getChains())
       {
         SequenceI chainseq = postProcessChain(chain);
-        createAnnotation(chainseq, chain, ms.at);
         if (isRNA(chainseq))
         {
           rna.add(chainseq);
@@ -191,6 +185,11 @@ public class JmolParser extends StructureFile implements JmolStatusListener
         {
           prot.add(chainseq);
         }
+
+        if (StructureViewSettings.isPredictSecondaryStructure())
+        {
+          createAnnotation(chainseq, chain, ms.at);
+        }
       }
     } catch (OutOfMemoryError er)
     {