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 java.awt.Color;
25 import java.util.Hashtable;
26 import java.util.Iterator;
27 import java.util.List;
30 import jalview.analysis.Conservation;
31 import jalview.analysis.TreeModel;
32 import jalview.datamodel.AlignmentAnnotation;
33 import jalview.datamodel.AlignmentExportData;
34 import jalview.datamodel.AlignmentI;
35 import jalview.datamodel.AlignmentView;
36 import jalview.datamodel.ColumnSelection;
37 import jalview.datamodel.ContactListI;
38 import jalview.datamodel.ContactMatrixI;
39 import jalview.datamodel.ProfilesI;
40 import jalview.datamodel.SearchResultsI;
41 import jalview.datamodel.SequenceCollectionI;
42 import jalview.datamodel.SequenceGroup;
43 import jalview.datamodel.SequenceI;
44 import jalview.renderer.ResidueShaderI;
45 import jalview.schemes.ColourSchemeI;
46 import jalview.viewmodel.ViewportRanges;
52 public interface AlignViewportI extends ViewStyleI
56 * Get the ranges object containing details of the start and end sequences and
61 public ViewportRanges getRanges();
64 * calculate the height for visible annotation, revalidating bounds where
65 * necessary ABSTRACT GUI METHOD
67 * @return total height of annotation
69 public int calcPanelHeight();
72 * Answers true if the viewport has at least one column selected
76 boolean hasSelectedColumns();
79 * Answers true if the viewport has at least one hidden column
83 boolean hasHiddenColumns();
85 boolean isValidCharWidth();
87 boolean isShowConsensusHistogram();
89 boolean isShowSequenceLogo();
91 boolean isNormaliseSequenceLogo();
93 ColourSchemeI getGlobalColourScheme();
96 * Returns an object that describes colouring (including any thresholding or
97 * fading) of the alignment
101 ResidueShaderI getResidueShading();
103 AlignmentI getAlignment();
105 ColumnSelection getColumnSelection();
107 ProfilesI getSequenceConsensusHash();
110 * Get consensus data table for the cDNA complement of this alignment (if any)
114 Hashtable<String, Object>[] getComplementConsensusHash();
116 Hashtable<String, Object>[] getRnaStructureConsensusHash();
118 boolean isIgnoreGapsConsensus();
120 boolean isCalculationInProgress(AlignmentAnnotation alignmentAnnotation);
122 AlignmentAnnotation getAlignmentQualityAnnot();
124 AlignmentAnnotation getAlignmentConservationAnnotation();
127 * get the container for alignment consensus annotation
131 AlignmentAnnotation getAlignmentConsensusAnnotation();
134 * get the container for alignment gap annotation
138 AlignmentAnnotation getAlignmentGapAnnotation();
141 * get the container for cDNA complement consensus annotation
145 AlignmentAnnotation getComplementConsensusAnnotation();
148 * Test to see if viewport is still open and active
150 * @return true indicates that all references to viewport should be dropped
155 * Dispose of all references or resources held by the viewport
160 * get the associated calculation thread manager for the view
164 AlignCalcManagerI getCalcManager();
167 * get the percentage gaps allowed in a conservation calculation
170 public int getConsPercGaps();
173 * set the consensus result object for the viewport
177 void setSequenceConsensusHash(ProfilesI hconsensus);
180 * Set the cDNA complement consensus for the viewport
184 void setComplementConsensusHash(Hashtable<String, Object>[] hconsensus);
188 * @return the alignment annotation row for the structure consensus
191 AlignmentAnnotation getAlignmentStrucConsensusAnnotation();
194 * set the Rna structure consensus result object for the viewport
196 * @param hStrucConsensus
198 void setRnaStructureConsensusHash(
199 Hashtable<String, Object>[] hStrucConsensus);
202 * Sets the colour scheme for the background alignment (as distinct from
203 * sub-groups, which may have their own colour schemes). A null value is used
204 * for no residue colour (white).
208 void setGlobalColourScheme(ColourSchemeI cs);
210 Map<SequenceI, SequenceCollectionI> getHiddenRepSequences();
212 void setHiddenRepSequences(
213 Map<SequenceI, SequenceCollectionI> hiddenRepSequences);
216 * hides or shows dynamic annotation rows based on groups and group and
217 * alignment associated auto-annotation state flags apply the current
218 * group/autoannotation settings to the alignment view. Usually you should
219 * call the AlignmentViewPanel.adjustAnnotationHeight() method afterwards to
220 * ensure the annotation panel bounds are set correctly.
222 * @param applyGlobalSettings
223 * - apply to all autoannotation rows or just the ones associated
224 * with the current visible region
225 * @param preserveNewGroupSettings
226 * - don't apply global settings to groups which don't already have
227 * group associated annotation
229 void updateGroupAnnotationSettings(boolean applyGlobalSettings,
230 boolean preserveNewGroupSettings);
232 void setSequenceColour(SequenceI seq, Color col);
234 Color getSequenceColour(SequenceI seq);
236 void updateSequenceIdColours();
238 SequenceGroup getSelectionGroup();
241 * get the currently selected sequence objects or all the sequences in the
242 * alignment. TODO: change to List<>
244 * @return array of references to sequence objects
246 SequenceI[] getSequenceSelection();
248 void clearSequenceColours();
251 * return a compact representation of the current alignment selection to pass
252 * to an analysis function
254 * @param selectedOnly
255 * boolean true to just return the selected view
256 * @return AlignmentView
258 AlignmentView getAlignmentView(boolean selectedOnly);
261 * return a compact representation of the current alignment selection to pass
262 * to an analysis function
264 * @param selectedOnly
265 * boolean true to just return the selected view
267 * boolean true to annotate the alignment view with groups on the
268 * alignment (and intersecting with selected region if selectedOnly
270 * @return AlignmentView
272 AlignmentView getAlignmentView(boolean selectedOnly, boolean markGroups);
275 * This method returns the visible alignment as text, as seen on the GUI, ie
276 * if columns are hidden they will not be returned in the result. Use this for
277 * calculating trees, PCA, redundancy etc on views which contain hidden
278 * columns. This method doesn't exclude hidden sequences from the output.
280 * @param selectedRegionOnly
281 * - determines if only the selected region or entire alignment is
285 String[] getViewAsString(boolean selectedRegionOnly);
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
293 * @param selectedRegionOnly
294 * - determines if only the selected region or entire alignment is
296 * @param isExportHiddenSeqs
297 * - determines if hidden sequences would be exported or not.
301 String[] getViewAsString(boolean selectedRegionOnly,
302 boolean isExportHiddenSeqs);
304 void setSelectionGroup(SequenceGroup sg);
306 char getGapCharacter();
308 void setColumnSelection(ColumnSelection cs);
310 void setConservation(Conservation cons);
313 * get a copy of the currently visible alignment annotation
315 * @param selectedOnly
316 * if true - trim to selected regions on the alignment
317 * @return an empty list or new alignment annotation objects shown only
318 * visible columns trimmed to selected region only
320 List<AlignmentAnnotation> getVisibleAlignmentAnnotation(
321 boolean selectedOnly);
323 FeaturesDisplayedI getFeaturesDisplayed();
325 String getSequenceSetId();
327 boolean areFeaturesDisplayed();
329 void setFeaturesDisplayed(FeaturesDisplayedI featuresDisplayedI);
331 void alignmentChanged(AlignmentViewPanel ap);
334 * @return the padGaps
342 void setPadGaps(boolean padGaps);
345 * return visible region boundaries within given column range
348 * first column (inclusive, from 0)
350 * last column (exclusive)
351 * @return int[][] range of {start,end} visible positions
353 List<int[]> getVisibleRegionBoundaries(int min, int max);
356 * This method returns an array of new SequenceI objects derived from the
357 * whole alignment or just the current selection with start and end points
360 * @note if you need references to the actual SequenceI objects in the
361 * alignment or currently selected then use getSequenceSelection()
362 * @return selection as new sequenceI objects
364 SequenceI[] getSelectionAsNewSequence();
366 void invertColumnSelection();
369 * broadcast selection to any interested parties
371 void sendSelection();
374 * calculate the row position for alignmentIndex if all hidden sequences were
377 * @param alignmentIndex
378 * @return adjusted row position
380 int adjustForHiddenSeqs(int alignmentIndex);
382 boolean hasHiddenRows();
386 * @return a copy of this view's current display settings
388 public ViewStyleI getViewStyle();
391 * update the view's display settings with the given style set
393 * @param settingsForView
395 public void setViewStyle(ViewStyleI settingsForView);
398 * Returns a viewport which holds the cDna for this (protein), or vice versa,
399 * or null if none is set.
403 AlignViewportI getCodingComplement();
406 * Sets the viewport which holds the cDna for this (protein), or vice versa.
407 * Implementation should guarantee that the reciprocal relationship is always
408 * set, i.e. each viewport is the complement of the other.
410 void setCodingComplement(AlignViewportI sl);
413 * Answers true if viewport hosts DNA/RNA, else false.
417 boolean isNucleotide();
420 * Returns an id guaranteed to be unique for this viewport.
427 * Return true if view should scroll to show the highlighted region of a
432 boolean isFollowHighlight();
435 * Set whether view should scroll to show the highlighted region of a sequence
437 void setFollowHighlight(boolean b);
440 * configure the feature renderer with predefined feature settings
442 * @param featureSettings
444 public void applyFeaturesStyle(FeatureSettingsModelI featureSettings);
447 * Apply the given feature settings on top of existing feature settings.
449 public void mergeFeaturesStyle(FeatureSettingsModelI featureSettings);
452 * check if current selection group is defined on the view, or is simply a
455 * @return true if group is defined on the alignment
457 boolean isSelectionDefinedGroup();
461 * @return true if there are search results on the view
463 boolean hasSearchResults();
466 * set the search results for the view
469 * - or null to clear current results
471 void setSearchResults(SearchResultsI results);
474 * get search results for this view (if any)
476 * @return search results or null
478 SearchResultsI getSearchResults();
481 * Retrieve a ContactListI corresponding to column in an annotation row in an
485 * - annotation with associated matrix data
487 * - column in alignment where _aa is associated
489 ContactListI getContactList(AlignmentAnnotation _aa, int column);
492 * Updates view settings with the given font. You may need to call
493 * AlignmentPanel.fontChanged to update the layout geometry.
496 * when true, charWidth/height is set according to font metrics
498 void setFont(Font newFont, boolean b);
501 * Answers true if split screen protein and cDNA use the same font
506 boolean isProteinFontAsCdna();
509 * Set the flag for whether split screen protein and cDNA use the same font
514 void setProteinFontAsCdna(boolean b);
516 TreeModel getCurrentTree();
518 void setCurrentTree(TreeModel tree);
521 * Answers a data bean containing data for export as configured by the
527 AlignmentExportData getAlignExportData(AlignExportSettingsI options);
531 * - set the flag for updating structures on next repaint
533 void setUpdateStructures(boolean update);
537 * @return true if structure views will be updated on next refresh
539 boolean isUpdateStructures();
542 * check if structure views need to be updated, and clear the flag afterwards.
544 * @return if an update is needed
546 boolean needToUpdateStructureViews();
549 * Adds sequencegroup to the alignment in the view. Also adds a group to the
550 * complement view if one is defined.
552 * @param sequenceGroup
553 * - a group defined on sequences in the alignment held by the view
555 void addSequenceGroup(SequenceGroup sequenceGroup);
558 * Returns an interator over the [start, end] column positions of the visible
559 * regions of the alignment
561 * @param selectedRegionOnly
562 * if true, and the view has a selection region, then only the
563 * intersection of visible columns with the selection region is
567 Iterator<int[]> getViewAsVisibleContigs(boolean selectedRegionOnly);
569 * notify all concerned that the alignment data has changed and derived data
570 * needs to be recalculated
572 public void notifyAlignmentChanged();
575 * retrieve a matrix associated with the view's alignment's annotation
576 * @param alignmentAnnotation
577 * @return contact matrix or NULL
579 ContactMatrixI getContactMatrix(AlignmentAnnotation alignmentAnnotation);