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
Format changes
[jalview.git]
/
src
/
jalview
/
schemes
/
ResidueColourScheme.java
diff --git
a/src/jalview/schemes/ResidueColourScheme.java
b/src/jalview/schemes/ResidueColourScheme.java
index
a993802
..
b905c45
100755
(executable)
--- a/
src/jalview/schemes/ResidueColourScheme.java
+++ b/
src/jalview/schemes/ResidueColourScheme.java
@@
-41,7
+41,7
@@
public class ResidueColourScheme implements ColourSchemeI
int threshold = 0;
\r
\r
/* Set when threshold colouring to either pid_gaps or pid_nogaps*/
\r
int threshold = 0;
\r
\r
/* Set when threshold colouring to either pid_gaps or pid_nogaps*/
\r
- protected String ignoreGaps = "pid_gaps";
\r
+ protected String ignoreGaps = AAFrequency.PID_GAPS;
\r
\r
/** Consenus as a hashtable array */
\r
Hashtable [] consensus;
\r
\r
/** Consenus as a hashtable array */
\r
Hashtable [] consensus;
\r
@@
-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
@@
-83,15
+77,15
@@
public class ResidueColourScheme implements ColourSchemeI
*/
\r
public Color findColour(String aa)
\r
{
\r
*/
\r
public Color findColour(String aa)
\r
{
\r
- return colors[((Integer) (ResidueProperties.aaHash.get(aa))).intValue()];
\r
+ return colors[ResidueProperties.aaIndex[aa.charAt(0)]];
\r
}
\r
\r
\r
\r
public Color findColour(String s, int j)
\r
{
\r
}
\r
\r
\r
\r
public Color findColour(String s, int j)
\r
{
\r
-
\r
- int index = ((Integer) (ResidueProperties.aaHash.get(s))).intValue();
\r
+ Color currentColour;
\r
+ int index = ResidueProperties.aaIndex[s.charAt(0)];
\r
\r
if ((threshold == 0) || aboveThreshold(ResidueProperties.aa[index], j))
\r
{
\r
\r
if ((threshold == 0) || aboveThreshold(ResidueProperties.aa[index], j))
\r
{
\r
@@
-103,7
+97,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
@@
-129,9
+123,9
@@
public class ResidueColourScheme implements ColourSchemeI
{
\r
threshold = ct;
\r
if(ignoreGaps)
\r
{
\r
threshold = ct;
\r
if(ignoreGaps)
\r
- this.ignoreGaps = "pid_nogaps";
\r
+ this.ignoreGaps = AAFrequency.PID_NOGAPS;
\r
else
\r
else
\r
- this.ignoreGaps = "pid_gaps";
\r
+ this.ignoreGaps = AAFrequency.PID_GAPS;
\r
}
\r
\r
/**
\r
}
\r
\r
/**
\r
@@
-153,14
+147,16
@@
public class ResidueColourScheme implements ColourSchemeI
s = String.valueOf(c);
\r
}
\r
\r
s = String.valueOf(c);
\r
}
\r
\r
+ if (consensus == null || consensus[j] == null)
\r
+ return false;
\r
\r
\r
- if ((((Integer) consensus[j].get("maxCount")).intValue() != -1) &&
\r
- consensus[j].contains(s))
\r
+ if ( ( ( (Integer) consensus[j].get(AAFrequency.MAXCOUNT)).intValue() != -1) &&
\r
+ consensus[j].contains(s))
\r
{
\r
{
\r
- if (((Float)consensus[j].get(ignoreGaps)).floatValue() >= threshold)
\r
- {
\r
- return true;
\r
- }
\r
+ if ( ( (Float) consensus[j].get(ignoreGaps)).floatValue() >= threshold)
\r
+ {
\r
+ return true;
\r
+ }
\r
}
\r
\r
return false;
\r
}
\r
\r
return false;
\r
@@
-225,7
+221,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
@@
-239,8
+235,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
@@
-265,6
+260,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