Clover icon

Coverage Report

  1. Project Clover database Thu Nov 28 2024 18:06:40 GMT
  2. Package jalview.schemes

File ColourSchemeI.java

 

Code metrics

0
0
0
1
111
20
0
-
-
0
-

Classes

Class Line # Actions
ColourSchemeI 31 0 0
-1.0 -
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3    * Copyright (C) $$Year-Rel$$ 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.api.AlignViewportI;
24    import jalview.datamodel.AnnotatedCollectionI;
25    import jalview.datamodel.SequenceCollectionI;
26    import jalview.datamodel.SequenceI;
27   
28    import java.awt.Color;
29    import java.util.Map;
30   
 
31    public interface ColourSchemeI
32    {
33    /**
34    * Returns the possibly context dependent colour for the given symbol at the
35    * aligned position in the given sequence. For example, the colour may depend
36    * on the symbol's relationship to the consensus residue for the column.
37    *
38    * @param symbol
39    * @param position
40    * @param seq
41    * @param consensusResidue
42    * the modal symbol (e.g. K) or symbols (e.g. KF) for the column
43    * @param pid
44    * the percentage identity of the column's consensus (if known)
45    * @return
46    */
47    Color findColour(char symbol, int position, SequenceI seq,
48    String consensusResidue, float pid);
49   
50    /**
51    * Recalculate dependent data using the given sequence collection, taking
52    * account of hidden rows
53    *
54    * @param alignment
55    * @param hiddenReps
56    */
57    void alignmentChanged(AnnotatedCollectionI alignment,
58    Map<SequenceI, SequenceCollectionI> hiddenReps);
59   
60    /**
61    * Creates and returns a new instance of the colourscheme configured to colour
62    * the given collection. Note that even simple colour schemes should return a
63    * new instance for each call to this method, as different instances may have
64    * differing shading by consensus or percentage identity applied.
65    *
66    * @param viewport
67    * - the parent viewport
68    * @param sg
69    * - the collection of sequences to be coloured
70    * @return copy of current scheme with any inherited settings transferred
71    */
72    ColourSchemeI getInstance(AlignViewportI viewport,
73    AnnotatedCollectionI sg);
74   
75    /**
76    * Answers true if the colour scheme is suitable for the given data, else
77    * false. For example, some colour schemes are specific to either peptide or
78    * nucleotide, or only apply if certain kinds of annotation are present.
79    *
80    * @param ac
81    * @return
82    */
83    // TODO can make this method static in Java 8
84    boolean isApplicableTo(AnnotatedCollectionI ac);
85   
86    /**
87    * Answers the 'official' name of the colour scheme (as used, for example, as
88    * a Jalview startup parameter)
89    *
90    * @return
91    */
92    String getSchemeName();
93   
94    /**
95    * Answers true if the colour scheme depends only on the sequence symbol, and
96    * not on other information such as alignment consensus or annotation. (Note
97    * that simple colour schemes may have a fading by percentage identity or
98    * conservation overlaid.) Simple colour schemes can be propagated to
99    * structure viewers.
100    *
101    * @return
102    */
103    boolean isSimple();
104   
105    /**
106    * Answers true if the colour scheme has a colour specified for gaps.
107    *
108    * @return
109    */
110    boolean hasGapColour();
111    }