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