2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
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
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.schemes;
23 import jalview.api.AlignViewportI;
24 import jalview.datamodel.AlignmentAnnotation;
25 import jalview.datamodel.AnnotatedCollectionI;
26 import jalview.datamodel.SequenceCollectionI;
27 import jalview.datamodel.SequenceI;
28 import jalview.util.ColorUtils;
30 import java.awt.Color;
31 import java.util.Hashtable;
35 * Became RNAHelicesColour.java. Placeholder for true covariation color scheme
37 * @author Lauren Michelle Lui
40 public class CovariationColourScheme extends ResidueColourScheme
42 public Map<String, Color> helixcolorhash = new Hashtable<>();
44 public Map<Integer, String> positionsToHelix = new Hashtable<>();
48 public AlignmentAnnotation annotation;
51 * Returns a new instance of this colour scheme with which the given data may
55 public ColourSchemeI getInstance(AlignViewportI view,
56 AnnotatedCollectionI coll,
57 Map<SequenceI, SequenceCollectionI> hrs)
59 return new CovariationColourScheme(coll.getAlignmentAnnotation()[0]);
63 * Creates a new CovariationColourScheme object.
65 public CovariationColourScheme(AlignmentAnnotation annotation)
67 this.annotation = annotation;
69 for (int x = 0; x < this.annotation._rnasecstr.length; x++)
71 // System.out.println(this.annotation._rnasecstr[x] + " Begin" +
72 // this.annotation._rnasecstr[x].getBegin());
73 // System.out.println(this.annotation._rnasecstr[x].getFeatureGroup());
74 // pairs.put(this.annotation._rnasecstr[x].getBegin(),
75 // this.annotation._rnasecstr[x].getEnd());
77 positionsToHelix.put(this.annotation._rnasecstr[x].getBegin(),
78 this.annotation._rnasecstr[x].getFeatureGroup());
79 positionsToHelix.put(this.annotation._rnasecstr[x].getEnd(),
80 this.annotation._rnasecstr[x].getFeatureGroup());
83 this.annotation._rnasecstr[x].getFeatureGroup()) > numHelix)
86 .parseInt(this.annotation._rnasecstr[x].getFeatureGroup());
91 for (int j = 0; j <= numHelix; j++)
93 helixcolorhash.put(String.valueOf(j),
94 ColorUtils.generateRandomColor(Color.white));
105 * @return DOCUMENT ME!
108 public Color findColour(char c)
110 // System.out.println("called"); log.debug
111 // Generate a random pastel color
113 return ResidueProperties.purinepyrimidine[ResidueProperties.purinepyrimidineIndex[c]];// jalview.util.ColorUtils.generateRandomColor(Color.white);
124 * @return DOCUMENT ME!
126 public Color findColour(char c, int j)
128 Color currentColour = Color.white;
129 String currentHelix = null;
130 // System.out.println(c + " " + j);
131 currentHelix = positionsToHelix.get(j);
132 // System.out.println(positionsToHelix.get(j));
134 if (currentHelix != null)
136 currentColour = helixcolorhash.get(currentHelix);
139 // System.out.println(c + " " + j + " helix " + currentHelix + " " +
141 return currentColour;
145 public boolean isNucleotideSpecific()
151 public String getSchemeName()
153 return "Covariation";
157 public boolean isSimple()