JAL-1645 Version-Rel Version 2.9 Year-Rel 2015 Licensing glob
[jalview.git] / src / jalview / schemes / ColourSchemeI.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
3  * Copyright (C) 2015 The Jalview Authors
4  * 
5  * This file is part of Jalview.
6  * 
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.
11  *  
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.
16  * 
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.
20  */
21 package jalview.schemes;
22
23 import jalview.datamodel.AnnotatedCollectionI;
24 import jalview.datamodel.SequenceCollectionI;
25 import jalview.datamodel.SequenceI;
26
27 import java.awt.Color;
28 import java.util.Map;
29
30 public interface ColourSchemeI
31 {
32   /**
33    * 
34    * @param c
35    * @return the colour for the given character
36    */
37   public Color findColour(char c);
38
39   /**
40    * 
41    * @param c
42    *          - sequence symbol or gap
43    * @param j
44    *          - position in seq
45    * @param seq
46    *          - sequence being coloured
47    * @return context dependent colour for the given symbol at the position in
48    *         the given sequence
49    */
50   public Color findColour(char c, int j, SequenceI seq);
51
52   /**
53    * assign the given consensus profile for the colourscheme
54    */
55   public void setConsensus(java.util.Hashtable[] h);
56
57   /**
58    * assign the given conservation to the colourscheme
59    * 
60    * @param c
61    */
62   public void setConservation(jalview.analysis.Conservation c);
63
64   /**
65    * enable or disable conservation shading for this colourscheme
66    * 
67    * @param conservationApplied
68    */
69   public void setConservationApplied(boolean conservationApplied);
70
71   /**
72    * 
73    * @return true if conservation shading is enabled for this colourscheme
74    */
75   public boolean conservationApplied();
76
77   /**
78    * set scale factor for bleaching of colour in unconserved regions
79    * 
80    * @param i
81    */
82   public void setConservationInc(int i);
83
84   /**
85    * 
86    * @return scale factor for bleaching colour in unconserved regions
87    */
88   public int getConservationInc();
89
90   /**
91    * 
92    * @return percentage identity threshold for applying colourscheme
93    */
94   public int getThreshold();
95
96   /**
97    * set percentage identity threshold and type of %age identity calculation for
98    * shading
99    * 
100    * @param ct
101    *          0..100 percentage identity for applying this colourscheme
102    * @param ignoreGaps
103    *          when true, calculate PID without including gapped positions
104    */
105   public void setThreshold(int ct, boolean ignoreGaps);
106
107   /**
108    * recalculate dependent data using the given sequence collection, taking
109    * account of hidden rows
110    * 
111    * @param alignment
112    * @param hiddenReps
113    */
114   public void alignmentChanged(AnnotatedCollectionI alignment,
115           Map<SequenceI, SequenceCollectionI> hiddenReps);
116
117   /**
118    * create a new instance of the colourscheme configured to colour the given
119    * connection
120    * 
121    * @param sg
122    * @param hiddenRepSequences
123    * @return copy of current scheme with any inherited settings transfered
124    */
125   public ColourSchemeI applyTo(AnnotatedCollectionI sg,
126           Map<SequenceI, SequenceCollectionI> hiddenRepSequences);
127
128 }