From b3d648f529f35f8b7d67292b8be709bce9c8439d Mon Sep 17 00:00:00 2001 From: gmungoc Date: Mon, 24 Aug 2015 09:25:01 +0100 Subject: [PATCH] JAL-845 error message on syserr if supplied files don't map as cDNA and protein --- src/jalview/bin/JalviewLite.java | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/jalview/bin/JalviewLite.java b/src/jalview/bin/JalviewLite.java index 8a9c54b..9aa5735 100644 --- a/src/jalview/bin/JalviewLite.java +++ b/src/jalview/bin/JalviewLite.java @@ -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); } /** -- 1.7.10.2