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 boolean isShowInformationHistogram();
91 boolean isShowHMMSequenceLogo();
93 boolean isNormaliseHMMSequenceLogo();
95 ColourSchemeI getGlobalColourScheme();
98 * Returns an object that describes colouring (including any thresholding or
99 * fading) of the alignment
103 ResidueShaderI getResidueShading();
105 AlignmentI getAlignment();
107 ColumnSelection getColumnSelection();
109 ProfilesI getSequenceConsensusHash();
111 ProfilesI getSequenceInformationHash();
114 * Get consensus data table for the cDNA complement of this alignment (if any)
118 Hashtable[] getComplementConsensusHash();
120 Hashtable[] getRnaStructureConsensusHash();
122 boolean isIgnoreGapsConsensus();
124 boolean isIgnoreBelowBackground();
126 boolean isCalculationInProgress(AlignmentAnnotation alignmentAnnotation);
128 AlignmentAnnotation getAlignmentQualityAnnot();
130 AlignmentAnnotation getAlignmentConservationAnnotation();
133 * get the container for alignment consensus annotation
137 AlignmentAnnotation getAlignmentConsensusAnnotation();
140 * get the container for alignment information content annotation
144 AlignmentAnnotation getAlignmentInformationAnnotation();
147 * get the container for alignment gap annotation
151 AlignmentAnnotation getAlignmentGapAnnotation();
154 * get the container for cDNA complement consensus annotation
158 AlignmentAnnotation getComplementConsensusAnnotation();
161 * Test to see if viewport is still open and active
163 * @return true indicates that all references to viewport should be dropped
168 * Dispose of all references or resources held by the viewport
173 * get the associated calculation thread manager for the view
177 AlignCalcManagerI getCalcManager();
180 * get the percentage gaps allowed in a conservation calculation
183 public int getConsPercGaps();
186 * set the consensus result object for the viewport
190 void setSequenceConsensusHash(ProfilesI hconsensus);
193 * set the information result object for the viewport
197 void setSequenceInformationHash(ProfilesI hinformation);
200 * Set the cDNA complement consensus for the viewport
204 void setComplementConsensusHash(Hashtable[] hconsensus);
208 * @return the alignment annotation row for the structure consensus
211 AlignmentAnnotation getAlignmentStrucConsensusAnnotation();
214 * set the Rna structure consensus result object for the viewport
216 * @param hStrucConsensus
218 void setRnaStructureConsensusHash(Hashtable[] hStrucConsensus);
221 * Sets the colour scheme for the background alignment (as distinct from
222 * sub-groups, which may have their own colour schemes). A null value is used
223 * for no residue colour (white).
227 void setGlobalColourScheme(ColourSchemeI cs);
229 Map<SequenceI, SequenceCollectionI> getHiddenRepSequences();
231 void setHiddenRepSequences(
232 Map<SequenceI, SequenceCollectionI> hiddenRepSequences);
235 * hides or shows dynamic annotation rows based on groups and group and
236 * alignment associated auto-annotation state flags apply the current
237 * group/autoannotation settings to the alignment view. Usually you should
238 * call the AlignmentViewPanel.adjustAnnotationHeight() method afterwards to
239 * ensure the annotation panel bounds are set correctly.
241 * @param applyGlobalSettings
242 * - apply to all autoannotation rows or just the ones associated
243 * with the current visible region
244 * @param preserveNewGroupSettings
245 * - don't apply global settings to groups which don't already have
246 * group associated annotation
248 void updateGroupAnnotationSettings(boolean applyGlobalSettings,
249 boolean preserveNewGroupSettings);
251 void setSequenceColour(SequenceI seq, Color col);
253 Color getSequenceColour(SequenceI seq);
255 void updateSequenceIdColours();
257 SequenceGroup getSelectionGroup();
260 * get the currently selected sequence objects or all the sequences in the
261 * alignment. TODO: change to List<>
263 * @return array of references to sequence objects
265 SequenceI[] getSequenceSelection();
267 void clearSequenceColours();
270 * This method returns the visible alignment as text, as seen on the GUI, ie
271 * if columns are hidden they will not be returned in the result. Use this for
272 * calculating trees, PCA, redundancy etc on views which contain hidden
277 CigarArray getViewAsCigars(boolean selectedRegionOnly);
280 * return a compact representation of the current alignment selection to pass
281 * to an analysis function
283 * @param selectedOnly
284 * boolean true to just return the selected view
285 * @return AlignmentView
287 AlignmentView getAlignmentView(boolean selectedOnly);
290 * return a compact representation of the current alignment selection to pass
291 * to an analysis function
293 * @param selectedOnly
294 * boolean true to just return the selected view
296 * boolean true to annotate the alignment view with groups on the
297 * alignment (and intersecting with selected region if selectedOnly
299 * @return AlignmentView
301 AlignmentView getAlignmentView(boolean selectedOnly, boolean markGroups);
304 * This method returns the visible alignment as text, as seen on the GUI, ie
305 * if columns are hidden they will not be returned in the result. Use this for
306 * calculating trees, PCA, redundancy etc on views which contain hidden
307 * columns. This method doesn't exclude hidden sequences from the output.
309 * @param selectedRegionOnly
310 * - determines if only the selected region or entire alignment is
314 String[] getViewAsString(boolean selectedRegionOnly);
317 * This method returns the visible alignment as text, as seen on the GUI, ie
318 * if columns are hidden they will not be returned in the result. Use this for
319 * calculating trees, PCA, redundancy etc on views which contain hidden
322 * @param selectedRegionOnly
323 * - determines if only the selected region or entire alignment is
325 * @param isExportHiddenSeqs
326 * - determines if hidden sequences would be exported or not.
330 String[] getViewAsString(boolean selectedRegionOnly,
331 boolean isExportHiddenSeqs);
333 void setSelectionGroup(SequenceGroup sg);
335 char getGapCharacter();
337 void setColumnSelection(ColumnSelection cs);
339 void setConservation(Conservation cons);
342 * get a copy of the currently visible alignment annotation
344 * @param selectedOnly
345 * if true - trim to selected regions on the alignment
346 * @return an empty list or new alignment annotation objects shown only
347 * visible columns trimmed to selected region only
349 List<AlignmentAnnotation> getVisibleAlignmentAnnotation(
350 boolean selectedOnly);
352 FeaturesDisplayedI getFeaturesDisplayed();
354 String getSequenceSetId();
356 boolean areFeaturesDisplayed();
358 void setFeaturesDisplayed(FeaturesDisplayedI featuresDisplayedI);
360 void alignmentChanged(AlignmentViewPanel ap);
363 * @return the padGaps
371 void setPadGaps(boolean padGaps);
374 * return visible region boundaries within given column range
377 * first column (inclusive, from 0)
379 * last column (exclusive)
380 * @return int[][] range of {start,end} visible positions
382 List<int[]> getVisibleRegionBoundaries(int min, int max);
385 * This method returns an array of new SequenceI objects derived from the
386 * whole alignment or just the current selection with start and end points
389 * @note if you need references to the actual SequenceI objects in the
390 * alignment or currently selected then use getSequenceSelection()
391 * @return selection as new sequenceI objects
393 SequenceI[] getSelectionAsNewSequence();
395 void invertColumnSelection();
398 * broadcast selection to any interested parties
400 void sendSelection();
403 * calculate the row position for alignmentIndex if all hidden sequences were
406 * @param alignmentIndex
407 * @return adjusted row position
409 int adjustForHiddenSeqs(int alignmentIndex);
411 boolean hasHiddenRows();
415 * @return a copy of this view's current display settings
417 public ViewStyleI getViewStyle();
420 * update the view's display settings with the given style set
422 * @param settingsForView
424 public void setViewStyle(ViewStyleI settingsForView);
427 * Returns a viewport which holds the cDna for this (protein), or vice versa,
428 * or null if none is set.
432 AlignViewportI getCodingComplement();
435 * Sets the viewport which holds the cDna for this (protein), or vice versa.
436 * Implementation should guarantee that the reciprocal relationship is always
437 * set, i.e. each viewport is the complement of the other.
439 void setCodingComplement(AlignViewportI sl);
442 * Answers true if viewport hosts DNA/RNA, else false.
446 boolean isNucleotide();
449 * Returns an id guaranteed to be unique for this viewport.
456 * Return true if view should scroll to show the highlighted region of a
461 boolean isFollowHighlight();
464 * Set whether view should scroll to show the highlighted region of a sequence
466 void setFollowHighlight(boolean b);
468 public void applyFeaturesStyle(FeatureSettingsModelI featureSettings);
471 * check if current selection group is defined on the view, or is simply a
474 * @return true if group is defined on the alignment
476 boolean isSelectionDefinedGroup();
480 * @return true if there are search results on the view
482 boolean hasSearchResults();
485 * set the search results for the view
488 * - or null to clear current results
490 void setSearchResults(SearchResultsI results);
493 * get search results for this view (if any)
495 * @return search results or null
497 SearchResultsI getSearchResults();
500 * Updates view settings with the given font. You may need to call
501 * AlignmentPanel.fontChanged to update the layout geometry.
504 * when true, charWidth/height is set according to font metrics
506 void setFont(Font newFont, boolean b);
509 * Answers true if split screen protein and cDNA use the same font
514 boolean isProteinFontAsCdna();
517 * Set the flag for whether split screen protein and cDNA use the same font
522 void setProteinFontAsCdna(boolean b);
524 ProfilesI setSequenceInformationHash();