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.renderer.ResidueShaderI;
35 import jalview.schemes.ColourSchemeI;
36 import jalview.viewmodel.ViewportRanges;
38 import java.awt.Color;
40 import java.util.Hashtable;
41 import java.util.List;
48 public interface AlignViewportI extends ViewStyleI
52 * Get the ranges object containing details of the start and end sequences and
57 public ViewportRanges getRanges();
60 * calculate the height for visible annotation, revalidating bounds where
61 * necessary ABSTRACT GUI METHOD
63 * @return total height of annotation
65 public int calcPanelHeight();
68 * Answers true if the viewport has at least one column selected
72 boolean hasSelectedColumns();
75 * Answers true if the viewport has at least one hidden column
79 boolean hasHiddenColumns();
81 boolean isValidCharWidth();
83 boolean isShowConsensusHistogram();
85 boolean isShowSequenceLogo();
87 boolean isNormaliseSequenceLogo();
89 ColourSchemeI getGlobalColourScheme();
92 * Returns an object that describes colouring (including any thresholding or
93 * fading) of the alignment
97 ResidueShaderI getResidueShading();
99 AlignmentI getAlignment();
101 ColumnSelection getColumnSelection();
103 ProfilesI getSequenceConsensusHash();
106 * Get consensus data table for the cDNA complement of this alignment (if any)
110 Hashtable[] getComplementConsensusHash();
112 Hashtable[] getRnaStructureConsensusHash();
114 boolean isIgnoreGapsConsensus();
116 boolean isCalculationInProgress(AlignmentAnnotation alignmentAnnotation);
118 AlignmentAnnotation getAlignmentQualityAnnot();
120 AlignmentAnnotation getAlignmentConservationAnnotation();
123 * get the container for alignment consensus annotation
127 AlignmentAnnotation getAlignmentConsensusAnnotation();
130 * get the container for alignment gap annotation
134 AlignmentAnnotation getAlignmentGapAnnotation();
137 * get the container for cDNA complement consensus annotation
141 AlignmentAnnotation getComplementConsensusAnnotation();
144 * Test to see if viewport is still open and active
146 * @return true indicates that all references to viewport should be dropped
151 * Dispose of all references or resources held by the viewport
156 * get the associated calculation thread manager for the view
160 AlignCalcManagerI getCalcManager();
163 * get the percentage gaps allowed in a conservation calculation
166 public int getConsPercGaps();
169 * set the consensus result object for the viewport
173 void setSequenceConsensusHash(ProfilesI hconsensus);
176 * Set the cDNA complement consensus for the viewport
180 void setComplementConsensusHash(Hashtable[] hconsensus);
184 * @return the alignment annotation row for the structure consensus
187 AlignmentAnnotation getAlignmentStrucConsensusAnnotation();
190 * set the Rna structure consensus result object for the viewport
192 * @param hStrucConsensus
194 void setRnaStructureConsensusHash(Hashtable[] hStrucConsensus);
197 * Sets the colour scheme for the background alignment (as distinct from
198 * sub-groups, which may have their own colour schemes). A null value is used
199 * for no residue colour (white).
203 void setGlobalColourScheme(ColourSchemeI cs);
205 Map<SequenceI, SequenceCollectionI> getHiddenRepSequences();
207 void setHiddenRepSequences(
208 Map<SequenceI, SequenceCollectionI> hiddenRepSequences);
211 * hides or shows dynamic annotation rows based on groups and group and
212 * alignment associated auto-annotation state flags apply the current
213 * group/autoannotation settings to the alignment view. Usually you should
214 * call the AlignmentViewPanel.adjustAnnotationHeight() method afterwards to
215 * ensure the annotation panel bounds are set correctly.
217 * @param applyGlobalSettings
218 * - apply to all autoannotation rows or just the ones associated
219 * with the current visible region
220 * @param preserveNewGroupSettings
221 * - don't apply global settings to groups which don't already have
222 * group associated annotation
224 void updateGroupAnnotationSettings(boolean applyGlobalSettings,
225 boolean preserveNewGroupSettings);
227 void setSequenceColour(SequenceI seq, Color col);
229 Color getSequenceColour(SequenceI seq);
231 void updateSequenceIdColours();
233 SequenceGroup getSelectionGroup();
236 * get the currently selected sequence objects or all the sequences in the
237 * alignment. TODO: change to List<>
239 * @return array of references to sequence objects
241 SequenceI[] getSequenceSelection();
243 void clearSequenceColours();
246 * This method returns the visible alignment as text, as seen on the GUI, ie
247 * if columns are hidden they will not be returned in the result. Use this for
248 * calculating trees, PCA, redundancy etc on views which contain hidden
253 CigarArray getViewAsCigars(boolean selectedRegionOnly);
256 * return a compact representation of the current alignment selection to pass
257 * to an analysis function
259 * @param selectedOnly
260 * boolean true to just return the selected view
261 * @return AlignmentView
263 AlignmentView getAlignmentView(boolean selectedOnly);
266 * return a compact representation of the current alignment selection to pass
267 * to an analysis function
269 * @param selectedOnly
270 * boolean true to just return the selected view
272 * boolean true to annotate the alignment view with groups on the
273 * alignment (and intersecting with selected region if selectedOnly
275 * @return AlignmentView
277 AlignmentView getAlignmentView(boolean selectedOnly, boolean markGroups);
280 * This method returns the visible alignment as text, as seen on the GUI, ie
281 * if columns are hidden they will not be returned in the result. Use this for
282 * calculating trees, PCA, redundancy etc on views which contain hidden
283 * columns. This method doesn't exclude hidden sequences from the output.
285 * @param selectedRegionOnly
286 * - determines if only the selected region or entire alignment is
290 String[] getViewAsString(boolean selectedRegionOnly);
293 * This method returns the visible alignment as text, as seen on the GUI, ie
294 * if columns are hidden they will not be returned in the result. Use this for
295 * calculating trees, PCA, redundancy etc on views which contain hidden
298 * @param selectedRegionOnly
299 * - determines if only the selected region or entire alignment is
301 * @param isExportHiddenSeqs
302 * - determines if hidden sequences would be exported or not.
306 String[] getViewAsString(boolean selectedRegionOnly,
307 boolean isExportHiddenSeqs);
309 void setSelectionGroup(SequenceGroup sg);
311 char getGapCharacter();
313 void setColumnSelection(ColumnSelection cs);
315 void setConservation(Conservation cons);
318 * get a copy of the currently visible alignment annotation
320 * @param selectedOnly
321 * if true - trim to selected regions on the alignment
322 * @return an empty list or new alignment annotation objects shown only
323 * visible columns trimmed to selected region only
325 List<AlignmentAnnotation> getVisibleAlignmentAnnotation(
326 boolean selectedOnly);
328 FeaturesDisplayedI getFeaturesDisplayed();
330 String getSequenceSetId();
332 boolean areFeaturesDisplayed();
334 void setFeaturesDisplayed(FeaturesDisplayedI featuresDisplayedI);
336 void alignmentChanged(AlignmentViewPanel ap);
339 * @return the padGaps
347 void setPadGaps(boolean padGaps);
350 * return visible region boundaries within given column range
353 * first column (inclusive, from 0)
355 * last column (exclusive)
356 * @return int[][] range of {start,end} visible positions
358 List<int[]> getVisibleRegionBoundaries(int min, int max);
361 * This method returns an array of new SequenceI objects derived from the
362 * whole alignment or just the current selection with start and end points
365 * @note if you need references to the actual SequenceI objects in the
366 * alignment or currently selected then use getSequenceSelection()
367 * @return selection as new sequenceI objects
369 SequenceI[] getSelectionAsNewSequence();
371 void invertColumnSelection();
374 * broadcast selection to any interested parties
376 void sendSelection();
379 * calculate the row position for alignmentIndex if all hidden sequences were
382 * @param alignmentIndex
383 * @return adjusted row position
385 int adjustForHiddenSeqs(int alignmentIndex);
387 boolean hasHiddenRows();
391 * @return a copy of this view's current display settings
393 public ViewStyleI getViewStyle();
396 * update the view's display settings with the given style set
398 * @param settingsForView
400 public void setViewStyle(ViewStyleI settingsForView);
403 * Returns a viewport which holds the cDna for this (protein), or vice versa,
404 * or null if none is set.
408 AlignViewportI getCodingComplement();
411 * Sets the viewport which holds the cDna for this (protein), or vice versa.
412 * Implementation should guarantee that the reciprocal relationship is always
413 * set, i.e. each viewport is the complement of the other.
415 void setCodingComplement(AlignViewportI sl);
418 * Answers true if viewport hosts DNA/RNA, else false.
422 boolean isNucleotide();
425 * Returns an id guaranteed to be unique for this viewport.
432 * Return true if view should scroll to show the highlighted region of a
437 boolean isFollowHighlight();
440 * Set whether view should scroll to show the highlighted region of a sequence
442 void setFollowHighlight(boolean b);
444 public void applyFeaturesStyle(FeatureSettingsModelI featureSettings);
447 * check if current selection group is defined on the view, or is simply a
450 * @return true if group is defined on the alignment
452 boolean isSelectionDefinedGroup();
456 * @return true if there are search results on the view
458 boolean hasSearchResults();
461 * set the search results for the view
464 * - or null to clear current results
466 void setSearchResults(SearchResultsI results);
469 * get search results for this view (if any)
471 * @return search results or null
473 SearchResultsI getSearchResults();
476 * Updates view settings with the given font. You may need to call
477 * AlignmentPanel.fontChanged to update the layout geometry.
480 * when true, charWidth/height is set according to font metrics
482 void setFont(Font newFont, boolean b);
485 * Answers true if split screen protein and cDNA use the same font
489 boolean isProteinFontAsCdna();
492 * Set the flag for whether split screen protein and cDNA use the same font
496 void setProteinFontAsCdna(boolean b);