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
Draw helices correctly
[jalview.git]
/
src
/
jalview
/
schemes
/
ResidueColourScheme.java
diff --git
a/src/jalview/schemes/ResidueColourScheme.java
b/src/jalview/schemes/ResidueColourScheme.java
index
64fd62e
..
df90500
100755
(executable)
--- a/
src/jalview/schemes/ResidueColourScheme.java
+++ b/
src/jalview/schemes/ResidueColourScheme.java
@@
-52,12
+52,6
@@
public class ResidueColourScheme implements ColourSchemeI
/** DOCUMENT ME!! */
\r
int inc = 30;
\r
\r
/** DOCUMENT ME!! */
\r
int inc = 30;
\r
\r
- /**
\r
- * The colour to be calculated, manipulated and returned
\r
- */
\r
- Color currentColour = null;
\r
-
\r
-
\r
\r
/**
\r
* Creates a new ResidueColourScheme object.
\r
\r
/**
\r
* Creates a new ResidueColourScheme object.
\r
@@
-81,21
+75,20
@@
public class ResidueColourScheme implements ColourSchemeI
/**
\r
* Find a colour without an index in a sequence
\r
*/
\r
/**
\r
* Find a colour without an index in a sequence
\r
*/
\r
- public Color findColour(String aa)
\r
+ public Color findColour(char c)
\r
{
\r
{
\r
- return colors[ResidueProperties.aaIndex[aa.charAt(0)]];
\r
+ return colors[ResidueProperties.aaIndex[c]];
\r
}
\r
\r
\r
\r
}
\r
\r
\r
\r
- public Color findColour(String s, int j)
\r
+ public Color findColour(char c, int j)
\r
{
\r
{
\r
+ Color currentColour;
\r
\r
\r
- int index = ResidueProperties.aaIndex[s.charAt(0)];
\r
-
\r
- if ((threshold == 0) || aboveThreshold(ResidueProperties.aa[index], j))
\r
+ if ((threshold == 0) || aboveThreshold(c, j))
\r
{
\r
{
\r
- currentColour = colors[index];
\r
+ currentColour = colors[ResidueProperties.aaIndex[c]];
\r
}
\r
else
\r
{
\r
}
\r
else
\r
{
\r
@@
-103,7
+96,7
@@
public class ResidueColourScheme implements ColourSchemeI
}
\r
\r
if(conservationColouring)
\r
}
\r
\r
if(conservationColouring)
\r
- applyConservation(j);
\r
+ currentColour = applyConservation(currentColour, j);
\r
\r
\r
return currentColour;
\r
\r
\r
return currentColour;
\r
@@
-142,22
+135,20
@@
public class ResidueColourScheme implements ColourSchemeI
*
\r
* @return DOCUMENT ME!
\r
*/
\r
*
\r
* @return DOCUMENT ME!
\r
*/
\r
- public boolean aboveThreshold(String s, int j)
\r
+ public boolean aboveThreshold(char c, int j)
\r
{
\r
{
\r
- char c = s.charAt(0);
\r
if ('a' <= c && c <= 'z')
\r
{
\r
// TO UPPERCASE !!!
\r
//Faster than toUpperCase
\r
c -= ('a' - 'A');
\r
if ('a' <= c && c <= 'z')
\r
{
\r
// TO UPPERCASE !!!
\r
//Faster than toUpperCase
\r
c -= ('a' - 'A');
\r
- s = String.valueOf(c);
\r
}
\r
\r
if (consensus == null || consensus[j] == null)
\r
return false;
\r
\r
if ( ( ( (Integer) consensus[j].get(AAFrequency.MAXCOUNT)).intValue() != -1) &&
\r
}
\r
\r
if (consensus == null || consensus[j] == null)
\r
return false;
\r
\r
if ( ( ( (Integer) consensus[j].get(AAFrequency.MAXCOUNT)).intValue() != -1) &&
\r
- consensus[j].contains(s))
\r
+ consensus[j].contains(String.valueOf(c)))
\r
{
\r
if ( ( (Float) consensus[j].get(ignoreGaps)).floatValue() >= threshold)
\r
{
\r
{
\r
if ( ( (Float) consensus[j].get(ignoreGaps)).floatValue() >= threshold)
\r
{
\r
@@
-227,7
+218,7
@@
public class ResidueColourScheme implements ColourSchemeI
* @return DOCUMENT ME!
\r
*/
\r
\r
* @return DOCUMENT ME!
\r
*/
\r
\r
- void applyConservation(int i)
\r
+ Color applyConservation(Color currentColour, int i)
\r
{
\r
\r
if ((conservation[i] != '*') && (conservation[i] != '+'))
\r
{
\r
\r
if ((conservation[i] != '*') && (conservation[i] != '+'))
\r
@@
-241,8
+232,7
@@
public class ResidueColourScheme implements ColourSchemeI
float t = 11 - (conservation[i] - '0');
\r
if(t==0)
\r
{
\r
float t = 11 - (conservation[i] - '0');
\r
if(t==0)
\r
{
\r
- currentColour = Color.white;
\r
- return;
\r
+ return Color.white;
\r
}
\r
\r
int red = currentColour.getRed();
\r
}
\r
\r
int red = currentColour.getRed();
\r
@@
-267,6
+257,7
@@
public class ResidueColourScheme implements ColourSchemeI
currentColour = new Color(red, green, blue);
\r
}
\r
}
\r
currentColour = new Color(red, green, blue);
\r
}
\r
}
\r
+ return currentColour;
\r
}
\r
\r
\r
}
\r
\r
\r