- case USER_DEFINED:
- ret = "User Defined";
-
- break;
-
- default:
- ret = "None";
-
- break;
- }
-
- return ret;
- }
-
- /**
- * retrieve or create colourscheme associated with name
- *
- * @param seqs
- * sequences to colour
- * @param width
- * range of sequences to colour
- * @param name
- * colourscheme name, applet colour parameter specification, or
- * string to parse as colour for new coloursheme
- * @return Valid Colourscheme
- */
- public static ColourSchemeI getColour(AnnotatedCollectionI alignment,
- String name)
- {
- int colindex = getColourIndexFromName(name);
- if (colindex == UNDEFINED)
- {
- if (name.indexOf('=') == -1)
- {
- // try to build a colour from the string directly
- try
- {
- return new UserColourScheme(name);
- } catch (Exception e)
- {
- // System.err.println("Ignoring unknown colourscheme name");
- }
- }
- else
- {
- // try to parse the string as a residue colourscheme
- try
- {
- // fix the launchApp user defined coloursheme transfer bug
- jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme(
- "white");
- ucs.parseAppletParameter(name);
-
- } catch (Exception e)
- {
- // System.err.println("Ignoring exception when parsing colourscheme as applet-parameter");
- }
- }
- }
- return getColour(alignment, getColourIndexFromName(name));
- }
-
- /**
- * Construct an instance of ColourSchemeI corresponding to the given
- * colourscheme index
- *
- * @param seqs
- * sequences to be coloured by colourscheme
- * @param width
- * geometry of alignment
- * @param index
- * colourscheme number
- *
- * @return null or an instance of the colourscheme configured to colour given
- * sequence set
- */
- public static ColourSchemeI getColour(
- jalview.datamodel.AnnotatedCollectionI coll, int index)
- {
- // TODO 3.0 2.8 refactor signature to take an alignmentI like container so
- // colourschemes based on annotation can be initialised
- ColourSchemeI cs = null;
-
- switch (index)
- {
- case CLUSTAL:
- cs = new ClustalxColourScheme(coll, null);
-
- break;
-
- case BLOSUM:
- cs = new Blosum62ColourScheme();
-
- break;
-
- case PID:
- cs = new PIDColourScheme();
-
- break;
-
- case ZAPPO:
- cs = new ZappoColourScheme();
-
- break;
-
- case TAYLOR:
- cs = new TaylorColourScheme();
- break;
-
- case HYDROPHOBIC:
- cs = new HydrophobicColourScheme();
-
- break;
-
- case HELIX:
- cs = new HelixColourScheme();
-
- break;
-
- case STRAND:
- cs = new StrandColourScheme();
-
- break;
-
- case TURN:
- cs = new TurnColourScheme();
-
- break;
-
- case BURIED:
- cs = new BuriedColourScheme();
-
- break;
-
- case NUCLEOTIDE:
- cs = new NucleotideColourScheme();
-
- break;
-
- case PURINEPYRIMIDINE:
- cs = new PurinePyrimidineColourScheme();
-
- break;
-
- case TCOFFEE:
- cs = new TCoffeeColourScheme(coll);
- break;
-
- case RNAHELIX:
- cs = new RNAHelicesColour(coll);
- break;
-
- // case COVARIATION:
- // cs = new CovariationColourScheme(annotation);
- // break;
-
- case USER_DEFINED:
- Color[] col = new Color[24];
- for (int i = 0; i < 24; i++)
- {
- col[i] = Color.white;
- }
- cs = new UserColourScheme(col);
- break;
-
- default:
- break;
- }
-
- return cs;
- }
-
- public static Color getAWTColorFromName(String name)
- {
- Color col = null;
- name = name.toLowerCase();
- if (name.equals("black"))
- {
- col = Color.black;
- }
- else if (name.equals("blue"))
- {
- col = Color.blue;
- }
- else if (name.equals("cyan"))
- {
- col = Color.cyan;
- }
- else if (name.equals("darkGray"))
- {
- col = Color.darkGray;
- }
- else if (name.equals("gray"))
- {
- col = Color.gray;
- }
- else if (name.equals("green"))
- {
- col = Color.green;
- }
- else if (name.equals("lightGray"))
- {
- col = Color.lightGray;
- }
- else if (name.equals("magenta"))
- {
- col = Color.magenta;
- }
- else if (name.equals("orange"))
- {
- col = Color.orange;
- }
- else if (name.equals("pink"))
- {
- col = Color.pink;
- }
- else if (name.equals("red"))
- {
- col = Color.red;
- }
- else if (name.equals("white"))
- {
- col = Color.white;
- }
- else if (name.equals("yellow"))
- {
- col = Color.yellow;
- }
-
- return col;