From 97a31ae1fe3095b9d332f655103e334342ee9a19 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Tue, 3 Mar 2015 10:34:01 +0000 Subject: [PATCH] JAL-1452 nucleotide/protein default colour; JAL-845 SplitFrame refactor --- src/jalview/gui/AlignViewport.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index cad90e3..93d8c19 100644 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -46,6 +46,7 @@ import jalview.api.AlignViewportI; import jalview.api.ViewStyleI; import jalview.bin.Cache; import jalview.commands.CommandI; +import jalview.datamodel.AlignedCodonFrame; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentI; import jalview.datamodel.ColumnSelection; @@ -300,10 +301,18 @@ public class AlignViewport extends AlignmentViewport implements showConsensus = Cache.getDefault("SHOW_IDENTITY", true); } initAutoAnnotation(); - if (jalview.bin.Cache.getProperty(Preferences.DEFAULT_COLOUR) != null) + String colourProperty = alignment.isNucleotide() ? Preferences.DEFAULT_COLOUR_NUC + : Preferences.DEFAULT_COLOUR_PROT; + String propertyValue = Cache.getProperty(colourProperty); + if (propertyValue == null) + { + // fall back on this property for backwards compatibility + propertyValue = Cache.getProperty(Preferences.DEFAULT_COLOUR); + } + if (propertyValue != null) { globalColourScheme = ColourSchemeProperty.getColour(alignment, - jalview.bin.Cache.getProperty(Preferences.DEFAULT_COLOUR)); + propertyValue); if (globalColourScheme instanceof UserColourScheme) { @@ -1061,7 +1070,7 @@ public class AlignViewport extends AlignmentViewport implements if (openSplitPane) { protein = openSplitFrame(newAlignFrame, - thisAlignment.getSequencesArray()); + thisAlignment.getSequencesArray(), protein.getCodonFrames()); } /* @@ -1083,10 +1092,11 @@ public class AlignViewport extends AlignmentViewport implements * containing a new alignment to be shown * @param seqs * 'complementary' sequences to show in the other split half + * @param mappings * @return the protein alignment in the split frame */ protected AlignmentI openSplitFrame(AlignFrame newAlignFrame, - SequenceI[] seqs) + SequenceI[] seqs, Set mappings) { AlignmentI complementAlignment = new Alignment(seqs); // TODO: move this to a factory/controller method ? @@ -1103,6 +1113,7 @@ public class AlignViewport extends AlignmentViewport implements final AlignFrame cdnaFrame = al.isNucleotide() ? newAlignFrame : copyMe; AlignmentI protein = proteinFrame.viewport.getAlignment(); + protein.setCodonFrames(mappings); cdnaFrame.setVisible(true); proteinFrame.setVisible(true); -- 1.7.10.2