From 863467bf6c59c0bc5368c8f3a03d9d5a4f10700d Mon Sep 17 00:00:00 2001 From: jprocter Date: Fri, 4 May 2012 16:43:09 +0100 Subject: [PATCH] JAL-1065 JAL-1066 - use direct object reference rather then index into alignment --- src/jalview/appletgui/SequenceRenderer.java | 2 +- src/jalview/appletgui/UserDefinedColours.java | 2 +- src/jalview/gui/SequenceRenderer.java | 2 +- src/jalview/gui/UserDefinedColours.java | 2 +- src/jalview/schemes/AnnotationColourGradient.java | 5 +++-- src/jalview/schemes/Blosum62ColourScheme.java | 4 ++-- src/jalview/schemes/ClustalxColourScheme.java | 2 +- src/jalview/schemes/ColourSchemeI.java | 3 ++- src/jalview/schemes/NucleotideColourScheme.java | 4 +++- src/jalview/schemes/PIDColourScheme.java | 3 ++- src/jalview/schemes/ResidueColourScheme.java | 3 ++- src/jalview/schemes/ScoreColourScheme.java | 4 +++- src/jalview/schemes/UserColourScheme.java | 3 ++- 13 files changed, 24 insertions(+), 15 deletions(-) diff --git a/src/jalview/appletgui/SequenceRenderer.java b/src/jalview/appletgui/SequenceRenderer.java index 32ff59a..2bd3a9e 100755 --- a/src/jalview/appletgui/SequenceRenderer.java +++ b/src/jalview/appletgui/SequenceRenderer.java @@ -87,7 +87,7 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer { if (cs != null) { - resBoxColour = cs.findColour(seq.getCharAt(i), i, seq.getIndex()); + resBoxColour = cs.findColour(seq.getCharAt(i), i, seq); } else if (forOverview && !jalview.util.Comparison.isGap(seq.getCharAt(i))) diff --git a/src/jalview/appletgui/UserDefinedColours.java b/src/jalview/appletgui/UserDefinedColours.java index 4ebe3b7..19ca45d 100755 --- a/src/jalview/appletgui/UserDefinedColours.java +++ b/src/jalview/appletgui/UserDefinedColours.java @@ -397,7 +397,7 @@ public class UserDefinedColours extends Panel implements ActionListener, { try { - col = oldColourScheme.findColour(aa.charAt(0), -1, -1); + col = oldColourScheme.findColour(aa.charAt(0), -1, null); } catch (Exception ex) { } diff --git a/src/jalview/gui/SequenceRenderer.java b/src/jalview/gui/SequenceRenderer.java index 15f1928..9c25e0d 100755 --- a/src/jalview/gui/SequenceRenderer.java +++ b/src/jalview/gui/SequenceRenderer.java @@ -115,7 +115,7 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer { if (cs != null) { - resBoxColour = cs.findColour(seq.getCharAt(i), i, seq.getIndex()); + resBoxColour = cs.findColour(seq.getCharAt(i), i, seq); } else if (forOverview && !jalview.util.Comparison.isGap(seq.getCharAt(i))) diff --git a/src/jalview/gui/UserDefinedColours.java b/src/jalview/gui/UserDefinedColours.java index 8566e82..ca60354 100755 --- a/src/jalview/gui/UserDefinedColours.java +++ b/src/jalview/gui/UserDefinedColours.java @@ -386,7 +386,7 @@ public class UserDefinedColours extends GUserDefinedColours implements { try { - col = oldColourScheme.findColour(aa.charAt(0), -1, -1); + col = oldColourScheme.findColour(aa.charAt(0), -1, null); } catch (Exception ex) { } diff --git a/src/jalview/schemes/AnnotationColourGradient.java b/src/jalview/schemes/AnnotationColourGradient.java index 5d12cce..b0365ce 100755 --- a/src/jalview/schemes/AnnotationColourGradient.java +++ b/src/jalview/schemes/AnnotationColourGradient.java @@ -19,6 +19,7 @@ package jalview.schemes; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.GraphLine; +import jalview.datamodel.SequenceI; import java.awt.Color; @@ -154,7 +155,7 @@ public class AnnotationColourGradient extends ResidueColourScheme * @return DOCUMENT ME! */ @Override - public Color findColour(char c, int j, int sequenceIndex) + public Color findColour(char c, int j, SequenceI seq) { Color currentColour = Color.white; @@ -204,7 +205,7 @@ public class AnnotationColourGradient extends ResidueColourScheme if (colourScheme != null) { - currentColour = colourScheme.findColour(c, j, sequenceIndex); + currentColour = colourScheme.findColour(c, j, seq); } else if (range != 0) { diff --git a/src/jalview/schemes/Blosum62ColourScheme.java b/src/jalview/schemes/Blosum62ColourScheme.java index c511ded..27b8996 100755 --- a/src/jalview/schemes/Blosum62ColourScheme.java +++ b/src/jalview/schemes/Blosum62ColourScheme.java @@ -20,7 +20,7 @@ package jalview.schemes; import jalview.analysis.AAFrequency; import java.awt.Color; - +import jalview.datamodel.SequenceI; public class Blosum62ColourScheme extends ResidueColourScheme { public Blosum62ColourScheme() @@ -29,7 +29,7 @@ public class Blosum62ColourScheme extends ResidueColourScheme } @Override - public Color findColour(char res, int j, int sequenceIndex) + public Color findColour(char res, int j, SequenceI seq) { if ('a' <= res && res <= 'z') { diff --git a/src/jalview/schemes/ClustalxColourScheme.java b/src/jalview/schemes/ClustalxColourScheme.java index ad6d37f..7258605 100755 --- a/src/jalview/schemes/ClustalxColourScheme.java +++ b/src/jalview/schemes/ClustalxColourScheme.java @@ -258,7 +258,7 @@ public class ClustalxColourScheme extends ResidueColourScheme // implements } @Override - public Color findColour(char c, int j, int sequenceIndex) + public Color findColour(char c, int j, SequenceI seq) { Color currentColour; diff --git a/src/jalview/schemes/ColourSchemeI.java b/src/jalview/schemes/ColourSchemeI.java index e8e5828..b197906 100755 --- a/src/jalview/schemes/ColourSchemeI.java +++ b/src/jalview/schemes/ColourSchemeI.java @@ -19,11 +19,12 @@ package jalview.schemes; import java.awt.Color; +import jalview.datamodel.SequenceI; public interface ColourSchemeI { public Color findColour(char c); - public Color findColour(char c, int j, int sequenceIndex); + public Color findColour(char c, int j, SequenceI seq); public void setConsensus(java.util.Hashtable[] h); diff --git a/src/jalview/schemes/NucleotideColourScheme.java b/src/jalview/schemes/NucleotideColourScheme.java index df4d9a9..1de5764 100755 --- a/src/jalview/schemes/NucleotideColourScheme.java +++ b/src/jalview/schemes/NucleotideColourScheme.java @@ -17,6 +17,8 @@ */ package jalview.schemes; +import jalview.datamodel.SequenceI; + import java.awt.Color; /** @@ -61,7 +63,7 @@ public class NucleotideColourScheme extends ResidueColourScheme * @return DOCUMENT ME! */ @Override - public Color findColour(char c, int j, int sequenceIndex) + public Color findColour(char c, int j, SequenceI seq) { Color currentColour; if ((threshold == 0) || aboveThreshold(c, j)) diff --git a/src/jalview/schemes/PIDColourScheme.java b/src/jalview/schemes/PIDColourScheme.java index c4f7eb5..a64bf20 100755 --- a/src/jalview/schemes/PIDColourScheme.java +++ b/src/jalview/schemes/PIDColourScheme.java @@ -19,6 +19,7 @@ package jalview.schemes; import jalview.analysis.AAFrequency; import jalview.datamodel.SequenceGroup; +import jalview.datamodel.SequenceI; import java.awt.Color; @@ -38,7 +39,7 @@ public class PIDColourScheme extends ResidueColourScheme @Override - public Color findColour(char c, int j, int sequenceIndex) + public Color findColour(char c, int j, SequenceI seq) { if ('a' <= c && c <= 'z') { diff --git a/src/jalview/schemes/ResidueColourScheme.java b/src/jalview/schemes/ResidueColourScheme.java index cc7f0d8..5c0aa53 100755 --- a/src/jalview/schemes/ResidueColourScheme.java +++ b/src/jalview/schemes/ResidueColourScheme.java @@ -19,6 +19,7 @@ package jalview.schemes; import jalview.analysis.AAFrequency; import jalview.analysis.Conservation; +import jalview.datamodel.SequenceI; import java.awt.Color; import java.util.Hashtable; @@ -83,7 +84,7 @@ public class ResidueColourScheme implements ColourSchemeI } @Override - public Color findColour(char c, int j, int sequenceIndex) + public Color findColour(char c, int j, SequenceI seq) { Color currentColour; diff --git a/src/jalview/schemes/ScoreColourScheme.java b/src/jalview/schemes/ScoreColourScheme.java index 49aeeeb..7cd5cb6 100755 --- a/src/jalview/schemes/ScoreColourScheme.java +++ b/src/jalview/schemes/ScoreColourScheme.java @@ -17,6 +17,8 @@ */ package jalview.schemes; +import jalview.datamodel.SequenceI; + import java.awt.Color; /** @@ -86,7 +88,7 @@ public class ScoreColourScheme extends ResidueColourScheme * @return DOCUMENT ME! */ @Override - public Color findColour(char c, int j, int sequenceIndex) + public Color findColour(char c, int j, SequenceI seq) { if (threshold > 0) { diff --git a/src/jalview/schemes/UserColourScheme.java b/src/jalview/schemes/UserColourScheme.java index 0c1e688..62dfec5 100755 --- a/src/jalview/schemes/UserColourScheme.java +++ b/src/jalview/schemes/UserColourScheme.java @@ -19,6 +19,7 @@ package jalview.schemes; import java.awt.Color; import java.util.StringTokenizer; +import jalview.datamodel.SequenceI; public class UserColourScheme extends ResidueColourScheme { @@ -201,7 +202,7 @@ public class UserColourScheme extends ResidueColourScheme } @Override - public Color findColour(char c, int j, int sequenceIndex) + public Color findColour(char c, int j, SequenceI seq) { Color currentColour; int index = ResidueProperties.aaIndex[c]; -- 1.7.10.2