X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignViewport.java;h=82252370ef4ea49d15777759a186731cd2b008bd;hb=767cd5214b7f096cd6c3ba46c99bdec39eb2b799;hp=c168b7b8d527fd2cbb312bbba417b3e9ef70e85c;hpb=d053a3c980cf4318b9a19a255f9fc870e74de989;p=jalview.git diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index c168b7b..8225237 100644 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -35,29 +35,33 @@ */ package jalview.gui; -import java.util.*; - -import java.awt.*; - -import jalview.analysis.*; -import jalview.api.AlignCalcManagerI; +import jalview.analysis.NJTree; import jalview.api.AlignViewportI; -import jalview.api.AlignmentViewPanel; -import jalview.api.OOMHandlerI; - -import jalview.bin.*; - -import jalview.datamodel.*; - -import jalview.schemes.*; +import jalview.bin.Cache; +import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.Annotation; +import jalview.datamodel.ColumnSelection; +import jalview.datamodel.PDBEntry; +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.StructureSelectionManager; import jalview.structure.VamsasSource; import jalview.viewmodel.AlignmentViewport; -import jalview.workers.AlignCalcManager; -import jalview.workers.ConsensusThread; -import jalview.workers.ConservationThread; -import jalview.workers.StrucConsensusThread; +import jalview.ws.params.AutoCalcSetting; + +import java.awt.Color; +import java.awt.Container; +import java.awt.Font; +import java.awt.Rectangle; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.Stack; +import java.util.Vector; /** * DOCUMENT ME! @@ -67,8 +71,6 @@ import jalview.workers.StrucConsensusThread; */ public class AlignViewport extends AlignmentViewport implements SelectionSource, VamsasSource, AlignViewportI { - private static final int RIGHT_JUSTIFY = 1; - int startRes; int endRes; @@ -93,12 +95,6 @@ public class AlignViewport extends AlignmentViewport implements SelectionSource, boolean showAnnotation = true; - boolean colourAppliesToAllGroups = true; - - boolean conservationColourSelected = false; - - boolean abovePIDThreshold = false; - int charHeight; int charWidth; @@ -111,9 +107,6 @@ public class AlignViewport extends AlignmentViewport implements SelectionSource, boolean seqNameItalics; - int threshold; - - int increment; NJTree currentTree = null; @@ -133,9 +126,6 @@ public class AlignViewport extends AlignmentViewport implements SelectionSource, */ Hashtable featuresDisplayed = null; - - boolean isDataset = false; - boolean antiAlias = false; Rectangle explodedPosition; @@ -331,68 +321,23 @@ public class AlignViewport extends AlignmentViewport implements SelectionSource, { 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 (Cache.getDefault("SHOW_CONSERVATION", true)) - { - alignment.addAnnotation(conservation); - } - - if (Cache.getDefault("SHOW_QUALITY", true)) - { - 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); - } + showConservation=Cache.getDefault("SHOW_CONSERVATION", true); + showQuality=Cache.getDefault("SHOW_QUALITY", true); showGroupConservation = Cache.getDefault("SHOW_GROUP_CONSERVATION", false); - - { - - } - } + } showConsensusHistogram = Cache.getDefault("SHOW_CONSENSUS_HISTOGRAM", true); showSequenceLogo = Cache.getDefault("SHOW_CONSENSUS_LOGO", false); normaliseSequenceLogo = Cache.getDefault("NORMALISE_CONSENSUS_LOGO", false); showGroupConsensus = Cache.getDefault("SHOW_GROUP_CONSENSUS", false); - // TODO: add menu option action that nulls or creates consensus object - // depending on if the user wants to see the annotation or not in a - // specific alignment + showConsensus=Cache.getDefault("SHOW_IDENTITY", true); consensus = new AlignmentAnnotation("Consensus", "PID", new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH); consensus.hasText = true; consensus.autoCalculated = true; - - if (alignment.isNucleotide() && alignment.hasRNAStructure()) - { - strucConsensus = new AlignmentAnnotation("StrucConsensus", "PID", - new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH); - strucConsensus.hasText = true; - strucConsensus.autoCalculated = true; - } - - if (Cache.getDefault("SHOW_IDENTITY", true)) - { - alignment.addAnnotation(consensus); - // TODO: Make own if for structure - if (alignment.isNucleotide() && alignment.hasRNAStructure()) - { - alignment.addAnnotation(strucConsensus); - } - } - } - + initAutoAnnotation(); if (jalview.bin.Cache.getProperty("DEFAULT_COLOUR") != null) { globalColourScheme = ColourSchemeProperty.getColour(alignment, @@ -485,50 +430,6 @@ public class AlignViewport extends AlignmentViewport implements SelectionSource, return sq; } - - /** - * GUI state - * - * @return true if conservation based shading is enabled - */ - public boolean getConservationSelected() - { - return conservationColourSelected; - } - - /** - * GUI state - * - * @param b - * enable conservation based shading - */ - public void setConservationSelected(boolean b) - { - conservationColourSelected = b; - } - - /** - * GUI state - * - * @return true if percent identity threshold is applied to shading - */ - public boolean getAbovePIDThreshold() - { - return abovePIDThreshold; - } - - /** - * GUI state - * - * - * @param b - * indicate if percent identity threshold is applied to shading - */ - public void setAbovePIDThreshold(boolean b) - { - abovePIDThreshold = b; - } - /** * DOCUMENT ME! * @@ -879,48 +780,6 @@ public class AlignViewport extends AlignmentViewport implements SelectionSource, /** * DOCUMENT ME! * - * @param thresh - * DOCUMENT ME! - */ - public void setThreshold(int thresh) - { - threshold = thresh; - } - - /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public int getThreshold() - { - return threshold; - } - - /** - * DOCUMENT ME! - * - * @param inc - * DOCUMENT ME! - */ - public void setIncrement(int inc) - { - increment = inc; - } - - /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public int getIncrement() - { - return increment; - } - - /** - * DOCUMENT ME! - * * @return DOCUMENT ME! */ public ColumnSelection getColumnSelection() @@ -952,27 +811,6 @@ public class AlignViewport extends AlignmentViewport implements SelectionSource, /** * DOCUMENT ME! * - * @param b - * DOCUMENT ME! - */ - public void setColourAppliesToAllGroups(boolean b) - { - colourAppliesToAllGroups = b; - } - - /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public boolean getColourAppliesToAllGroups() - { - return colourAppliesToAllGroups; - } - - /** - * DOCUMENT ME! - * * @return DOCUMENT ME! */ public boolean getShowJVSuffix() @@ -1159,6 +997,7 @@ public class AlignViewport extends AlignmentViewport implements SelectionSource, */ public long[] getUndoRedoHash() { + // TODO: JAL-1126 if (historyList == null || redoList == null) return new long[] { -1, -1 }; @@ -1209,20 +1048,17 @@ public class AlignViewport extends AlignmentViewport implements SelectionSource, public void updateSequenceIdColours() { - Vector groups = alignment.getGroups(); if (sequenceColours == null) { sequenceColours = new Hashtable(); } - for (int ig = 0, igSize = groups.size(); ig < igSize; ig++) + for (SequenceGroup sg:alignment.getGroups()) { - 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++) + for (SequenceI s:sg.getSequences(getHiddenRepSequences())) { - sequenceColours.put(sqs.elementAt(s), sg.idColour); + sequenceColours.put(s, sg.idColour); } } } @@ -1458,4 +1294,20 @@ public class AlignViewport extends AlignmentViewport implements SelectionSource, { return validCharWidth; } + private Hashtable calcIdParams=new Hashtable(); + public AutoCalcSetting getCalcIdSettingsFor(String calcId) + { + return calcIdParams.get(calcId); + } + + public void setCalcIdSettingsFor(String calcId, AutoCalcSetting settings, boolean needsUpdate) + { + calcIdParams.put(calcId, settings); + // TODO: create a restart list to trigger any calculations that need to be restarted after load + // calculator.getRegisteredWorkersOfClass(settings.getWorkerClass()) + if (needsUpdate) + { + Cache.log.debug("trigger update for "+calcId); + } + } }