git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-4235 JAL-3599 Try and report Eclipse Product Version for jalviewjsTranspile....
[jalview.git]
/
src
/
jalview
/
schemes
/
Blosum62ColourScheme.java
diff --git
a/src/jalview/schemes/Blosum62ColourScheme.java
b/src/jalview/schemes/Blosum62ColourScheme.java
index
c47f171
..
8188f4d
100755
(executable)
--- a/
src/jalview/schemes/Blosum62ColourScheme.java
+++ b/
src/jalview/schemes/Blosum62ColourScheme.java
@@
-20,17
+20,19
@@
*/
package jalview.schemes;
*/
package jalview.schemes;
+import jalview.analysis.scoremodels.ScoreModels;
+import jalview.api.AlignViewportI;
+import jalview.api.analysis.PairwiseScoreModelI;
import jalview.datamodel.AnnotatedCollectionI;
import jalview.datamodel.AnnotatedCollectionI;
-import jalview.datamodel.SequenceCollectionI;
import jalview.datamodel.SequenceI;
import jalview.util.Comparison;
import java.awt.Color;
import jalview.datamodel.SequenceI;
import jalview.util.Comparison;
import java.awt.Color;
-import java.util.Map;
public class Blosum62ColourScheme extends ResidueColourScheme
{
private static final Color LIGHT_BLUE = new Color(204, 204, 255);
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()
private static final Color DARK_BLUE = new Color(154, 154, 255);
public Blosum62ColourScheme()
@@
-38,73
+40,79
@@
public class Blosum62ColourScheme extends ResidueColourScheme
super();
}
super();
}
+ /**
+ * Returns a new instance of this colour scheme with which the given data may
+ * be coloured
+ */
+ @Override
+ public ColourSchemeI getInstance(AlignViewportI view,
+ AnnotatedCollectionI coll)
+ {
+ return new Blosum62ColourScheme();
+ }
+
@Override
@Override
- public Color findColour(char res, int j, SequenceI seq)
+ public Color findColour(char res, int j, SequenceI seq,
+ String consensusResidue, float pid)
{
{
+ PairwiseScoreModelI sm = ScoreModels.getInstance().getBlosum62();
+
+ /*
+ * compare as upper case; note consensusResidue is
+ * always computed as uppercase
+ */
if ('a' <= res && res <= 'z')
{
if ('a' <= res && res <= 'z')
{
- // TO UPPERCASE !!!
res -= ('a' - 'A');
}
res -= ('a' - 'A');
}
- if (consensus == null || consensus.get(j) == null
- || (threshold != 0 && !aboveThreshold(res, j)))
+ if (Comparison.isGap(res) || consensusResidue == null)
{
return Color.white;
}
{
return Color.white;
}
- Color currentColour;
+ Color colour;
- if (!Comparison.isGap(res))
+ if (consensusResidue.indexOf(res) > -1)
{
{
- /*
- * test if this is the consensus (or joint consensus) residue
- */
- String max = consensus.get(j).getModalResidue();
+ colour = DARK_BLUE;
+ }
+ else
+ {
+ float score = 0;
- if (max.indexOf(res) > -1)
+ for (char consensus : consensusResidue.toCharArray())
{
{
- currentColour = DARK_BLUE;
+ score += sm.getPairwiseScore(consensus, res);
}
}
- else
+
+ if (score > 0)
{
{
- int c = 0;
- int max_aa = 0;
- int n = max.length();
-
- do
- {
- c += ResidueProperties.getBLOSUM62(max.charAt(max_aa), res);
- } while (++max_aa < n);
-
- if (c > 0)
- {
- currentColour = LIGHT_BLUE;
- }
- else
- {
- currentColour = Color.white;
- }
+ colour = LIGHT_BLUE;
}
}
-
- if (conservationColouring)
+ else
{
{
- currentColour = applyConservation(currentColour, j);
+ colour = Color.white;
}
}
}
}
- else
- {
- return Color.white;
- }
+ return colour;
+ }
- return currentColour;
+ @Override
+ public boolean isPeptideSpecific()
+ {
+ return true;
+ }
+
+ @Override
+ public String getSchemeName()
+ {
+ return JalviewColourScheme.Blosum62.toString();
}
@Override
}
@Override
- public ColourSchemeI applyTo(AnnotatedCollectionI sg,
- Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
+ public boolean isSimple()
{
{
- ColourSchemeI newcs = super.applyTo(sg, hiddenRepSequences);
- return newcs;
+ return false;
}
}
}
}