Merge branch 'Release_2_8_1_Branch' into JAL-1372_referenceseq
[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   /**
165    * @return true if a reference sequence is set and should be displayed
166    */
167   public boolean isDisplayReferenceSeq();
168
169   /**
170    * @return set the flag for displaying reference sequences when they are
171    *         available
172    */
173   public void setDisplayReferenceSeq(boolean displayReferenceSeq);
174
175   /**
176    * @return true if colourschemes should render according to reference sequence
177    *         rather than consensus if available
178    */
179   public boolean isColourByReferenceSeq();
180
181   /**
182    * @return true set flag for deciding if colourschemes should render according
183    *         to reference sequence rather than consensus if available
184    */
185   public void setColourByReferenceSeq(boolean colourByReferenceSeq);
186
187   void setSequenceColour(SequenceI seq, Color col);
188
189   Color getSequenceColour(SequenceI seq);
190
191   void updateSequenceIdColours();
192
193   SequenceGroup getSelectionGroup();
194
195   SequenceI[] getSequenceSelection();
196
197   void clearSequenceColours();
198
199   CigarArray getViewAsCigars(boolean selectedRegionOnly);
200
201   AlignmentView getAlignmentView(boolean selectedOnly);
202
203   AlignmentView getAlignmentView(boolean selectedOnly, boolean markGroups);
204
205   String[] getViewAsString(boolean selectedRegionOnly);
206
207   void setSelectionGroup(SequenceGroup sg);
208
209   char getGapCharacter();
210
211   void setColumnSelection(ColumnSelection cs);
212
213   void setConservation(Conservation cons);
214
215
216 }