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.datamodel.AnnotatedCollectionI;
24 import jalview.datamodel.SequenceCollectionI;
25 import jalview.datamodel.SequenceI;
27 import java.awt.Color;
30 public interface ColourSchemeI
33 * Returns the colour for the given character. For use when the colour depends
39 Color findColour(char c);
42 * Returns the possibly context dependent colour for the given symbol at the
43 * aligned position in the given sequence. For example, the colour may depend
44 * on the symbol's relationship to the consensus residue for the column.
49 * @param consensusResidue
50 * the modal symbol (e.g. K) or symbols (e.g. KF) for the column
52 * the percentage identity of the column's consensus (if known)
55 Color findColour(char symbol, int position, SequenceI seq,
56 String consensusResidue, float pid);
59 * Recalculate dependent data using the given sequence collection, taking
60 * account of hidden rows
65 void alignmentChanged(AnnotatedCollectionI alignment,
66 Map<SequenceI, SequenceCollectionI> hiddenReps);
69 * Creates and returns a new instance of the colourscheme configured to colour
70 * the given collection. Note that even simple colour schemes should return a
71 * new instance for each call to this method, as different instances may have
72 * differing shading by consensus or percentage identity applied.
75 * @param hiddenRepSequences
76 * @return copy of current scheme with any inherited settings transferred
78 ColourSchemeI getInstance(AnnotatedCollectionI sg,
79 Map<SequenceI, SequenceCollectionI> hiddenRepSequences);
82 * Answers true if the colour scheme is suitable for the given data, else
83 * false. For example, some colour schemes are specific to either peptide or
84 * nucleotide, or only apply if certain kinds of annotation are present.
89 // TODO can make this method static in Java 8
90 boolean isApplicableTo(AnnotatedCollectionI ac);
93 * Answers the 'official' name of the colour scheme (as used, for example, as
94 * a Jalview startup parameter)
98 String getSchemeName();
101 * Answers true if the colour scheme depends only on the sequence symbol, and
102 * not on other information such as alignment consensus or annotation. (Note
103 * that simple colour schemes may have a fading by percentage identity or
104 * conservation overlaid.) Simple colour schemes can be propagated to