Merge JAL-2136_phyre2_integration to develop
[jalview.git] / src / jalview / structure / StructureSelectionManager.java
index 5ff2da4..991ba82 100644 (file)
@@ -850,6 +850,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)
     {
@@ -875,13 +896,7 @@ public class StructureSelectionManager
         }
       }
     }
-    for (Object li : listeners)
-    {
-      if (li instanceof SequenceListener)
-      {
-        ((SequenceListener) li).highlightSequence(results);
-      }
-    }
+    return results;
   }
 
   /**
@@ -1422,4 +1437,9 @@ public class StructureSelectionManager
     return instances.values().iterator().next();
   }
 
+  public void addStructureMapping(StructureMapping smapping)
+  {
+    mappings.add(smapping);
+  }
+
 }