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();
112 * Get consensus data table for the cDNA complement of this alignment (if any)
116 Hashtable[] getComplementConsensusHash();
118 Hashtable[] getRnaStructureConsensusHash();
120 boolean isIgnoreGapsConsensus();
122 boolean isIgnoreBelowBackground();
124 boolean isCalculationInProgress(AlignmentAnnotation alignmentAnnotation);
126 AlignmentAnnotation getAlignmentQualityAnnot();
128 AlignmentAnnotation getAlignmentConservationAnnotation();
131 * get the container for alignment consensus annotation
135 AlignmentAnnotation getAlignmentConsensusAnnotation();
138 * get the container for alignment gap annotation
142 AlignmentAnnotation getAlignmentGapAnnotation();
145 * get the container for cDNA complement consensus annotation
149 AlignmentAnnotation getComplementConsensusAnnotation();
152 * Test to see if viewport is still open and active
154 * @return true indicates that all references to viewport should be dropped
159 * Dispose of all references or resources held by the viewport
164 * get the associated calculation thread manager for the view
168 AlignCalcManagerI getCalcManager();
171 * get the percentage gaps allowed in a conservation calculation
174 public int getConsPercGaps();
177 * set the consensus result object for the viewport
181 void setSequenceConsensusHash(ProfilesI hconsensus);
184 * Set the cDNA complement consensus for the viewport
188 void setComplementConsensusHash(Hashtable[] hconsensus);
192 * @return the alignment annotation row for the structure consensus
195 AlignmentAnnotation getAlignmentStrucConsensusAnnotation();
198 * set the Rna structure consensus result object for the viewport
200 * @param hStrucConsensus
202 void setRnaStructureConsensusHash(Hashtable[] hStrucConsensus);
205 * Sets the colour scheme for the background alignment (as distinct from
206 * sub-groups, which may have their own colour schemes). A null value is used
207 * for no residue colour (white).
211 void setGlobalColourScheme(ColourSchemeI cs);
213 Map<SequenceI, SequenceCollectionI> getHiddenRepSequences();
215 void setHiddenRepSequences(
216 Map<SequenceI, SequenceCollectionI> hiddenRepSequences);
219 * hides or shows dynamic annotation rows based on groups and group and
220 * alignment associated auto-annotation state flags apply the current
221 * group/autoannotation settings to the alignment view. Usually you should
222 * call the AlignmentViewPanel.adjustAnnotationHeight() method afterwards to
223 * ensure the annotation panel bounds are set correctly.
225 * @param applyGlobalSettings
226 * - apply to all autoannotation rows or just the ones associated
227 * with the current visible region
228 * @param preserveNewGroupSettings
229 * - don't apply global settings to groups which don't already have
230 * group associated annotation
232 void updateGroupAnnotationSettings(boolean applyGlobalSettings,
233 boolean preserveNewGroupSettings);
235 void setSequenceColour(SequenceI seq, Color col);
237 Color getSequenceColour(SequenceI seq);
239 void updateSequenceIdColours();
241 SequenceGroup getSelectionGroup();
244 * get the currently selected sequence objects or all the sequences in the
245 * alignment. TODO: change to List<>
247 * @return array of references to sequence objects
249 SequenceI[] getSequenceSelection();
251 void clearSequenceColours();
254 * This method returns the visible alignment as text, as seen on the GUI, ie
255 * if columns are hidden they will not be returned in the result. Use this for
256 * calculating trees, PCA, redundancy etc on views which contain hidden
261 CigarArray getViewAsCigars(boolean selectedRegionOnly);
264 * return a compact representation of the current alignment selection to pass
265 * to an analysis function
267 * @param selectedOnly
268 * boolean true to just return the selected view
269 * @return AlignmentView
271 AlignmentView getAlignmentView(boolean selectedOnly);
274 * return a compact representation of the current alignment selection to pass
275 * to an analysis function
277 * @param selectedOnly
278 * boolean true to just return the selected view
280 * boolean true to annotate the alignment view with groups on the
281 * alignment (and intersecting with selected region if selectedOnly
283 * @return AlignmentView
285 AlignmentView getAlignmentView(boolean selectedOnly, boolean markGroups);
288 * This method returns the visible alignment as text, as seen on the GUI, ie
289 * if columns are hidden they will not be returned in the result. Use this for
290 * calculating trees, PCA, redundancy etc on views which contain hidden
291 * columns. This method doesn't exclude hidden sequences from the output.
293 * @param selectedRegionOnly
294 * - determines if only the selected region or entire alignment is
298 String[] getViewAsString(boolean selectedRegionOnly);
301 * This method returns the visible alignment as text, as seen on the GUI, ie
302 * if columns are hidden they will not be returned in the result. Use this for
303 * calculating trees, PCA, redundancy etc on views which contain hidden
306 * @param selectedRegionOnly
307 * - determines if only the selected region or entire alignment is
309 * @param isExportHiddenSeqs
310 * - determines if hidden sequences would be exported or not.
314 String[] getViewAsString(boolean selectedRegionOnly,
315 boolean isExportHiddenSeqs);
317 void setSelectionGroup(SequenceGroup sg);
319 char getGapCharacter();
321 void setColumnSelection(ColumnSelection cs);
323 void setConservation(Conservation cons);
326 * get a copy of the currently visible alignment annotation
328 * @param selectedOnly
329 * if true - trim to selected regions on the alignment
330 * @return an empty list or new alignment annotation objects shown only
331 * visible columns trimmed to selected region only
333 List<AlignmentAnnotation> getVisibleAlignmentAnnotation(
334 boolean selectedOnly);
336 FeaturesDisplayedI getFeaturesDisplayed();
338 String getSequenceSetId();
340 boolean areFeaturesDisplayed();
342 void setFeaturesDisplayed(FeaturesDisplayedI featuresDisplayedI);
344 void alignmentChanged(AlignmentViewPanel ap);
347 * @return the padGaps
355 void setPadGaps(boolean padGaps);
358 * return visible region boundaries within given column range
361 * first column (inclusive, from 0)
363 * last column (exclusive)
364 * @return int[][] range of {start,end} visible positions
366 List<int[]> getVisibleRegionBoundaries(int min, int max);
369 * This method returns an array of new SequenceI objects derived from the
370 * whole alignment or just the current selection with start and end points
373 * @note if you need references to the actual SequenceI objects in the
374 * alignment or currently selected then use getSequenceSelection()
375 * @return selection as new sequenceI objects
377 SequenceI[] getSelectionAsNewSequence();
379 void invertColumnSelection();
382 * broadcast selection to any interested parties
384 void sendSelection();
387 * calculate the row position for alignmentIndex if all hidden sequences were
390 * @param alignmentIndex
391 * @return adjusted row position
393 int adjustForHiddenSeqs(int alignmentIndex);
395 boolean hasHiddenRows();
399 * @return a copy of this view's current display settings
401 public ViewStyleI getViewStyle();
404 * update the view's display settings with the given style set
406 * @param settingsForView
408 public void setViewStyle(ViewStyleI settingsForView);
411 * Returns a viewport which holds the cDna for this (protein), or vice versa,
412 * or null if none is set.
416 AlignViewportI getCodingComplement();
419 * Sets the viewport which holds the cDna for this (protein), or vice versa.
420 * Implementation should guarantee that the reciprocal relationship is always
421 * set, i.e. each viewport is the complement of the other.
423 void setCodingComplement(AlignViewportI sl);
426 * Answers true if viewport hosts DNA/RNA, else false.
430 boolean isNucleotide();
433 * Returns an id guaranteed to be unique for this viewport.
440 * Return true if view should scroll to show the highlighted region of a
445 boolean isFollowHighlight();
448 * Set whether view should scroll to show the highlighted region of a sequence
450 void setFollowHighlight(boolean b);
452 public void applyFeaturesStyle(FeatureSettingsModelI featureSettings);
455 * check if current selection group is defined on the view, or is simply a
458 * @return true if group is defined on the alignment
460 boolean isSelectionDefinedGroup();
464 * @return true if there are search results on the view
466 boolean hasSearchResults();
469 * set the search results for the view
472 * - or null to clear current results
474 void setSearchResults(SearchResultsI results);
477 * get search results for this view (if any)
479 * @return search results or null
481 SearchResultsI getSearchResults();
484 * Updates view settings with the given font. You may need to call
485 * AlignmentPanel.fontChanged to update the layout geometry.
488 * when true, charWidth/height is set according to font metrics
490 void setFont(Font newFont, boolean b);
493 * Answers true if split screen protein and cDNA use the same font
498 boolean isProteinFontAsCdna();
501 * Set the flag for whether split screen protein and cDNA use the same font
506 void setProteinFontAsCdna(boolean b);
508 void setSequenceInformationHashes(List<ProfilesI> info);
510 List<ProfilesI> getSequenceInformationHashes();
512 ProfilesI getSequenceInformationHash(int index);
514 List<AlignmentAnnotation> getInformationAnnotations();
516 AlignmentAnnotation getInformationAnnotation(int index);
518 void setSequenceInformationHash(ProfilesI info, int index);