}\r
\r
\r
- public Color findColour(SequenceI seq,String s, int j,Vector aa) {\r
+ public Color findColour(String s, int j,Vector aa) {\r
Color c = Color.white;\r
Hashtable hash = null;\r
\r
double sc = 0;\r
if ( Integer.parseInt( hash.get("maxCount").toString() ) != -1 && hash.contains(s))\r
{\r
-\r
sc = ( (Integer) hash.get(s)).intValue() * 100.0 / ((Integer)hash.get("size")).intValue() ;\r
// MC Should be isGap\r
- if (!s.equals("-") && !s.equals(".") && !s.equals(" "))\r
+ if (!jalview.util.Comparison.isGap((s.charAt(0))))\r
{\r
for (int i = 0; i < thresholds.length; i++)\r
{\r
}\r
}\r
}\r
- else\r
- c = Color.white;\r
+\r
}\r
return c;\r
}\r
\r
public class ResidueColourScheme implements ColourSchemeI{\r
Color [] colors;\r
- int threshold = 90;\r
+ int threshold = 0;\r
\r
public ResidueColourScheme(Color[] colors, int threshold) {\r
this.colors = colors;\r
return colors[((Integer)(ResidueProperties.aaHash.get(aa))).intValue()];\r
}\r
\r
- public Color findColour(SequenceI seq,String s, int j, Vector aa) {\r
- try {\r
- return colors[((Integer)(ResidueProperties.aaHash.get(s))).intValue()];\r
- } catch (Exception e) {\r
- return Color.white;\r
- }\r
- }\r
-\r
- // aa should maybe be a class\r
- /* public Color getColour(SequenceI seq, int j,Vector aa) {\r
-\r
- Color c = Color.white;\r
- String s = seq.getSequence(j,j+1);\r
-\r
- if (threshold > 0 && aa != null)\r
- {\r
- if (aboveThreshold(aa,seq,j,threshold))\r
- c = findColour(seq,s,j,aa);\r
- }\r
- else\r
- c = findColour(seq,s,j,aa);\r
+ public Color findColour(String s, int j, Vector aa) {\r
\r
+ if( threshold==0 || aboveThreshold(aa,s,j))\r
+ return colors[((Integer)(ResidueProperties.aaHash.get(s))).intValue()];\r
+ else\r
+ return Color.white;\r
\r
- return c;\r
- }*/\r
+ }\r
\r
public int getThreshold() {\r
return threshold;\r
threshold = ct;\r
}\r
\r
- public boolean aboveThreshold(Vector aa,SequenceI seq, int j, int threshold) {\r
- String s = seq.getSequence(j,j+1);\r
- Hashtable hash = (Hashtable)aa.elementAt(j);\r
+ public boolean aboveThreshold(Vector aa,String s, int j)\r
+ {\r
\r
- if (j < aa.size()) {\r
- String maxRes = (String)hash.get("maxResidue");\r
+ Hashtable hash = (Hashtable)aa.elementAt(j);\r
\r
- double sc = 0;\r
+ if ( ( (Integer) hash.get("maxCount")).intValue() != -1 && hash.contains(s))\r
+ {\r
+ //// resCount//////////////////// ///////////////seq count////////////\r
+ double sc = ( (Integer) hash.get(s)).intValue() * 100.0 / ( (Integer) hash.get("size")).intValue();\r
\r
- if (((Integer)hash.get("maxCount")).intValue() != -1 && hash.contains(s)) {\r
- int maxCount = ((Integer)hash.get("maxCount")).intValue();\r
- int resCount = ((Integer)hash.get(s)).intValue();\r
+ if (sc >= threshold)\r
+ return true;\r
\r
- sc = resCount * 100.0 / resCount;\r
+ }\r
\r
- // This should be isGap somewhere\r
- if ( !s.equals("-") && !s.equals(".") && !s.equals(" ")) {\r
- if (sc >= (double)threshold) {\r
- return true;\r
- }\r
- }\r
- }\r
- }\r
return false;\r
}\r
\r