2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
3 * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
18 package jalview.schemes;
21 import java.util.Hashtable;
23 import jalview.datamodel.AlignmentAnnotation;
26 * Became RNAHelicesColour.java. Placeholder for true covariation color scheme
28 * @author Lauren Michelle Lui
31 public class CovariationColourScheme extends ResidueColourScheme
33 public Hashtable helixcolorhash = new Hashtable();
35 public Hashtable positionsToHelix = new Hashtable();
39 public AlignmentAnnotation annotation;
42 * Creates a new CovariationColourScheme object.
44 public CovariationColourScheme(AlignmentAnnotation annotation)
46 this.annotation = annotation;
48 for (int x = 0; x < this.annotation._rnasecstr.length; x++)
50 // System.out.println(this.annotation._rnasecstr[x] + " Begin" +
51 // this.annotation._rnasecstr[x].getBegin());
52 // System.out.println(this.annotation._rnasecstr[x].getFeatureGroup());
53 // pairs.put(this.annotation._rnasecstr[x].getBegin(),
54 // this.annotation._rnasecstr[x].getEnd());
56 positionsToHelix.put(this.annotation._rnasecstr[x].getBegin(),
57 this.annotation._rnasecstr[x].getFeatureGroup());
58 positionsToHelix.put(this.annotation._rnasecstr[x].getEnd(),
59 this.annotation._rnasecstr[x].getFeatureGroup());
61 if (Integer.parseInt(this.annotation._rnasecstr[x].getFeatureGroup()) > numHelix)
63 numHelix = Integer.parseInt(this.annotation._rnasecstr[x]
69 for (int j = 0; j <= numHelix; j++)
71 helixcolorhash.put(Integer.toString(j),
72 jalview.util.ColorUtils.generateRandomColor(Color.white));
83 * @return DOCUMENT ME!
85 public Color findColour(char c)
87 // System.out.println("called"); log.debug
88 // Generate a random pastel color
90 return ResidueProperties.purinepyrimidine[ResidueProperties.purinepyrimidineIndex[c]];// jalview.util.ColorUtils.generateRandomColor(Color.white);
101 * @return DOCUMENT ME!
103 public Color findColour(char c, int j)
105 Color currentColour = Color.white;
106 String currentHelix = null;
107 // System.out.println(c + " " + j);
108 currentHelix = (String) positionsToHelix.get(j);
109 // System.out.println(positionsToHelix.get(j));
111 if (currentHelix != null)
113 currentColour = (Color) helixcolorhash.get(currentHelix);
116 // System.out.println(c + " " + j + " helix " + currentHelix + " " +
118 return currentColour;