JAL-845 error message on syserr if supplied files don't map as cDNA and
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 24 Aug 2015 08:25:01 +0000 (09:25 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 24 Aug 2015 08:25:01 +0000 (09:25 +0100)
protein

src/jalview/bin/JalviewLite.java

index 8a9c54b..9aa5735 100644 (file)
@@ -20,6 +20,7 @@
  */
 package jalview.bin;
 
+import jalview.analysis.AlignmentUtils;
 import jalview.api.StructureSelectionManagerProvider;
 import jalview.appletgui.AlignFrame;
 import jalview.appletgui.AlignViewport;
@@ -1879,15 +1880,27 @@ public class JalviewLite extends Applet implements
      */
     public void addToDisplay(AlignFrame af, AlignFrame af2)
     {
-      if (af2 == null)
+      if (af2 != null)
       {
-        af.addToDisplay(embedded);
-      }
-      else
-      {
-        SplitFrame sf = new SplitFrame(af, af2);
-        sf.addToDisplay(embedded, JalviewLite.this);
+        AlignmentI al1 = af.viewport.getAlignment();
+        AlignmentI al2 = af2.viewport.getAlignment();
+        if (AlignmentUtils.isMappable(al1, al2))
+        {
+          SplitFrame sf = new SplitFrame(af, af2);
+          sf.addToDisplay(embedded, JalviewLite.this);
+          return;
+        }
+        else
+        {
+          String msg = "Could not map any sequence in " + af2.getTitle()
+                  + " as "
+                  + (al1.isNucleotide() ? "protein product" : "cDNA")
+                  + " for " + af.getTitle();
+          System.err.println(msg);
+        }
       }
+
+      af.addToDisplay(embedded);
     }
 
     /**