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.ProfilesI;
30 import jalview.datamodel.SearchResultsI;
31 import jalview.datamodel.SequenceCollectionI;
32 import jalview.datamodel.SequenceGroup;
33 import jalview.datamodel.SequenceI;
34 import jalview.schemes.ColourSchemeI;
36 import java.awt.Color;
37 import java.util.Hashtable;
38 import java.util.List;
45 public interface AlignViewportI extends ViewStyleI
53 * calculate the height for visible annotation, revalidating bounds where
54 * necessary ABSTRACT GUI METHOD
56 * @return total height of annotation
58 public int calcPanelHeight();
61 * Answers true if the viewport has at least one column selected
65 boolean hasSelectedColumns();
68 * Answers true if the viewport has at least one hidden column
72 boolean hasHiddenColumns();
74 boolean isValidCharWidth();
76 boolean isShowConsensusHistogram();
78 boolean isShowSequenceLogo();
80 boolean isNormaliseSequenceLogo();
82 ColourSchemeI getGlobalColourScheme();
84 AlignmentI getAlignment();
86 ColumnSelection getColumnSelection();
88 ProfilesI getSequenceConsensusHash();
91 * Get consensus data table for the cDNA complement of this alignment (if any)
95 Hashtable[] getComplementConsensusHash();
97 Hashtable[] getRnaStructureConsensusHash();
99 boolean isIgnoreGapsConsensus();
101 boolean isCalculationInProgress(AlignmentAnnotation alignmentAnnotation);
103 AlignmentAnnotation getAlignmentQualityAnnot();
105 AlignmentAnnotation getAlignmentConservationAnnotation();
108 * get the container for alignment consensus annotation
112 AlignmentAnnotation getAlignmentConsensusAnnotation();
115 * get the container for cDNA complement consensus annotation
119 AlignmentAnnotation getComplementConsensusAnnotation();
122 * Test to see if viewport is still open and active
124 * @return true indicates that all references to viewport should be dropped
129 * Dispose of all references or resources held by the viewport
134 * get the associated calculation thread manager for the view
138 AlignCalcManagerI getCalcManager();
141 * get the percentage gaps allowed in a conservation calculation
144 public int getConsPercGaps();
147 * set the consensus result object for the viewport
151 void setSequenceConsensusHash(ProfilesI hconsensus);
154 * Set the cDNA complement consensus for the viewport
158 void setComplementConsensusHash(Hashtable[] hconsensus);
162 * @return the alignment annotatino row for the structure consensus
165 AlignmentAnnotation getAlignmentStrucConsensusAnnotation();
168 * set the Rna structure consensus result object for the viewport
170 * @param hStrucConsensus
172 void setRnaStructureConsensusHash(Hashtable[] hStrucConsensus);
175 * set global colourscheme
179 void setGlobalColourScheme(ColourSchemeI rhc);
181 Map<SequenceI, SequenceCollectionI> getHiddenRepSequences();
183 void setHiddenRepSequences(
184 Map<SequenceI, SequenceCollectionI> hiddenRepSequences);
187 * hides or shows dynamic annotation rows based on groups and group and
188 * alignment associated auto-annotation state flags apply the current
189 * group/autoannotation settings to the alignment view. Usually you should
190 * call the AlignmentViewPanel.adjustAnnotationHeight() method afterwards to
191 * ensure the annotation panel bounds are set correctly.
193 * @param applyGlobalSettings
194 * - apply to all autoannotation rows or just the ones associated
195 * with the current visible region
196 * @param preserveNewGroupSettings
197 * - don't apply global settings to groups which don't already have
198 * group associated annotation
200 void updateGroupAnnotationSettings(boolean applyGlobalSettings,
201 boolean preserveNewGroupSettings);
203 void setSequenceColour(SequenceI seq, Color col);
205 Color getSequenceColour(SequenceI seq);
207 void updateSequenceIdColours();
209 SequenceGroup getSelectionGroup();
212 * get the currently selected sequence objects or all the sequences in the
213 * alignment. TODO: change to List<>
215 * @return array of references to sequence objects
217 SequenceI[] getSequenceSelection();
219 void clearSequenceColours();
222 * This method returns the visible alignment as text, as seen on the GUI, ie
223 * if columns are hidden they will not be returned in the result. Use this for
224 * calculating trees, PCA, redundancy etc on views which contain hidden
229 CigarArray getViewAsCigars(boolean selectedRegionOnly);
232 * return a compact representation of the current alignment selection to pass
233 * to an analysis function
235 * @param selectedOnly
236 * boolean true to just return the selected view
237 * @return AlignmentView
239 AlignmentView getAlignmentView(boolean selectedOnly);
242 * return a compact representation of the current alignment selection to pass
243 * to an analysis function
245 * @param selectedOnly
246 * boolean true to just return the selected view
248 * boolean true to annotate the alignment view with groups on the
249 * alignment (and intersecting with selected region if selectedOnly
251 * @return AlignmentView
253 AlignmentView getAlignmentView(boolean selectedOnly, boolean markGroups);
256 * This method returns the visible alignment as text, as seen on the GUI, ie
257 * if columns are hidden they will not be returned in the result. Use this for
258 * calculating trees, PCA, redundancy etc on views which contain hidden
259 * columns. This method doesn't exclude hidden sequences from the output.
261 * @param selectedRegionOnly
262 * - determines if only the selected region or entire alignment is
266 String[] getViewAsString(boolean selectedRegionOnly);
269 * This method returns the visible alignment as text, as seen on the GUI, ie
270 * if columns are hidden they will not be returned in the result. Use this for
271 * calculating trees, PCA, redundancy etc on views which contain hidden
274 * @param selectedRegionOnly
275 * - determines if only the selected region or entire alignment is
277 * @param isExportHiddenSeqs
278 * - determines if hidden sequences would be exported or not.
282 String[] getViewAsString(boolean selectedRegionOnly,
283 boolean isExportHiddenSeqs);
285 void setSelectionGroup(SequenceGroup sg);
287 char getGapCharacter();
289 void setColumnSelection(ColumnSelection cs);
291 void setConservation(Conservation cons);
294 * get a copy of the currently visible alignment annotation
296 * @param selectedOnly
297 * if true - trim to selected regions on the alignment
298 * @return an empty list or new alignment annotation objects shown only
299 * visible columns trimmed to selected region only
301 List<AlignmentAnnotation> getVisibleAlignmentAnnotation(
302 boolean selectedOnly);
304 FeaturesDisplayedI getFeaturesDisplayed();
306 String getSequenceSetId();
308 boolean areFeaturesDisplayed();
310 void setFeaturesDisplayed(FeaturesDisplayedI featuresDisplayedI);
312 void alignmentChanged(AlignmentViewPanel ap);
315 * @return the padGaps
323 void setPadGaps(boolean padGaps);
326 * return visible region boundaries within given column range
329 * first column (inclusive, from 0)
331 * last column (exclusive)
332 * @return int[][] range of {start,end} visible positions
334 List<int[]> getVisibleRegionBoundaries(int min, int max);
337 * This method returns an array of new SequenceI objects derived from the
338 * whole alignment or just the current selection with start and end points
341 * @note if you need references to the actual SequenceI objects in the
342 * alignment or currently selected then use getSequenceSelection()
343 * @return selection as new sequenceI objects
345 SequenceI[] getSelectionAsNewSequence();
347 void invertColumnSelection();
350 * broadcast selection to any interested parties
352 void sendSelection();
355 * calculate the row position for alignmentIndex if all hidden sequences were
358 * @param alignmentIndex
359 * @return adjusted row position
361 int adjustForHiddenSeqs(int alignmentIndex);
363 boolean hasHiddenRows();
367 * @return a copy of this view's current display settings
369 public ViewStyleI getViewStyle();
372 * update the view's display settings with the given style set
374 * @param settingsForView
376 public void setViewStyle(ViewStyleI settingsForView);
379 * Returns a viewport which holds the cDna for this (protein), or vice versa,
380 * or null if none is set.
384 AlignViewportI getCodingComplement();
387 * Sets the viewport which holds the cDna for this (protein), or vice versa.
388 * Implementation should guarantee that the reciprocal relationship is always
389 * set, i.e. each viewport is the complement of the other.
391 void setCodingComplement(AlignViewportI sl);
394 * Answers true if viewport hosts DNA/RNA, else false.
398 boolean isNucleotide();
401 * Returns an id guaranteed to be unique for this viewport.
408 * Return true if view should scroll to show the highlighted region of a
413 boolean isFollowHighlight();
416 * Set whether view should scroll to show the highlighted region of a sequence
418 void setFollowHighlight(boolean b);
420 public void applyFeaturesStyle(FeatureSettingsModelI featureSettings);
423 * check if current selection group is defined on the view, or is simply a
426 * @return true if group is defined on the alignment
428 boolean isSelectionDefinedGroup();
432 * @return true if there are search results on the view
434 boolean hasSearchResults();
437 * set the search results for the view
440 * - or null to clear current results
442 void setSearchResults(SearchResultsI results);
445 * get search results for this view (if any)
447 * @return search results or null
449 SearchResultsI getSearchResults();