From: gmungoc Date: Fri, 27 Jan 2017 15:37:30 +0000 (+0000) Subject: JAL-2371 CollectionColourScheme renamed ResidueShader and moved to X-Git-Tag: Release_2_10_3b1~357^2~5 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=b2b7e99113e1f0962140fc72d989cc826799a2d4;p=jalview.git JAL-2371 CollectionColourScheme renamed ResidueShader and moved to jalview.renderer --- diff --git a/src/jalview/api/AlignViewportI.java b/src/jalview/api/AlignViewportI.java index ee03852..9fcf89a 100644 --- a/src/jalview/api/AlignViewportI.java +++ b/src/jalview/api/AlignViewportI.java @@ -31,7 +31,7 @@ import jalview.datamodel.SearchResultsI; import jalview.datamodel.SequenceCollectionI; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; -import jalview.schemes.CollectionColourSchemeI; +import jalview.renderer.ResidueShaderI; import jalview.schemes.ColourSchemeI; import java.awt.Color; @@ -80,7 +80,7 @@ public interface AlignViewportI extends ViewStyleI ColourSchemeI getGlobalColourScheme(); - CollectionColourSchemeI getViewportColourScheme(); + ResidueShaderI getViewportColourScheme(); AlignmentI getAlignment(); diff --git a/src/jalview/appletgui/APopupMenu.java b/src/jalview/appletgui/APopupMenu.java index 018b227..4ae0ed2 100644 --- a/src/jalview/appletgui/APopupMenu.java +++ b/src/jalview/appletgui/APopupMenu.java @@ -39,11 +39,11 @@ import jalview.io.DataSourceType; import jalview.io.FileFormatI; import jalview.io.FileFormats; import jalview.io.SequenceAnnotationReport; +import jalview.renderer.ResidueShader; +import jalview.renderer.ResidueShaderI; import jalview.schemes.Blosum62ColourScheme; import jalview.schemes.BuriedColourScheme; import jalview.schemes.ClustalxColourScheme; -import jalview.schemes.CollectionColourScheme; -import jalview.schemes.CollectionColourSchemeI; import jalview.schemes.HelixColourScheme; import jalview.schemes.HydrophobicColourScheme; import jalview.schemes.JalviewColourScheme; @@ -330,7 +330,7 @@ public class APopupMenu extends java.awt.PopupMenu implements * * @param cs */ - protected void setSelectedColour(CollectionColourSchemeI cs) + protected void setSelectedColour(ResidueShaderI cs) { if (cs == null || cs.getColourScheme() == null) { @@ -1147,62 +1147,62 @@ public class APopupMenu extends java.awt.PopupMenu implements protected void clustalColour_actionPerformed() { SequenceGroup sg = getGroup(); - sg.cs = new CollectionColourScheme(new ClustalxColourScheme(sg, + sg.cs = new ResidueShader(new ClustalxColourScheme(sg, ap.av.getHiddenRepSequences())); refresh(); } protected void zappoColour_actionPerformed() { - getGroup().cs = new CollectionColourScheme(new ZappoColourScheme()); + getGroup().cs = new ResidueShader(new ZappoColourScheme()); refresh(); } protected void taylorColour_actionPerformed() { - getGroup().cs = new CollectionColourScheme(new TaylorColourScheme()); + getGroup().cs = new ResidueShader(new TaylorColourScheme()); refresh(); } protected void hydrophobicityColour_actionPerformed() { - getGroup().cs = new CollectionColourScheme(new HydrophobicColourScheme()); + getGroup().cs = new ResidueShader(new HydrophobicColourScheme()); refresh(); } protected void helixColour_actionPerformed() { - getGroup().cs = new CollectionColourScheme(new HelixColourScheme()); + getGroup().cs = new ResidueShader(new HelixColourScheme()); refresh(); } protected void strandColour_actionPerformed() { - getGroup().cs = new CollectionColourScheme(new StrandColourScheme()); + getGroup().cs = new ResidueShader(new StrandColourScheme()); refresh(); } protected void turnColour_actionPerformed() { - getGroup().cs = new CollectionColourScheme(new TurnColourScheme()); + getGroup().cs = new ResidueShader(new TurnColourScheme()); refresh(); } protected void buriedColour_actionPerformed() { - getGroup().cs = new CollectionColourScheme(new BuriedColourScheme()); + getGroup().cs = new ResidueShader(new BuriedColourScheme()); refresh(); } public void nucleotideMenuItem_actionPerformed() { - getGroup().cs = new CollectionColourScheme(new NucleotideColourScheme()); + getGroup().cs = new ResidueShader(new NucleotideColourScheme()); refresh(); } public void purinePyrimidineColour_actionPerformed() { - getGroup().cs = new CollectionColourScheme( + getGroup().cs = new ResidueShader( new PurinePyrimidineColourScheme()); refresh(); } @@ -1245,7 +1245,7 @@ public class APopupMenu extends java.awt.PopupMenu implements protected void PIDColour_actionPerformed() { SequenceGroup sg = getGroup(); - sg.cs = new CollectionColourScheme(new PIDColourScheme()); + sg.cs = new ResidueShader(new PIDColourScheme()); sg.cs.setConsensus(AAFrequency.calculate(sg.getSequences(ap.av .getHiddenRepSequences()), 0, ap.av.getAlignment().getWidth())); refresh(); @@ -1255,7 +1255,7 @@ public class APopupMenu extends java.awt.PopupMenu implements { SequenceGroup sg = getGroup(); - sg.cs = new CollectionColourScheme(new Blosum62ColourScheme()); + sg.cs = new ResidueShader(new Blosum62ColourScheme()); sg.cs.setConsensus(AAFrequency.calculate(sg.getSequences(ap.av .getHiddenRepSequences()), 0, ap.av.getAlignment().getWidth())); diff --git a/src/jalview/appletgui/AlignViewport.java b/src/jalview/appletgui/AlignViewport.java index 2e76e1a..29df968 100644 --- a/src/jalview/appletgui/AlignViewport.java +++ b/src/jalview/appletgui/AlignViewport.java @@ -32,7 +32,7 @@ import jalview.datamodel.SearchResultsI; import jalview.datamodel.Sequence; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; -import jalview.schemes.CollectionColourScheme; +import jalview.renderer.ResidueShader; import jalview.schemes.ColourSchemeProperty; import jalview.schemes.UserColourScheme; import jalview.structure.CommandListener; @@ -209,7 +209,7 @@ public class AlignViewport extends AlignmentViewport implements if (colour != null) { - globalColourScheme = new CollectionColourScheme( + globalColourScheme = new ResidueShader( ColourSchemeProperty.getColourScheme(alignment, colour)); if (globalColourScheme != null) { @@ -219,7 +219,7 @@ public class AlignViewport extends AlignmentViewport implements if (applet.getParameter("userDefinedColour") != null) { - globalColourScheme = new CollectionColourScheme( + globalColourScheme = new ResidueShader( new UserColourScheme( applet.getParameter("userDefinedColour"))); } diff --git a/src/jalview/appletgui/SequenceRenderer.java b/src/jalview/appletgui/SequenceRenderer.java index 4d9d37c..1c7c4ce 100755 --- a/src/jalview/appletgui/SequenceRenderer.java +++ b/src/jalview/appletgui/SequenceRenderer.java @@ -23,7 +23,7 @@ package jalview.appletgui; import jalview.api.FeatureRenderer; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; -import jalview.schemes.CollectionColourSchemeI; +import jalview.renderer.ResidueShaderI; import java.awt.Color; import java.awt.Font; @@ -114,13 +114,11 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer return col; } - void getBoxColour(CollectionColourSchemeI collectionColourSchemeI, - SequenceI seq, int i) + void getBoxColour(ResidueShaderI shader, SequenceI seq, int i) { - if (collectionColourSchemeI != null) + if (shader != null) { - resBoxColour = collectionColourSchemeI.findColour(seq.getCharAt(i), - i, seq); + resBoxColour = shader.findColour(seq.getCharAt(i), i, seq); } else if (forOverview && !jalview.util.Comparison.isGap(seq.getCharAt(i))) diff --git a/src/jalview/appletgui/SliderPanel.java b/src/jalview/appletgui/SliderPanel.java index 1beb82b..2354ba1 100644 --- a/src/jalview/appletgui/SliderPanel.java +++ b/src/jalview/appletgui/SliderPanel.java @@ -21,7 +21,7 @@ package jalview.appletgui; import jalview.datamodel.SequenceGroup; -import jalview.schemes.CollectionColourSchemeI; +import jalview.renderer.ResidueShaderI; import jalview.util.MessageManager; import java.awt.BorderLayout; @@ -53,14 +53,14 @@ public class SliderPanel extends Panel implements ActionListener, boolean forConservation = true; - CollectionColourSchemeI cs; + ResidueShaderI cs; static Frame conservationSlider; static Frame PIDSlider; public static int setConservationSlider(AlignmentPanel ap, - CollectionColourSchemeI ccs, String source) + ResidueShaderI ccs, String source) { SliderPanel sp = null; @@ -121,7 +121,7 @@ public class SliderPanel extends Panel implements ActionListener, } public static int setPIDSliderSource(AlignmentPanel ap, - CollectionColourSchemeI ccs, String source) + ResidueShaderI ccs, String source) { SliderPanel pid = null; if (PIDSlider == null) @@ -204,7 +204,7 @@ public class SliderPanel extends Panel implements ActionListener, } } public SliderPanel(AlignmentPanel ap, int value, boolean forConserve, - CollectionColourSchemeI collectionColourSchemeI) + ResidueShaderI shader) { try { @@ -214,7 +214,7 @@ public class SliderPanel extends Panel implements ActionListener, e.printStackTrace(); } this.ap = ap; - this.cs = collectionColourSchemeI; + this.cs = shader; forConservation = forConserve; undoButton.setVisible(false); applyButton.setVisible(false); @@ -249,7 +249,7 @@ public class SliderPanel extends Panel implements ActionListener, return; } - CollectionColourSchemeI toChange = cs; + ResidueShaderI toChange = cs; Iterator allGroups = null; if (allGroupsCheck.getState()) diff --git a/src/jalview/appletgui/UserDefinedColours.java b/src/jalview/appletgui/UserDefinedColours.java index aecc0c9..b794724 100644 --- a/src/jalview/appletgui/UserDefinedColours.java +++ b/src/jalview/appletgui/UserDefinedColours.java @@ -22,7 +22,7 @@ package jalview.appletgui; import jalview.api.FeatureColourI; import jalview.datamodel.SequenceGroup; -import jalview.schemes.CollectionColourScheme; +import jalview.renderer.ResidueShader; import jalview.schemes.ColourSchemeI; import jalview.schemes.FeatureColour; import jalview.schemes.ResidueProperties; @@ -506,7 +506,7 @@ public class UserDefinedColours extends Panel implements ActionListener, { if (seqGroup != null) { - seqGroup.cs = new CollectionColourScheme(ucs); + seqGroup.cs = new ResidueShader(ucs); seqGroup.getGroupColourScheme().setThreshold(0, ap.av.isIgnoreGapsConsensus()); } @@ -592,7 +592,7 @@ public class UserDefinedColours extends Panel implements ActionListener, { if (seqGroup != null) { - seqGroup.cs = new CollectionColourScheme(ucs); + seqGroup.cs = new ResidueShader(ucs); } else { diff --git a/src/jalview/datamodel/SequenceGroup.java b/src/jalview/datamodel/SequenceGroup.java index c77569e..a1579c5 100755 --- a/src/jalview/datamodel/SequenceGroup.java +++ b/src/jalview/datamodel/SequenceGroup.java @@ -22,8 +22,8 @@ package jalview.datamodel; import jalview.analysis.AAFrequency; import jalview.analysis.Conservation; -import jalview.schemes.CollectionColourScheme; -import jalview.schemes.CollectionColourSchemeI; +import jalview.renderer.ResidueShader; +import jalview.renderer.ResidueShaderI; import jalview.schemes.ColourSchemeI; import java.awt.Color; @@ -71,7 +71,7 @@ public class SequenceGroup implements AnnotatedCollectionI /** * Colourscheme applied to group if any */ - public CollectionColourSchemeI cs; + public ResidueShaderI cs; // start column (base 0) int startRes = 0; @@ -118,7 +118,7 @@ public class SequenceGroup implements AnnotatedCollectionI public SequenceGroup() { groupName = "JGroup:" + this.hashCode(); - cs = new CollectionColourScheme(); + cs = new ResidueShader(); } /** @@ -145,7 +145,7 @@ public class SequenceGroup implements AnnotatedCollectionI this.displayBoxes = displayBoxes; this.displayText = displayText; this.colourText = colourText; - this.cs = new CollectionColourScheme(scheme); + this.cs = new ResidueShader(scheme); startRes = start; endRes = end; recalcConservation(); @@ -1371,12 +1371,12 @@ public class SequenceGroup implements AnnotatedCollectionI { if (cs == null) { - cs = new CollectionColourScheme(); + cs = new ResidueShader(); } cs.setColourScheme(scheme); } - public void setGroupColourScheme(CollectionColourSchemeI scheme) + public void setGroupColourScheme(ResidueShaderI scheme) { cs = scheme; } @@ -1386,7 +1386,7 @@ public class SequenceGroup implements AnnotatedCollectionI return cs == null ? null : cs.getColourScheme(); } - public CollectionColourSchemeI getGroupColourScheme() + public ResidueShaderI getGroupColourScheme() { return cs; } diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index 35a87d4..a201757 100644 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -41,7 +41,7 @@ import jalview.datamodel.SearchResultsI; import jalview.datamodel.Sequence; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; -import jalview.schemes.CollectionColourScheme; +import jalview.renderer.ResidueShader; import jalview.schemes.ColourSchemeI; import jalview.schemes.ColourSchemeProperty; import jalview.schemes.UserColourScheme; @@ -295,11 +295,11 @@ public class AlignViewport extends AlignmentViewport implements { ColourSchemeI colourScheme = ColourSchemeProperty.getColourScheme( alignment, propertyValue); - globalColourScheme = new CollectionColourScheme(colourScheme); + globalColourScheme = new ResidueShader(colourScheme); if (colourScheme instanceof UserColourScheme) { - globalColourScheme = new CollectionColourScheme( + globalColourScheme = new ResidueShader( UserDefinedColours.loadDefaultColours()); globalColourScheme.setThreshold(0, isIgnoreGapsConsensus()); } diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index 8393693..d5ec6ac 100644 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -39,6 +39,7 @@ import jalview.ext.varna.RnaModel; import jalview.gui.StructureViewer.ViewerType; import jalview.io.DataSourceType; import jalview.io.FileFormat; +import jalview.renderer.ResidueShaderI; import jalview.schemabinding.version2.AlcodMap; import jalview.schemabinding.version2.AlcodonFrame; import jalview.schemabinding.version2.Annotation; @@ -73,7 +74,6 @@ import jalview.schemabinding.version2.Tree; import jalview.schemabinding.version2.UserColours; import jalview.schemabinding.version2.Viewport; import jalview.schemes.AnnotationColourGradient; -import jalview.schemes.CollectionColourSchemeI; import jalview.schemes.ColourSchemeI; import jalview.schemes.ColourSchemeProperty; import jalview.schemes.FeatureColour; @@ -1178,7 +1178,7 @@ public class Jalview2XML ColourSchemeI colourScheme = sg.getColourScheme(); if (colourScheme != null) { - CollectionColourSchemeI groupColourScheme = sg + ResidueShaderI groupColourScheme = sg .getGroupColourScheme(); if (groupColourScheme.conservationApplied()) { @@ -1294,7 +1294,7 @@ public class Jalview2XML .getGlobalColourScheme())); } - CollectionColourSchemeI vcs = av.getViewportColourScheme(); + ResidueShaderI vcs = av.getViewportColourScheme(); ColourSchemeI cs = av.getGlobalColourScheme(); if (cs != null) diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index 47b0694..07dad72 100644 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -35,7 +35,7 @@ import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; import jalview.io.SequenceAnnotationReport; -import jalview.schemes.CollectionColourSchemeI; +import jalview.renderer.ResidueShaderI; import jalview.schemes.ResidueProperties; import jalview.structure.SelectionListener; import jalview.structure.SelectionSource; @@ -1733,7 +1733,7 @@ public class SeqPanel extends JPanel implements MouseListener, stretchGroup.cs.alignmentChanged(stretchGroup, av.getHiddenRepSequences()); - CollectionColourSchemeI groupColourScheme = stretchGroup.getGroupColourScheme(); + ResidueShaderI groupColourScheme = stretchGroup.getGroupColourScheme(); String name = stretchGroup.getName(); if (stretchGroup.cs.conservationApplied()) { diff --git a/src/jalview/gui/SequenceRenderer.java b/src/jalview/gui/SequenceRenderer.java index 311439a..e77536d 100755 --- a/src/jalview/gui/SequenceRenderer.java +++ b/src/jalview/gui/SequenceRenderer.java @@ -23,7 +23,7 @@ package jalview.gui; import jalview.api.FeatureRenderer; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; -import jalview.schemes.CollectionColourSchemeI; +import jalview.renderer.ResidueShaderI; import jalview.util.Comparison; import java.awt.Color; @@ -132,19 +132,18 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer /** * DOCUMENT ME! * - * @param collectionColourSchemeI + * @param shader * DOCUMENT ME! * @param seq * DOCUMENT ME! * @param i * DOCUMENT ME! */ - void getBoxColour(CollectionColourSchemeI collectionColourSchemeI, - SequenceI seq, int i) + void getBoxColour(ResidueShaderI shader, SequenceI seq, int i) { - if (collectionColourSchemeI != null) + if (shader != null) { - resBoxColour = collectionColourSchemeI.findColour(seq.getCharAt(i), + resBoxColour = shader.findColour(seq.getCharAt(i), i, seq); } else if (forOverview && !Comparison.isGap(seq.getCharAt(i))) diff --git a/src/jalview/gui/SliderPanel.java b/src/jalview/gui/SliderPanel.java index 40f86b8..1793a9b 100755 --- a/src/jalview/gui/SliderPanel.java +++ b/src/jalview/gui/SliderPanel.java @@ -22,7 +22,7 @@ package jalview.gui; import jalview.datamodel.SequenceGroup; import jalview.jbgui.GSliderPanel; -import jalview.schemes.CollectionColourSchemeI; +import jalview.renderer.ResidueShaderI; import jalview.util.MessageManager; import java.awt.event.MouseAdapter; @@ -52,7 +52,7 @@ public class SliderPanel extends GSliderPanel boolean forConservation = true; - CollectionColourSchemeI cs; + ResidueShaderI cs; private static SliderPanel sliderPanel; @@ -79,7 +79,7 @@ public class SliderPanel extends GSliderPanel * DOCUMENT ME! */ public SliderPanel(final AlignmentPanel ap, int value, - boolean forConserve, CollectionColourSchemeI scheme) + boolean forConserve, ResidueShaderI scheme) { this.ap = ap; this.cs = scheme; @@ -138,7 +138,7 @@ public class SliderPanel extends GSliderPanel * @return DOCUMENT ME! */ public static int setConservationSlider(AlignmentPanel ap, - CollectionColourSchemeI ccs, String source) + ResidueShaderI ccs, String source) { sliderPanel = null; @@ -244,7 +244,7 @@ public class SliderPanel extends GSliderPanel * @return DOCUMENT ME! */ public static int setPIDSliderSource(AlignmentPanel ap, - CollectionColourSchemeI ccs, String source) + ResidueShaderI ccs, String source) { int threshold = ccs.getThreshold(); @@ -339,7 +339,7 @@ public class SliderPanel extends GSliderPanel * @param percent * @param scheme */ - protected void updateColourScheme(int percent, CollectionColourSchemeI scheme) + protected void updateColourScheme(int percent, ResidueShaderI scheme) { if (scheme == null) { diff --git a/src/jalview/renderer/AnnotationRenderer.java b/src/jalview/renderer/AnnotationRenderer.java index 5973710..9b0d938 100644 --- a/src/jalview/renderer/AnnotationRenderer.java +++ b/src/jalview/renderer/AnnotationRenderer.java @@ -29,8 +29,6 @@ import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.Annotation; import jalview.datamodel.ColumnSelection; import jalview.datamodel.ProfilesI; -import jalview.schemes.CollectionColourScheme; -import jalview.schemes.CollectionColourSchemeI; import jalview.schemes.ColourSchemeI; import jalview.schemes.NucleotideColourScheme; import jalview.schemes.ResidueProperties; @@ -74,7 +72,7 @@ public class AnnotationRenderer boolean av_renderHistogram = true, av_renderProfile = true, av_normaliseProfile = false; - CollectionColourSchemeI profcolour = null; + ResidueShaderI profcolour = null; private ColumnSelection columnSelection; @@ -326,7 +324,7 @@ public class AnnotationRenderer */ ColourSchemeI col = av.getAlignment().isNucleotide() ? new NucleotideColourScheme() : new ZappoColourScheme(); - profcolour = new CollectionColourScheme(col); + profcolour = new ResidueShader(col); } columnSelection = av.getColumnSelection(); hconsensus = av.getSequenceConsensusHash(); diff --git a/src/jalview/schemes/CollectionColourScheme.java b/src/jalview/renderer/ResidueShader.java similarity index 86% rename from src/jalview/schemes/CollectionColourScheme.java rename to src/jalview/renderer/ResidueShader.java index ebff6e6..c591031 100644 --- a/src/jalview/schemes/CollectionColourScheme.java +++ b/src/jalview/renderer/ResidueShader.java @@ -1,4 +1,4 @@ -package jalview.schemes; +package jalview.renderer; import jalview.analysis.Conservation; import jalview.datamodel.AnnotatedCollectionI; @@ -6,6 +6,7 @@ import jalview.datamodel.ProfileI; import jalview.datamodel.ProfilesI; import jalview.datamodel.SequenceCollectionI; import jalview.datamodel.SequenceI; +import jalview.schemes.ColourSchemeI; import jalview.util.ColorUtils; import jalview.util.Comparison; @@ -24,7 +25,7 @@ import java.util.Map; * @author gmcarstairs * */ -public class CollectionColourScheme implements CollectionColourSchemeI +public class ResidueShader implements ResidueShaderI { private ColourSchemeI colourScheme; @@ -40,7 +41,7 @@ public class CollectionColourScheme implements CollectionColourSchemeI private int inc; - public CollectionColourScheme(ColourSchemeI cs) + public ResidueShader(ColourSchemeI cs) { colourScheme = cs; } @@ -48,12 +49,12 @@ public class CollectionColourScheme implements CollectionColourSchemeI /** * Default constructor */ - public CollectionColourScheme() + public ResidueShader() { } /** - * @see jalview.schemes.CollectionColourSchemeI#setConsensus(jalview.datamodel.ProfilesI) + * @see jalview.renderer.ResidueShaderI#setConsensus(jalview.datamodel.ProfilesI) */ @Override public void setConsensus(ProfilesI cons) @@ -62,7 +63,7 @@ public class CollectionColourScheme implements CollectionColourSchemeI } /** - * @see jalview.schemes.CollectionColourSchemeI#conservationApplied() + * @see jalview.renderer.ResidueShaderI#conservationApplied() */ @Override public boolean conservationApplied() @@ -71,7 +72,7 @@ public class CollectionColourScheme implements CollectionColourSchemeI } /** - * @see jalview.schemes.CollectionColourSchemeI#setConservationApplied(boolean) + * @see jalview.renderer.ResidueShaderI#setConservationApplied(boolean) */ @Override public void setConservationApplied(boolean conservationApplied) @@ -80,7 +81,7 @@ public class CollectionColourScheme implements CollectionColourSchemeI } /** - * @see jalview.schemes.CollectionColourSchemeI#setConservation(jalview.analysis.Conservation) + * @see jalview.renderer.ResidueShaderI#setConservation(jalview.analysis.Conservation) */ @Override public void setConservation(Conservation cons) @@ -100,7 +101,7 @@ public class CollectionColourScheme implements CollectionColourSchemeI } /** - * @see jalview.schemes.CollectionColourSchemeI#alignmentChanged(jalview.datamodel.AnnotatedCollectionI, + * @see jalview.renderer.ResidueShaderI#alignmentChanged(jalview.datamodel.AnnotatedCollectionI, * java.util.Map) */ @Override @@ -114,7 +115,7 @@ public class CollectionColourScheme implements CollectionColourSchemeI } /** - * @see jalview.schemes.CollectionColourSchemeI#setThreshold(int, boolean) + * @see jalview.renderer.ResidueShaderI#setThreshold(int, boolean) */ @Override public void setThreshold(int consensusThreshold, boolean ignoreGaps) @@ -124,7 +125,7 @@ public class CollectionColourScheme implements CollectionColourSchemeI } /** - * @see jalview.schemes.CollectionColourSchemeI#setConservationInc(int) + * @see jalview.renderer.ResidueShaderI#setConservationInc(int) */ @Override public void setConservationInc(int i) @@ -133,7 +134,7 @@ public class CollectionColourScheme implements CollectionColourSchemeI } /** - * @see jalview.schemes.CollectionColourSchemeI#getConservationInc() + * @see jalview.renderer.ResidueShaderI#getConservationInc() */ @Override public int getConservationInc() @@ -142,7 +143,7 @@ public class CollectionColourScheme implements CollectionColourSchemeI } /** - * @see jalview.schemes.CollectionColourSchemeI#getThreshold() + * @see jalview.renderer.ResidueShaderI#getThreshold() */ @Override public int getThreshold() @@ -151,7 +152,7 @@ public class CollectionColourScheme implements CollectionColourSchemeI } /** - * @see jalview.schemes.CollectionColourSchemeI#findColour(char, int, + * @see jalview.renderer.ResidueShaderI#findColour(char, int, * jalview.datamodel.SequenceI) */ @Override @@ -313,7 +314,7 @@ public class CollectionColourScheme implements CollectionColourSchemeI } /** - * @see jalview.schemes.CollectionColourSchemeI#getColourScheme() + * @see jalview.renderer.ResidueShaderI#getColourScheme() */ @Override public ColourSchemeI getColourScheme() @@ -322,7 +323,7 @@ public class CollectionColourScheme implements CollectionColourSchemeI } /** - * @see jalview.schemes.CollectionColourSchemeI#setColourScheme(jalview.schemes.ColourSchemeI) + * @see jalview.renderer.ResidueShaderI#setColourScheme(jalview.schemes.ColourSchemeI) */ @Override public void setColourScheme(ColourSchemeI cs) diff --git a/src/jalview/schemes/CollectionColourSchemeI.java b/src/jalview/renderer/ResidueShaderI.java similarity index 94% rename from src/jalview/schemes/CollectionColourSchemeI.java rename to src/jalview/renderer/ResidueShaderI.java index 152b02a..a914a1a 100644 --- a/src/jalview/schemes/CollectionColourSchemeI.java +++ b/src/jalview/renderer/ResidueShaderI.java @@ -1,15 +1,16 @@ -package jalview.schemes; +package jalview.renderer; import jalview.analysis.Conservation; import jalview.datamodel.AnnotatedCollectionI; import jalview.datamodel.ProfilesI; import jalview.datamodel.SequenceCollectionI; import jalview.datamodel.SequenceI; +import jalview.schemes.ColourSchemeI; import java.awt.Color; import java.util.Map; -public interface CollectionColourSchemeI +public interface ResidueShaderI { public abstract void setConsensus(ProfilesI cons); diff --git a/src/jalview/viewmodel/AlignmentViewport.java b/src/jalview/viewmodel/AlignmentViewport.java index 69879b7..1352cf2 100644 --- a/src/jalview/viewmodel/AlignmentViewport.java +++ b/src/jalview/viewmodel/AlignmentViewport.java @@ -42,9 +42,9 @@ import jalview.datamodel.Sequence; import jalview.datamodel.SequenceCollectionI; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; +import jalview.renderer.ResidueShader; +import jalview.renderer.ResidueShaderI; import jalview.schemes.Blosum62ColourScheme; -import jalview.schemes.CollectionColourScheme; -import jalview.schemes.CollectionColourSchemeI; import jalview.schemes.ColourSchemeI; import jalview.schemes.PIDColourScheme; import jalview.structure.CommandListener; @@ -599,7 +599,7 @@ public abstract class AlignmentViewport implements AlignViewportI, protected boolean ignoreGapsInConsensusCalculation = false; - protected CollectionColourSchemeI globalColourScheme; + protected ResidueShaderI globalColourScheme; @Override public void setGlobalColourScheme(ColourSchemeI cs) @@ -619,7 +619,7 @@ public abstract class AlignmentViewport implements AlignViewportI, */ if (globalColourScheme == null) { - globalColourScheme = new CollectionColourScheme(); + globalColourScheme = new ResidueShader(); } globalColourScheme.setColourScheme(cs); @@ -670,7 +670,7 @@ public abstract class AlignmentViewport implements AlignViewportI, } @Override - public CollectionColourSchemeI getViewportColourScheme() + public ResidueShaderI getViewportColourScheme() { return globalColourScheme; } @@ -1850,7 +1850,7 @@ public abstract class AlignmentViewport implements AlignViewportI, */ void resetAllColourSchemes() { - CollectionColourSchemeI cs = globalColourScheme; + ResidueShaderI cs = globalColourScheme; if (cs != null) { cs.alignmentChanged(alignment, hiddenRepSequences); diff --git a/src/jalview/workers/ConsensusThread.java b/src/jalview/workers/ConsensusThread.java index 0278a3b..fa3fe75 100644 --- a/src/jalview/workers/ConsensusThread.java +++ b/src/jalview/workers/ConsensusThread.java @@ -28,7 +28,7 @@ import jalview.datamodel.AlignmentI; import jalview.datamodel.Annotation; import jalview.datamodel.ProfilesI; import jalview.datamodel.SequenceI; -import jalview.schemes.CollectionColourSchemeI; +import jalview.renderer.ResidueShaderI; public class ConsensusThread extends AlignCalcWorker { @@ -147,7 +147,7 @@ public class ConsensusThread extends AlignCalcWorker */ protected void setColourSchemeConsensus(ProfilesI hconsensus) { - CollectionColourSchemeI cs = alignViewport.getViewportColourScheme(); + ResidueShaderI cs = alignViewport.getViewportColourScheme(); if (cs != null) { cs.setConsensus(hconsensus); diff --git a/test/jalview/schemes/CollectionColourSchemeTest.java b/test/jalview/renderer/ResidueShaderTest.java similarity index 94% rename from test/jalview/schemes/CollectionColourSchemeTest.java rename to test/jalview/renderer/ResidueShaderTest.java index 9dffdb4..76fd9b4 100644 --- a/test/jalview/schemes/CollectionColourSchemeTest.java +++ b/test/jalview/renderer/ResidueShaderTest.java @@ -1,4 +1,4 @@ -package jalview.schemes; +package jalview.renderer; import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertFalse; @@ -10,13 +10,14 @@ import jalview.datamodel.ProfileI; import jalview.datamodel.Profiles; import jalview.datamodel.Sequence; import jalview.datamodel.SequenceI; +import jalview.schemes.PIDColourScheme; import java.awt.Color; import java.util.Collections; import org.testng.annotations.Test; -public class CollectionColourSchemeTest +public class ResidueShaderTest { @Test(groups = "Functional") @@ -34,10 +35,9 @@ public class CollectionColourSchemeTest profiles[1] = new Profile(4, 0, 4, "R"); profiles[2] = new Profile(4, 4, 0, ""); profiles[3] = new Profile(4, 1, 2, "T"); - CollectionColourScheme ccs = new CollectionColourScheme( - new PIDColourScheme()); + ResidueShader ccs = new ResidueShader(new PIDColourScheme()); ccs.setConsensus(new Profiles(profiles)); - + /* * no threshold */ @@ -49,7 +49,7 @@ public class CollectionColourSchemeTest assertTrue(ccs.aboveThreshold('W', 2)); assertTrue(ccs.aboveThreshold('t', 3)); assertTrue(ccs.aboveThreshold('Q', 3)); - + /* * with threshold, include gaps */ @@ -59,7 +59,7 @@ public class CollectionColourSchemeTest assertTrue(ccs.aboveThreshold('R', 1)); assertFalse(ccs.aboveThreshold('W', 2)); assertFalse(ccs.aboveThreshold('t', 3)); // 50% < 60% - + /* * with threshold, ignore gaps */ @@ -78,12 +78,11 @@ public class CollectionColourSchemeTest @Test(groups = "Functional") public void testApplyConservation() { - CollectionColourScheme ccs = new CollectionColourScheme( - new PIDColourScheme()); - + ResidueShader ccs = new ResidueShader(new PIDColourScheme()); + // no conservation present - no fading assertEquals(Color.RED, ccs.applyConservation(Color.RED, 12)); - + /* * stub Conservation to return a given consensus string */ @@ -92,16 +91,17 @@ public class CollectionColourSchemeTest Collections. emptyList(), 0, 0) { @Override - public SequenceI getConsSequence() { + public SequenceI getConsSequence() + { return new Sequence("seq", consSequence); } }; ccs.setConservation(cons); - + // column out of range: assertEquals(Color.RED, ccs.applyConservation(Color.RED, consSequence.length())); - + /* * with 100% threshold, 'fade factor' is * (11-score)/10 * 100/20 = (11-score)/2 @@ -121,7 +121,7 @@ public class CollectionColourSchemeTest assertEquals(Color.RED, ccs.applyConservation(Color.RED, 10)); assertEquals(Color.RED, ccs.applyConservation(Color.RED, 11)); assertEquals(Color.WHITE, ccs.applyConservation(Color.RED, 12)); - + /* * with 0% threshold, there should be no fading */ @@ -139,7 +139,7 @@ public class CollectionColourSchemeTest assertEquals(Color.RED, ccs.applyConservation(Color.RED, 10)); assertEquals(Color.RED, ccs.applyConservation(Color.RED, 11)); assertEquals(Color.WHITE, ccs.applyConservation(Color.RED, 12)); // gap - + /* * with 40% threshold, 'fade factor' is * (11-score)/10 * 40/20 = (11-score)/5