44fef0eb74bd8f39cab4ed73067ee5640dd75b44
[jalview.git] / src / jalview / api / AlignViewportI.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
3  * Copyright (C) 2014 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 of the License, or (at your option) any later version.
10  *  
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.
15  * 
16  * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
17  * The Jalview Authors are detailed in the 'AUTHORS' file.
18  */
19 package jalview.api;
20
21 import java.awt.Color;
22 import java.util.Hashtable;
23 import java.util.Map;
24
25 import jalview.analysis.Conservation;
26 import jalview.datamodel.AlignmentAnnotation;
27 import jalview.datamodel.AlignmentI;
28 import jalview.datamodel.AlignmentView;
29 import jalview.datamodel.CigarArray;
30 import jalview.datamodel.ColumnSelection;
31 import jalview.datamodel.SequenceCollectionI;
32 import jalview.datamodel.SequenceGroup;
33 import jalview.datamodel.SequenceI;
34 import jalview.schemes.ColourSchemeI;
35
36 /**
37  * @author jimp
38  * 
39  */
40 public interface AlignViewportI
41 {
42
43   int getCharWidth();
44
45   int getEndRes();
46
47   int getCharHeight();
48
49   /**
50    * calculate the height for visible annotation, revalidating bounds where
51    * necessary ABSTRACT GUI METHOD
52    * 
53    * @return total height of annotation
54    */
55   public int calcPanelHeight();
56
57   boolean hasHiddenColumns();
58
59   boolean isValidCharWidth();
60
61   boolean isShowConsensusHistogram();
62
63   boolean isShowSequenceLogo();
64
65   boolean isNormaliseSequenceLogo();
66
67   ColourSchemeI getGlobalColourScheme();
68
69   AlignmentI getAlignment();
70
71   ColumnSelection getColumnSelection();
72
73   Hashtable[] getSequenceConsensusHash();
74
75   Hashtable[] getRnaStructureConsensusHash();
76
77   boolean getIgnoreGapsConsensus();
78
79   boolean getCentreColumnLabels();
80
81   boolean isCalculationInProgress(AlignmentAnnotation alignmentAnnotation);
82
83   AlignmentAnnotation getAlignmentQualityAnnot();
84
85   AlignmentAnnotation getAlignmentConservationAnnotation();
86
87   /**
88    * get the container for alignment consensus annotation
89    * 
90    * @return
91    */
92   AlignmentAnnotation getAlignmentConsensusAnnotation();
93
94   /**
95    * Test to see if viewport is still open and active
96    * 
97    * @return true indicates that all references to viewport should be dropped
98    */
99   boolean isClosed();
100
101   /**
102    * get the associated calculation thread manager for the view
103    * 
104    * @return
105    */
106   AlignCalcManagerI getCalcManager();
107
108   /**
109    * get the percentage gaps allowed in a conservation calculation
110    * 
111    */
112   public int getConsPercGaps();
113
114   /**
115    * set the consensus result object for the viewport
116    * 
117    * @param hconsensus
118    */
119   void setSequenceConsensusHash(Hashtable[] hconsensus);
120
121   /**
122    * 
123    * @return the alignment annotatino row for the structure consensus
124    *         calculation
125    */
126   AlignmentAnnotation getAlignmentStrucConsensusAnnotation();
127
128   /**
129    * set the Rna structure consensus result object for the viewport
130    * 
131    * @param hStrucConsensus
132    */
133   void setRnaStructureConsensusHash(Hashtable[] hStrucConsensus);
134
135   /**
136    * set global colourscheme
137    * 
138    * @param rhc
139    */
140   void setGlobalColourScheme(ColourSchemeI rhc);
141
142   Map<SequenceI, SequenceCollectionI> getHiddenRepSequences();
143
144   void setHiddenRepSequences(
145           Map<SequenceI, SequenceCollectionI> hiddenRepSequences);
146
147   /**
148    * hides or shows dynamic annotation rows based on groups and group and
149    * alignment associated auto-annotation state flags apply the current
150    * group/autoannotation settings to the alignment view. Usually you should
151    * call the AlignmentViewPanel.adjustAnnotationHeight() method afterwards to
152    * ensure the annotation panel bounds are set correctly.
153    * 
154    * @param applyGlobalSettings
155    *          - apply to all autoannotation rows or just the ones associated
156    *          with the current visible region
157    * @param preserveNewGroupSettings
158    *          - don't apply global settings to groups which don't already have
159    *          group associated annotation
160    */
161   void updateGroupAnnotationSettings(boolean applyGlobalSettings,
162           boolean preserveNewGroupSettings);
163
164   void setSequenceColour(SequenceI seq, Color col);
165
166   Color getSequenceColour(SequenceI seq);
167
168   void updateSequenceIdColours();
169
170   SequenceGroup getSelectionGroup();
171
172   SequenceI[] getSequenceSelection();
173
174   void clearSequenceColours();
175
176   CigarArray getViewAsCigars(boolean selectedRegionOnly);
177
178   AlignmentView getAlignmentView(boolean selectedOnly);
179
180   AlignmentView getAlignmentView(boolean selectedOnly, boolean markGroups);
181
182   String[] getViewAsString(boolean selectedRegionOnly);
183
184   void setSelectionGroup(SequenceGroup sg);
185
186   char getGapCharacter();
187
188   void setColumnSelection(ColumnSelection cs);
189
190   void setConservation(Conservation cons);
191
192
193 }