JAL-2110 bug fixing and tidying for get cross-refs
[jalview.git] / src / jalview / datamodel / AlignedCodonFrame.java
index a4b99bf..18aaecf 100644 (file)
@@ -702,7 +702,7 @@ public class AlignedCodonFrame
   }
 
   /**
-   * Returns the first mapping found that is from 'fromSeq' to 'toSeq', or null
+   * Returns the first mapping found that is between 'fromSeq' and 'toSeq', or null
    * if none found
    * 
    * @param fromSeq
@@ -713,12 +713,17 @@ public class AlignedCodonFrame
    */
   public Mapping getMappingBetween(SequenceI fromSeq, SequenceI toSeq)
   {
+    SequenceI dssFrom = fromSeq.getDatasetSequence() == null ? fromSeq
+            : fromSeq.getDatasetSequence();
+    SequenceI dssTo = toSeq.getDatasetSequence() == null ? toSeq : toSeq
+            .getDatasetSequence();
+
     for (SequenceToSequenceMapping mapping : mappings)
     {
       SequenceI from = mapping.fromSeq;
       SequenceI to = mapping.mapping.to;
-      if ((from == fromSeq || from == fromSeq.getDatasetSequence())
-              && (to == toSeq || to == toSeq.getDatasetSequence()))
+      if ((from == dssFrom && to == dssTo)
+              || (from == dssTo && to == dssFrom))
       {
         return mapping.mapping;
       }