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
AlignedCodonFrame holds mapping information between individual cDNA regions on dna...
[jalview.git]
/
src
/
jalview
/
schemes
/
UserColourScheme.java
diff --git
a/src/jalview/schemes/UserColourScheme.java
b/src/jalview/schemes/UserColourScheme.java
index
9d61279
..
81947b3
100755
(executable)
--- a/
src/jalview/schemes/UserColourScheme.java
+++ b/
src/jalview/schemes/UserColourScheme.java
@@
-1,6
+1,6
@@
/*
\r
* Jalview - A Sequence Alignment Editor and Viewer
\r
/*
\r
* Jalview - A Sequence Alignment Editor and Viewer
\r
- * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
\r
+ * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
\r
*
\r
* This program is free software; you can redistribute it and/or
\r
* modify it under the terms of the GNU General Public License
\r
*
\r
* This program is free software; you can redistribute it and/or
\r
* modify it under the terms of the GNU General Public License
\r
@@
-18,18
+18,19
@@
*/
\r
package jalview.schemes;
\r
\r
*/
\r
package jalview.schemes;
\r
\r
+import java.util.*;
\r
+
\r
import java.awt.*;
\r
import java.awt.*;
\r
-import java.util.StringTokenizer;
\r
\r
public class UserColourScheme
\r
extends ResidueColourScheme
\r
{
\r
\r
public class UserColourScheme
\r
extends ResidueColourScheme
\r
{
\r
- Color [] lowerCaseColours;
\r
+ Color[] lowerCaseColours;
\r
\r
protected String schemeName;
\r
\r
public UserColourScheme()
\r
\r
protected String schemeName;
\r
\r
public UserColourScheme()
\r
- { }
\r
+ {}
\r
\r
public UserColourScheme(Color[] newColors)
\r
{
\r
\r
public UserColourScheme(Color[] newColors)
\r
{
\r
@@
-40,15
+41,17
@@
public class UserColourScheme
{
\r
Color col = getColourFromString(colour);
\r
\r
{
\r
Color col = getColourFromString(colour);
\r
\r
- if(col==null)
\r
+ if (col == null)
\r
{
\r
{
\r
- System.out.println("Unknown colour!! "+colour);
\r
+ System.out.println("Unknown colour!! " + colour);
\r
col = createColourFromName(colour);
\r
}
\r
\r
colors = new Color[24];
\r
col = createColourFromName(colour);
\r
}
\r
\r
colors = new Color[24];
\r
- for(int i=0; i<24; i++)
\r
+ for (int i = 0; i < 24; i++)
\r
+ {
\r
colors[i] = col;
\r
colors[i] = col;
\r
+ }
\r
}
\r
\r
public Color[] getColours()
\r
}
\r
\r
public Color[] getColours()
\r
@@
-85,7
+88,9
@@
public class UserColourScheme
{}
\r
\r
if (col == null)
\r
{}
\r
\r
if (col == null)
\r
+ {
\r
col = ColourSchemeProperty.getAWTColorFromName(colour);
\r
col = ColourSchemeProperty.getAWTColorFromName(colour);
\r
+ }
\r
\r
if (col == null)
\r
{
\r
\r
if (col == null)
\r
{
\r
@@
-119,7
+124,9
@@
public class UserColourScheme
start = end;
\r
end += lsize / 3;
\r
if (end > lsize)
\r
start = end;
\r
end += lsize / 3;
\r
if (end > lsize)
\r
+ {
\r
end = lsize;
\r
end = lsize;
\r
+ }
\r
\r
g = Math.abs(name.substring(start, end).hashCode() + rgbOffset) % 210 + 20;
\r
\r
\r
g = Math.abs(name.substring(start, end).hashCode() + rgbOffset) % 210 + 20;
\r
\r
@@
-134,8
+141,9
@@
public class UserColourScheme
{
\r
StringTokenizer st = new StringTokenizer(paramValue, ";");
\r
StringTokenizer st2;
\r
{
\r
StringTokenizer st = new StringTokenizer(paramValue, ";");
\r
StringTokenizer st2;
\r
- String token=null, colour, residues;
\r
- try{
\r
+ String token = null, colour, residues;
\r
+ try
\r
+ {
\r
while (st.hasMoreElements())
\r
{
\r
token = st.nextToken().trim();
\r
while (st.hasMoreElements())
\r
{
\r
token = st.nextToken().trim();
\r
@@
-147,72
+155,85
@@
public class UserColourScheme
{
\r
token = st2.nextToken();
\r
\r
{
\r
token = st2.nextToken();
\r
\r
- if (ResidueProperties.aaIndex[token.charAt(0)]==-1)
\r
+ if (ResidueProperties.aaIndex[token.charAt(0)] == -1)
\r
+ {
\r
continue;
\r
continue;
\r
+ }
\r
\r
int colIndex = ResidueProperties.aaIndex[token.charAt(0)];
\r
\r
\r
int colIndex = ResidueProperties.aaIndex[token.charAt(0)];
\r
\r
- if(token.equalsIgnoreCase("lowerCase"))
\r
+ if (token.equalsIgnoreCase("lowerCase"))
\r
{
\r
if (lowerCaseColours == null)
\r
{
\r
if (lowerCaseColours == null)
\r
+ {
\r
lowerCaseColours = new Color[23];
\r
lowerCaseColours = new Color[23];
\r
+ }
\r
for (int i = 0; i < 23; i++)
\r
for (int i = 0; i < 23; i++)
\r
+ {
\r
if (lowerCaseColours[i] == null)
\r
if (lowerCaseColours[i] == null)
\r
+ {
\r
lowerCaseColours[i] = getColourFromString(colour);
\r
lowerCaseColours[i] = getColourFromString(colour);
\r
+ }
\r
+ }
\r
\r
\r
- continue;
\r
+ continue;
\r
}
\r
\r
}
\r
\r
- if(token.equals(token.toLowerCase()))
\r
+ if (token.equals(token.toLowerCase()))
\r
{
\r
{
\r
- if(lowerCaseColours==null)
\r
+ if (lowerCaseColours == null)
\r
{
\r
lowerCaseColours = new Color[23];
\r
}
\r
lowerCaseColours[colIndex] = getColourFromString(colour);
\r
}
\r
else
\r
{
\r
lowerCaseColours = new Color[23];
\r
}
\r
lowerCaseColours[colIndex] = getColourFromString(colour);
\r
}
\r
else
\r
+ {
\r
colors[colIndex] = getColourFromString(colour);
\r
colors[colIndex] = getColourFromString(colour);
\r
+ }
\r
}
\r
}
\r
}
\r
}
\r
}
\r
}
\r
- catch(Exception ex)
\r
- {
\r
- System.out.println("Error parsing userDefinedColours:\n"
\r
- +token+"\n"+ex);
\r
- }
\r
+ catch (Exception ex)
\r
+ {
\r
+ System.out.println("Error parsing userDefinedColours:\n"
\r
+ + token + "\n" + ex);
\r
+ }
\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
- int index = ResidueProperties.aaIndex[s.charAt(0)];
\r
+ Color currentColour;
\r
+ int index = ResidueProperties.aaIndex[c];
\r
\r
\r
- if ((threshold == 0) || aboveThreshold(ResidueProperties.aa[index], j))
\r
+ if ( (threshold == 0) || aboveThreshold(c, j))
\r
+ {
\r
+ if (lowerCaseColours != null && 'a' <= c && c <= 'z')
\r
{
\r
{
\r
- if(lowerCaseColours!=null && 'a' <= s.charAt(0) && s.charAt(0) <= 'z')
\r
- currentColour = lowerCaseColours[index];
\r
- else
\r
- currentColour = colors[index];
\r
+ currentColour = lowerCaseColours[index];
\r
}
\r
else
\r
{
\r
}
\r
else
\r
{
\r
- currentColour = Color.white;
\r
+ currentColour = colors[index];
\r
}
\r
}
\r
+ }
\r
+ else
\r
+ {
\r
+ currentColour = Color.white;
\r
+ }
\r
\r
\r
- if(conservationColouring)
\r
- applyConservation(currentColour, j);
\r
-
\r
+ if (conservationColouring)
\r
+ {
\r
+ currentColour = applyConservation(currentColour, j);
\r
+ }
\r
\r
\r
- return currentColour;
\r
- }
\r
+ return currentColour;
\r
+ }
\r
\r
\r
- public void setLowerCaseColours(Color [] lcolours)
\r
- {
\r
- lowerCaseColours = lcolours;
\r
- }
\r
+ public void setLowerCaseColours(Color[] lcolours)
\r
+ {
\r
+ lowerCaseColours = lcolours;
\r
+ }
\r
\r
}
\r
\r
}
\r