From 13575806978812c994d97bffd95bbd26de61d4f3 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Mon, 14 Sep 2015 09:31:45 +0100 Subject: [PATCH] JAL-1684 ensure cDNA placed above protein in SplitFrame --- src/jalview/appletgui/SplitFrame.java | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/jalview/appletgui/SplitFrame.java b/src/jalview/appletgui/SplitFrame.java index 57a6732..cbad148 100644 --- a/src/jalview/appletgui/SplitFrame.java +++ b/src/jalview/appletgui/SplitFrame.java @@ -20,7 +20,6 @@ */ package jalview.appletgui; -import jalview.analysis.AlignmentUtils; import jalview.api.AlignmentViewPanel; import jalview.api.ViewStyleI; import jalview.bin.JalviewLite; @@ -44,12 +43,14 @@ public class SplitFrame extends EmbmenuFrame private Panel outermost; /** - * Constructor + * Constructs the split frame placing cdna in the top half. No 'alignment' is + * performed here, this should be done by the calling client if wanted. */ public SplitFrame(AlignFrame af1, AlignFrame af2) { - topFrame = af1; - bottomFrame = af2; + boolean af1IsNucleotide = af1.viewport.getAlignment().isNucleotide(); + topFrame = af1IsNucleotide ? af1 : af2; + bottomFrame = topFrame == af1 ? af2 : af1; init(); } @@ -75,20 +76,15 @@ public class SplitFrame extends EmbmenuFrame AlignmentViewport protein = !topAlignment.isNucleotide() ? topViewport : (!bottomAlignment.isNucleotide() ? bottomViewport : null); - boolean mapped = AlignmentUtils.mapProteinToCdna( - protein.getAlignment(), cdna.getAlignment()); - if (mapped) - { - final StructureSelectionManager ssm = StructureSelectionManager - .getStructureSelectionManager(topViewport.applet); - ssm.registerMappings(protein.getAlignment().getCodonFrames()); - topViewport.setCodingComplement(bottomViewport); - ssm.addCommandListener(cdna); - ssm.addCommandListener(protein); - } + final StructureSelectionManager ssm = StructureSelectionManager + .getStructureSelectionManager(topViewport.applet); + ssm.registerMappings(protein.getAlignment().getCodonFrames()); + topViewport.setCodingComplement(bottomViewport); + ssm.addCommandListener(cdna); + ssm.addCommandListener(protein); /* - * Now mappings exist, can compute cDNA consensus on protein alignment + * Compute cDNA consensus on protein alignment */ protein.initComplementConsensus(); AlignmentViewPanel ap = topAlignment.isNucleotide() ? bottomFrame.alignPanel -- 1.7.10.2