X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemes%2FBlosum62ColourScheme.java;h=be77e006fa37c706040cc7573d44e39d546fb5ac;hb=7d6bf4ac01167499c0f4e07de63edcdd72a6d595;hp=90f90f079f7a8f712b56cfee4ca484466b33d755;hpb=1c757dc1e6ee864277825c1ebd9c6a9fbe0da7b2;p=jalview.git diff --git a/src/jalview/schemes/Blosum62ColourScheme.java b/src/jalview/schemes/Blosum62ColourScheme.java index 90f90f0..be77e00 100755 --- a/src/jalview/schemes/Blosum62ColourScheme.java +++ b/src/jalview/schemes/Blosum62ColourScheme.java @@ -30,11 +30,25 @@ import java.util.Map; public class Blosum62ColourScheme extends ResidueColourScheme { + private static final Color LIGHT_BLUE = new Color(204, 204, 255); + private static final Color DARK_BLUE = new Color(154, 154, 255); + public Blosum62ColourScheme() { super(); } + /** + * Returns a new instance of this colour scheme with which the given data may + * be coloured + */ + @Override + public ColourSchemeI getInstance(AnnotatedCollectionI coll, + Map hrs) + { + return new Blosum62ColourScheme(); + } + @Override public Color findColour(char res, int j, SequenceI seq) { @@ -44,7 +58,7 @@ public class Blosum62ColourScheme extends ResidueColourScheme res -= ('a' - 'A'); } - if (consensus == null || j >= consensus.length || consensus[j] == null + if (consensus == null || consensus.get(j) == null || (threshold != 0 && !aboveThreshold(res, j))) { return Color.white; @@ -54,12 +68,14 @@ public class Blosum62ColourScheme extends ResidueColourScheme if (!Comparison.isGap(res)) { - String max = consensus[j].getModalResidue(); + /* + * test if this is the consensus (or joint consensus) residue + */ + String max = consensus.get(j).getModalResidue(); if (max.indexOf(res) > -1) { - // TODO use a constant here? - currentColour = new Color(154, 154, 255); + currentColour = DARK_BLUE; } else { @@ -74,8 +90,7 @@ public class Blosum62ColourScheme extends ResidueColourScheme if (c > 0) { - // TODO use a constant here? - currentColour = new Color(204, 204, 255); + currentColour = LIGHT_BLUE; } else { @@ -97,10 +112,20 @@ public class Blosum62ColourScheme extends ResidueColourScheme } @Override - public ColourSchemeI applyTo(AnnotatedCollectionI sg, - Map hiddenRepSequences) + public boolean isPeptideSpecific() + { + return true; + } + + @Override + public String getSchemeName() + { + return JalviewColourScheme.Blosum62.toString(); + } + + @Override + public boolean isSimple() { - ColourSchemeI newcs = super.applyTo(sg, hiddenRepSequences); - return newcs; + return false; } }