package jalview.schemes; import jalview.io.TCoffeeScoreFile; import java.awt.Color; /** * Defines the color score for T-Coffee MSA *

* See http://tcoffee.org * * * @author Paolo Di Tommaso * */ public class TCoffeeColourScheme extends ResidueColourScheme { static final Color[] colors = { new Color( 102, 102, 255 ), // #6666FF new Color( 0, 255, 0), // #00FF00 new Color( 102, 255, 0), // #66FF00 new Color( 204, 255, 0), // #CCFF00 new Color( 255, 255, 0), // #FFFF00 new Color( 255, 204, 0), // #FFCC00 new Color( 255, 153, 0), // #FF9900 new Color( 255, 102, 0), // #FF6600 new Color( 255, 51, 0), // #FF3300 new Color( 255, 34, 0) // #FF2000 }; byte[][] scoreMatrix = null; /** * Initialize the color sheme based on the content of the T-Coffee score file * * @param scoreFile */ public TCoffeeColourScheme(TCoffeeScoreFile scoreFile) { scoreMatrix = scoreFile != null ? scoreFile.getScoresArray() : null; } @Override public Color findColour(char c, int j, int sequenceIndex) { if( scoreMatrix == null ) { return Color.white; } if( sequenceIndex<0 || sequenceIndex >= scoreMatrix.length ) { System.out.printf("Sequence index out of range for the T-Coffee color scheme. Index: %s\n", sequenceIndex); return Color.white; } byte[] seqScores = scoreMatrix[sequenceIndex]; if( j < 0 || j>= seqScores.length ) { System.out.printf("Residue index out of range for the T-Coffee color scheme. Sequence %s - residue: %s\n", sequenceIndex, j); return Color.white; } byte val = seqScores[j]; return val >= 0 && val < colors.length ? colors[val] : Color.white; } }