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.
23 import jalview.analysis.Conservation;
24 import jalview.datamodel.AlignmentAnnotation;
25 import jalview.datamodel.AlignmentI;
26 import jalview.datamodel.AlignmentView;
27 import jalview.datamodel.CigarArray;
28 import jalview.datamodel.ColumnSelection;
29 import jalview.datamodel.SequenceCollectionI;
30 import jalview.datamodel.SequenceGroup;
31 import jalview.datamodel.SequenceI;
32 import jalview.schemes.ColourSchemeI;
34 import java.awt.Color;
35 import java.util.Hashtable;
36 import java.util.List;
43 public interface AlignViewportI extends ViewStyleI
49 * calculate the height for visible annotation, revalidating bounds where
50 * necessary ABSTRACT GUI METHOD
52 * @return total height of annotation
54 public int calcPanelHeight();
57 * Answers true if the viewport has at least one column selected
61 boolean hasSelectedColumns();
64 * Answers true if the viewport has at least one hidden column
68 boolean hasHiddenColumns();
70 boolean isValidCharWidth();
72 boolean isShowConsensusHistogram();
74 boolean isShowSequenceLogo();
76 boolean isNormaliseSequenceLogo();
78 ColourSchemeI getGlobalColourScheme();
80 AlignmentI getAlignment();
82 ColumnSelection getColumnSelection();
84 Hashtable[] getSequenceConsensusHash();
87 * Get consensus data table for the cDNA complement of this alignment (if any)
91 Hashtable[] getComplementConsensusHash();
93 Hashtable[] getRnaStructureConsensusHash();
95 boolean isIgnoreGapsConsensus();
97 boolean isCalculationInProgress(AlignmentAnnotation alignmentAnnotation);
99 AlignmentAnnotation getAlignmentQualityAnnot();
101 AlignmentAnnotation getAlignmentConservationAnnotation();
104 * get the container for alignment consensus annotation
108 AlignmentAnnotation getAlignmentConsensusAnnotation();
111 * get the container for cDNA complement consensus annotation
115 AlignmentAnnotation getComplementConsensusAnnotation();
118 * Test to see if viewport is still open and active
120 * @return true indicates that all references to viewport should be dropped
125 * Dispose of all references or resources held by the viewport
130 * get the associated calculation thread manager for the view
134 AlignCalcManagerI getCalcManager();
137 * get the percentage gaps allowed in a conservation calculation
140 public int getConsPercGaps();
143 * set the consensus result object for the viewport
147 void setSequenceConsensusHash(Hashtable[] hconsensus);
150 * Set the cDNA complement consensus for the viewport
154 void setComplementConsensusHash(Hashtable[] hconsensus);
158 * @return the alignment annotatino row for the structure consensus
161 AlignmentAnnotation getAlignmentStrucConsensusAnnotation();
164 * set the Rna structure consensus result object for the viewport
166 * @param hStrucConsensus
168 void setRnaStructureConsensusHash(Hashtable[] hStrucConsensus);
171 * set global colourscheme
175 void setGlobalColourScheme(ColourSchemeI rhc);
177 Map<SequenceI, SequenceCollectionI> getHiddenRepSequences();
179 void setHiddenRepSequences(
180 Map<SequenceI, SequenceCollectionI> hiddenRepSequences);
183 * hides or shows dynamic annotation rows based on groups and group and
184 * alignment associated auto-annotation state flags apply the current
185 * group/autoannotation settings to the alignment view. Usually you should
186 * call the AlignmentViewPanel.adjustAnnotationHeight() method afterwards to
187 * ensure the annotation panel bounds are set correctly.
189 * @param applyGlobalSettings
190 * - apply to all autoannotation rows or just the ones associated
191 * with the current visible region
192 * @param preserveNewGroupSettings
193 * - don't apply global settings to groups which don't already have
194 * group associated annotation
196 void updateGroupAnnotationSettings(boolean applyGlobalSettings,
197 boolean preserveNewGroupSettings);
199 void setSequenceColour(SequenceI seq, Color col);
201 Color getSequenceColour(SequenceI seq);
203 void updateSequenceIdColours();
205 SequenceGroup getSelectionGroup();
208 * get the currently selected sequence objects or all the sequences in the
209 * alignment. TODO: change to List<>
211 * @return array of references to sequence objects
213 SequenceI[] getSequenceSelection();
215 void clearSequenceColours();
218 * This method returns the visible alignment as text, as seen on the GUI, ie
219 * if columns are hidden they will not be returned in the result. Use this for
220 * calculating trees, PCA, redundancy etc on views which contain hidden
225 CigarArray getViewAsCigars(boolean selectedRegionOnly);
228 * return a compact representation of the current alignment selection to pass
229 * to an analysis function
231 * @param selectedOnly
232 * boolean true to just return the selected view
233 * @return AlignmentView
235 AlignmentView getAlignmentView(boolean selectedOnly);
238 * return a compact representation of the current alignment selection to pass
239 * to an analysis function
241 * @param selectedOnly
242 * boolean true to just return the selected view
244 * boolean true to annotate the alignment view with groups on the
245 * alignment (and intersecting with selected region if selectedOnly
247 * @return AlignmentView
249 AlignmentView getAlignmentView(boolean selectedOnly, boolean markGroups);
252 * This method returns the visible alignment as text, as seen on the GUI, ie
253 * if columns are hidden they will not be returned in the result. Use this for
254 * calculating trees, PCA, redundancy etc on views which contain hidden
255 * columns. This method doesn't exclude hidden sequences from the output.
257 * @param selectedRegionOnly
258 * - determines if only the selected region or entire alignment is
262 String[] getViewAsString(boolean selectedRegionOnly);
265 * This method returns the visible alignment as text, as seen on the GUI, ie
266 * if columns are hidden they will not be returned in the result. Use this for
267 * calculating trees, PCA, redundancy etc on views which contain hidden
270 * @param selectedRegionOnly
271 * - determines if only the selected region or entire alignment is
273 * @param isExportHiddenSeqs
274 * - determines if hidden sequences would be exported or not.
278 String[] getViewAsString(boolean selectedRegionOnly, boolean isExportHiddenSeqs);
280 void setSelectionGroup(SequenceGroup sg);
282 char getGapCharacter();
284 void setColumnSelection(ColumnSelection cs);
286 void setConservation(Conservation cons);
289 * get a copy of the currently visible alignment annotation
291 * @param selectedOnly
292 * if true - trim to selected regions on the alignment
293 * @return an empty list or new alignment annotation objects shown only
294 * visible columns trimmed to selected region only
296 List<AlignmentAnnotation> getVisibleAlignmentAnnotation(
297 boolean selectedOnly);
299 FeaturesDisplayedI getFeaturesDisplayed();
301 String getSequenceSetId();
303 boolean areFeaturesDisplayed();
305 void setFeaturesDisplayed(FeaturesDisplayedI featuresDisplayedI);
307 void alignmentChanged(AlignmentViewPanel ap);
310 * @return the padGaps
318 void setPadGaps(boolean padGaps);
321 * return visible region boundaries within given column range
324 * first column (inclusive, from 0)
326 * last column (exclusive)
327 * @return int[][] range of {start,end} visible positions
329 List<int[]> getVisibleRegionBoundaries(int min, int max);
332 * This method returns an array of new SequenceI objects derived from the
333 * whole alignment or just the current selection with start and end points
336 * @note if you need references to the actual SequenceI objects in the
337 * alignment or currently selected then use getSequenceSelection()
338 * @return selection as new sequenceI objects
340 SequenceI[] getSelectionAsNewSequence();
342 void invertColumnSelection();
345 * broadcast selection to any interested parties
347 void sendSelection();
350 * calculate the row position for alignmentIndex if all hidden sequences were
353 * @param alignmentIndex
354 * @return adjusted row position
356 int adjustForHiddenSeqs(int alignmentIndex);
358 boolean hasHiddenRows();
362 * @return a copy of this view's current display settings
364 public ViewStyleI getViewStyle();
367 * update the view's display settings with the given style set
369 * @param settingsForView
371 public void setViewStyle(ViewStyleI settingsForView);
374 * Returns a viewport which holds the cDna for this (protein), or vice versa,
375 * or null if none is set.
379 AlignViewportI getCodingComplement();
382 * Sets the viewport which holds the cDna for this (protein), or vice versa.
383 * Implementation should guarantee that the reciprocal relationship is always
384 * set, i.e. each viewport is the complement of the other.
386 void setCodingComplement(AlignViewportI sl);
389 * Answers true if viewport hosts DNA/RNA, else false.
393 boolean isNucleotide();
396 * Returns an id guaranteed to be unique for this viewport.
403 * Return true if view should scroll to show the highlighted region of a
408 boolean isFollowHighlight();
411 * Set whether view should scroll to show the highlighted region of a sequence
413 void setFollowHighlight(boolean b);
416 public void applyFeaturesStyle(FeatureSettingsModelI featureSettings);
419 * check if current selection group is defined on the view, or is simply a
422 * @return true if group is defined on the alignment
424 boolean isSelectionDefinedGroup();