JAL-34 - quick hack to see how we can do alignment comparison for splitframes linking...
[jalview.git] / src / jalview / datamodel / Alignment.java
index cfd6aee..95f5780 100755 (executable)
@@ -1830,7 +1830,13 @@ public class Alignment implements AlignmentI, AutoCloseable
     {
       return AlignmentUtils.alignCdsAsProtein(this, al);
     }
-    return AlignmentUtils.alignAs(this, al);
+    else if (thatIsProtein && !thisIsNucleotide)
+    {
+       // honour sense we were called - align this according to al 
+       return AlignmentUtils.alignAs(this, al);
+    }
+    // otherwise doing a DNA to DNA alignment - so use legacy obverse sense
+    return AlignmentUtils.alignAs(this,al);    
   }
 
   /**
@@ -2057,7 +2063,7 @@ public class Alignment implements AlignmentI, AutoCloseable
     if (cm == null && _aa.sequenceRef != null)
     {
       cm = _aa.sequenceRef.getContactMatrixFor(_aa);
-      if (cm == null && _aa.sequenceRef.getDatasetSequence()!=null)
+      if (cm == null && _aa.sequenceRef.getDatasetSequence() != null)
       {
         // TODO fix up this logic and unify with getContactListFor
         cm = _aa.sequenceRef.getDatasetSequence().getContactMatrixFor(_aa);
@@ -2069,6 +2075,11 @@ public class Alignment implements AlignmentI, AutoCloseable
   @Override
   public ContactListI getContactListFor(AlignmentAnnotation _aa, int column)
   {
+    if (_aa.annotations == null || column >= _aa.annotations.length
+            || column < 0)
+    {
+      return null;
+    }
     ContactListI cl = cmholder.getContactListFor(_aa, column);
     if (cl == null && _aa.groupRef != null)
     {