Merge branch 'develop' into bug/JAL-2346annotationChoice
[jalview.git] / src / jalview / structure / StructureSelectionManager.java
index 65fd5e7..3ab642f 100644 (file)
@@ -589,11 +589,9 @@ public class StructureSelectionManager
     return pdb;
   }
 
-  private boolean isCIFFile(String filename)
+  public void addStructureMapping(StructureMapping sm)
   {
-    String fileExt = filename.substring(filename.lastIndexOf(".") + 1,
-            filename.length());
-    return "cif".equalsIgnoreCase(fileExt);
+    mappings.add(sm);
   }
 
   /**
@@ -806,6 +804,27 @@ public class StructureSelectionManager
       return;
     }
 
+    SearchResultsI results = findAlignmentPositionsForStructurePositions(atoms);
+    for (Object li : listeners)
+    {
+      if (li instanceof SequenceListener)
+      {
+        ((SequenceListener) li).highlightSequence(results);
+      }
+    }
+  }
+
+  /**
+   * Constructs a SearchResults object holding regions (if any) in the Jalview
+   * alignment which have a mapping to the structure viewer positions in the
+   * supplied list
+   * 
+   * @param atoms
+   * @return
+   */
+  public SearchResultsI findAlignmentPositionsForStructurePositions(
+          List<AtomSpec> atoms)
+  {
     SearchResultsI results = new SearchResults();
     for (AtomSpec atom : atoms)
     {
@@ -831,13 +850,7 @@ public class StructureSelectionManager
         }
       }
     }
-    for (Object li : listeners)
-    {
-      if (li instanceof SequenceListener)
-      {
-        ((SequenceListener) li).highlightSequence(results);
-      }
-    }
+    return results;
   }
 
   /**