JAL-2136 JAL-2137 Modified STRUCTMODEL annotation format and added implementation...
[jalview.git] / src / jalview / structure / StructureSelectionManager.java
index b0c185b..addf310 100644 (file)
@@ -79,7 +79,6 @@ public class StructureSelectionManager
 
   private long progressSessionId;
 
-  private boolean mappingForPhyre2Model;
 
   /*
    * Set of any registered mappings between (dataset) sequences.
@@ -90,6 +89,8 @@ public class StructureSelectionManager
 
   private List<SelectionListener> sel_listeners = new ArrayList<SelectionListener>();
 
+  private List<String> phyre2ModelTemplates = new ArrayList<String>();
+
   /**
    * @return true if will try to use external services for processing secondary
    *         structure
@@ -511,9 +512,9 @@ public class StructureSelectionManager
       {
         pdbFile = "INLINE" + pdb.getId();
       }
-
+      boolean phyre2Template = isPhyre2Template(pdbFile);
       List<StructureMapping> seqToStrucMapping = new ArrayList<StructureMapping>();
-      if (!isMappingForPhyre2Model() && isMapUsingSIFTs && seq.isProtein())
+      if (!phyre2Template && isMapUsingSIFTs && seq.isProtein())
       {
         if (progress!=null) {
           progress.setProgressBar(MessageManager
@@ -593,7 +594,7 @@ public class StructureSelectionManager
           }
         }
       }
-      else if (isMappingForPhyre2Model())
+      else if (phyre2Template)
       {
         setProgressBar(null);
         setProgressBar(MessageManager
@@ -627,11 +628,9 @@ public class StructureSelectionManager
     return pdb;
   }
 
-  private boolean isCIFFile(String filename)
+  public void registerPhyre2Template(String phyre2Template)
   {
-    String fileExt = filename.substring(filename.lastIndexOf(".") + 1,
-            filename.length());
-    return "cif".equalsIgnoreCase(fileExt);
+    phyre2ModelTemplates.add(phyre2Template);
   }
 
   /**
@@ -1394,15 +1393,16 @@ public class StructureSelectionManager
     return seqmappings;
   }
 
-  public boolean isMappingForPhyre2Model()
+  public boolean isPhyre2Template(String structureFile)
   {
-    return mappingForPhyre2Model;
+    if (structureFile == null || phyre2ModelTemplates == null
+            || phyre2ModelTemplates.isEmpty())
+    {
+      return false;
+    }
+    return (phyre2ModelTemplates.contains(structureFile));
   }
 
-  public void setMappingForPhyre2Model(boolean mappingForPhyre2Model)
-  {
-    this.mappingForPhyre2Model = mappingForPhyre2Model;
-  }
 
   public static StructureSelectionManager getStructureSelectionManager()
   {