X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FAlignViewport.java;h=13d03e3772cf53eed9273d735fd2dd29f8a418b8;hb=25aaaa87042b3f507ad4348120df7dd073182759;hp=95aafab1c2056f1bc76a32d7f4aa84ae11169fd9;hpb=a822fc744dcc06e6a8d2399218da0d0dfd56cf2b;p=jalview.git diff --git a/src/jalview/appletgui/AlignViewport.java b/src/jalview/appletgui/AlignViewport.java index 95aafab..13d03e3 100644 --- a/src/jalview/appletgui/AlignViewport.java +++ b/src/jalview/appletgui/AlignViewport.java @@ -1,39 +1,44 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) - * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2b1) + * Copyright (C) 2014 The Jalview Authors * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. */ package jalview.appletgui; -import java.util.*; - -import java.awt.*; - -import jalview.analysis.*; -import jalview.api.AlignCalcManagerI; +import jalview.analysis.NJTree; import jalview.api.AlignViewportI; -import jalview.bin.*; -import jalview.datamodel.*; -import jalview.schemes.*; +import jalview.bin.JalviewLite; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.ColumnSelection; +import jalview.datamodel.Sequence; +import jalview.datamodel.SequenceGroup; +import jalview.datamodel.SequenceI; +import jalview.schemes.ColourSchemeProperty; +import jalview.schemes.UserColourScheme; import jalview.structure.SelectionSource; import jalview.structure.VamsasSource; import jalview.viewmodel.AlignmentViewport; -import jalview.workers.ConservationThread; -import jalview.workers.ConsensusThread; -public class AlignViewport extends AlignmentViewport implements AlignViewportI, SelectionSource, VamsasSource +import java.awt.Font; +import java.util.Stack; + +public class AlignViewport extends AlignmentViewport implements + AlignViewportI, SelectionSource, VamsasSource { int startRes; @@ -57,24 +62,10 @@ public class AlignViewport extends AlignmentViewport implements AlignViewportI, boolean renderGaps = true; - boolean showSequenceFeatures = false; - boolean showAnnotation = true; - boolean showConservation = true; - - boolean showQuality = true; - - boolean showConsensus = true; - boolean upperCasebold = false; - boolean colourAppliesToAllGroups = true; - - boolean conservationColourSelected = false; - - boolean abovePIDThreshold = false; - int charHeight; int charWidth; @@ -97,28 +88,24 @@ public class AlignViewport extends AlignmentViewport implements AlignViewportI, boolean scaleRightWrapped = true; - // The following vector holds the features which are - // currently visible, in the correct order or rendering - public Hashtable featuresDisplayed; - - boolean showHiddenMarkers = true; public jalview.bin.JalviewLite applet; - Hashtable sequenceColours; - boolean MAC = false; Stack historyList = new Stack(); Stack redoList = new Stack(); - - public void finalize() { - applet=null; - quality=null; - alignment=null; - colSel=null; + + private AnnotationColumnChooser annotationColumnSelectionState; + + public void finalize() + { + applet = null; + quality = null; + alignment = null; + colSel = null; } public AlignViewport(AlignmentI al, JalviewLite applet) @@ -190,15 +177,19 @@ public class AlignViewport extends AlignmentViewport implements AlignViewportI, { showJVSuffix = applet.getDefaultParameter("showFullId", showJVSuffix); - showAnnotation = applet.getDefaultParameter("showAnnotation", showAnnotation); - - showConservation = applet.getDefaultParameter("showConservation", showConservation); - + showAnnotation = applet.getDefaultParameter("showAnnotation", + showAnnotation); + + showConservation = applet.getDefaultParameter("showConservation", + showConservation); + showQuality = applet.getDefaultParameter("showQuality", showQuality); - showConsensus = applet.getDefaultParameter("showConsensus", showConsensus); + showConsensus = applet.getDefaultParameter("showConsensus", + showConsensus); - showUnconserved = applet.getDefaultParameter("showUnconserved", showUnconserved); + showUnconserved = applet.getDefaultParameter("showUnconserved", + showUnconserved); String param = applet.getParameter("upperCase"); if (param != null) @@ -210,19 +201,26 @@ public class AlignViewport extends AlignmentViewport implements AlignViewportI, } sortByTree = applet.getDefaultParameter("sortByTree", sortByTree); - followHighlight = applet.getDefaultParameter("automaticScrolling",followHighlight); + followHighlight = applet.getDefaultParameter("automaticScrolling", + followHighlight); followSelection = followHighlight; - showSequenceLogo = applet.getDefaultParameter("showSequenceLogo", showSequenceLogo); + showSequenceLogo = applet.getDefaultParameter("showSequenceLogo", + showSequenceLogo); - normaliseSequenceLogo = applet.getDefaultParameter("normaliseSequenceLogo", normaliseSequenceLogo); + normaliseSequenceLogo = applet.getDefaultParameter( + "normaliseSequenceLogo", applet.getDefaultParameter( + "normaliseLogo", normaliseSequenceLogo)); + + showGroupConsensus = applet.getDefaultParameter("showGroupConsensus", + showGroupConsensus); + + showGroupConservation = applet.getDefaultParameter( + "showGroupConservation", showGroupConservation); + + showConsensusHistogram = applet.getDefaultParameter( + "showConsensusHistogram", showConsensusHistogram); - showGroupConsensus = applet.getDefaultParameter("showGroupConsensus", showGroupConsensus); - - showGroupConservation = applet.getDefaultParameter("showGroupConservation", showGroupConservation); - - showConsensusHistogram = applet.getDefaultParameter("showConsensusHistogram", showConsensusHistogram); - } if (applet != null) @@ -254,70 +252,10 @@ public class AlignViewport extends AlignmentViewport implements AlignViewportI, .getParameter("userDefinedColour")); } } - if (hconsensus == null) - { - if (!alignment.isNucleotide()) - { - conservation = new AlignmentAnnotation("Conservation", - "Conservation of total alignment less than " + getConsPercGaps() - + "% gaps", new Annotation[1], 0f, 11f, - AlignmentAnnotation.BAR_GRAPH); - conservation.hasText = true; - conservation.autoCalculated = true; - - if (showConservation) - { - alignment.addAnnotation(conservation); - } - - if (showQuality) - { - quality = new AlignmentAnnotation("Quality", - "Alignment Quality based on Blosum62 scores", - new Annotation[1], 0f, 11f, AlignmentAnnotation.BAR_GRAPH); - quality.hasText = true; - quality.autoCalculated = true; - - alignment.addAnnotation(quality); - } - } else { - if (alignment.hasRNAStructure()) - { - strucConsensus = new AlignmentAnnotation("StrucConsensus", "PID", - new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH); - strucConsensus.hasText = true; - strucConsensus.autoCalculated = true; - } - } - - consensus = new AlignmentAnnotation("Consensus", "PID", - new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH); - consensus.hasText = true; - consensus.autoCalculated = true; - - if (showConsensus) - { - alignment.addAnnotation(consensus); - if (strucConsensus!=null) - { - alignment.addAnnotation(strucConsensus); - } - } - } + initAutoAnnotation(); } - public void showSequenceFeatures(boolean b) - { - showSequenceFeatures = b; - } - - public boolean getShowSequenceFeatures() - { - return showSequenceFeatures; - } - - /** * get the consensus sequence as displayed under the PID consensus annotation * row. @@ -355,26 +293,6 @@ public class AlignViewport extends AlignmentViewport implements AlignViewportI, return sq; } - public boolean getConservationSelected() - { - return conservationColourSelected; - } - - public void setConservationSelected(boolean b) - { - conservationColourSelected = b; - } - - public boolean getAbovePIDThreshold() - { - return abovePIDThreshold; - } - - public void setAbovePIDThreshold(boolean b) - { - abovePIDThreshold = b; - } - public int getStartRes() { return startRes; @@ -558,26 +476,6 @@ public class AlignViewport extends AlignmentViewport implements AlignViewportI, } } - public void setThreshold(int thresh) - { - threshold = thresh; - } - - public int getThreshold() - { - return threshold; - } - - public void setIncrement(int inc) - { - increment = inc; - } - - public int getIncrement() - { - return increment; - } - public void resetSeqLimits(int height) { setEndSeq(height / getCharHeight()); @@ -593,16 +491,6 @@ public class AlignViewport extends AlignmentViewport implements AlignViewportI, return currentTree; } - public void setColourAppliesToAllGroups(boolean b) - { - colourAppliesToAllGroups = b; - } - - public boolean getColourAppliesToAllGroups() - { - return colourAppliesToAllGroups; - } - public boolean getShowJVSuffix() { return showJVSuffix; @@ -665,10 +553,6 @@ public class AlignViewport extends AlignmentViewport implements AlignViewportI, } } - - - - public boolean getShowHiddenMarkers() { return showHiddenMarkers; @@ -679,35 +563,6 @@ public class AlignViewport extends AlignmentViewport implements AlignViewportI, showHiddenMarkers = show; } - public Color getSequenceColour(SequenceI seq) - { - if (sequenceColours == null || !sequenceColours.containsKey(seq)) - { - return Color.white; - } - else - { - return (Color) sequenceColours.get(seq); - } - } - - public void setSequenceColour(SequenceI seq, Color col) - { - if (sequenceColours == null) - { - sequenceColours = new Hashtable(); - } - - if (col == null) - { - sequenceColours.remove(seq); - } - else - { - sequenceColours.put(seq, col); - } - } - boolean centreColumnLabels; public boolean getCentreColumnLabels() @@ -715,23 +570,6 @@ public class AlignViewport extends AlignmentViewport implements AlignViewportI, return centreColumnLabels; } - public void updateSequenceIdColours() - { - Vector groups = alignment.getGroups(); - for (int ig = 0, igSize = groups.size(); ig < igSize; ig++) - { - SequenceGroup sg = (SequenceGroup) groups.elementAt(ig); - if (sg.idColour != null) - { - Vector sqs = sg.getSequences(getHiddenRepSequences()); - for (int s = 0, sSize = sqs.size(); s < sSize; s++) - { - this.setSequenceColour((SequenceI) sqs.elementAt(s), sg.idColour); - } - } - } - } - public boolean followHighlight = true; public boolean getFollowHighlight() @@ -749,6 +587,7 @@ public class AlignViewport extends AlignmentViewport implements AlignViewportI, { return followSelection; } + public void sendSelection() { jalview.structure.StructureSelectionManager @@ -757,9 +596,6 @@ public class AlignViewport extends AlignmentViewport implements AlignViewportI, new ColumnSelection(getColumnSelection()), this); } - - - /** * synthesize a column selection if none exists so it covers the given * selection group. if wholewidth is false, no column selection is made if the @@ -793,12 +629,6 @@ public class AlignViewport extends AlignmentViewport implements AlignViewportI, } } - @Override - public boolean hasHiddenColumns() - { - return hasHiddenColumns; - } - public boolean isNormaliseSequenceLogo() { return normaliseSequenceLogo; @@ -811,11 +641,22 @@ public class AlignViewport extends AlignmentViewport implements AlignViewportI, /** * - * @return true if alignment characters should be displayed + * @return true if alignment characters should be displayed */ public boolean isValidCharWidth() { return validCharWidth; } + public AnnotationColumnChooser getAnnotationColumnSelectionState() + { + return annotationColumnSelectionState; + } + + public void setAnnotationColumnSelectionState( + AnnotationColumnChooser annotationColumnSelectionState) + { + this.annotationColumnSelectionState = annotationColumnSelectionState; + } + }