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 isShowSSConsensusHistogram();
91 boolean isShowSequenceLogo();
93 boolean isShowSequenceSSLogo();
95 boolean isNormaliseSequenceLogo();
97 ColourSchemeI getGlobalColourScheme();
100 * Returns an object that describes colouring (including any thresholding or
101 * fading) of the alignment
105 ResidueShaderI getResidueShading();
107 AlignmentI getAlignment();
109 ColumnSelection getColumnSelection();
111 ProfilesI getSequenceConsensusHash();
114 * Get consensus data table for the cDNA complement of this alignment (if any)
118 Hashtable<String, Object>[] getComplementConsensusHash();
120 Hashtable<String, Object>[] getRnaStructureConsensusHash();
122 boolean isIgnoreGapsConsensus();
124 boolean isCalculationInProgress(AlignmentAnnotation alignmentAnnotation);
126 AlignmentAnnotation getAlignmentQualityAnnot();
128 AlignmentAnnotation getAlignmentConservationAnnotation();
131 * get the container for alignment consensus annotation
135 AlignmentAnnotation getAlignmentConsensusAnnotation();
137 AlignmentAnnotation getAlignmentSecondaryStructureConsensusAnnotation();
141 * get the container for alignment gap annotation
145 AlignmentAnnotation getAlignmentGapAnnotation();
148 * get the container for cDNA complement consensus annotation
152 AlignmentAnnotation getComplementConsensusAnnotation();
155 * Test to see if viewport is still open and active
157 * @return true indicates that all references to viewport should be dropped
162 * Dispose of all references or resources held by the viewport
167 * get the associated calculation thread manager for the view
171 AlignCalcManagerI getCalcManager();
174 * get the percentage gaps allowed in a conservation calculation
177 public int getConsPercGaps();
180 * set the consensus result object for the viewport
184 void setSequenceConsensusHash(ProfilesI hconsensus);
186 void setSequenceSSConsensusHash(ProfilesI hSSConsensus);
190 * Set the cDNA complement consensus for the viewport
194 void setComplementConsensusHash(Hashtable<String, Object>[] hconsensus);
198 * @return the alignment annotation row for the structure consensus
201 AlignmentAnnotation getAlignmentStrucConsensusAnnotation();
204 * set the Rna structure consensus result object for the viewport
206 * @param hStrucConsensus
208 void setRnaStructureConsensusHash(
209 Hashtable<String, Object>[] hStrucConsensus);
212 * Sets the colour scheme for the background alignment (as distinct from
213 * sub-groups, which may have their own colour schemes). A null value is used
214 * for no residue colour (white).
218 void setGlobalColourScheme(ColourSchemeI cs);
220 Map<SequenceI, SequenceCollectionI> getHiddenRepSequences();
222 void setHiddenRepSequences(
223 Map<SequenceI, SequenceCollectionI> hiddenRepSequences);
226 * hides or shows dynamic annotation rows based on groups and group and
227 * alignment associated auto-annotation state flags apply the current
228 * group/autoannotation settings to the alignment view. Usually you should
229 * call the AlignmentViewPanel.adjustAnnotationHeight() method afterwards to
230 * ensure the annotation panel bounds are set correctly.
232 * @param applyGlobalSettings
233 * - apply to all autoannotation rows or just the ones associated
234 * with the current visible region
235 * @param preserveNewGroupSettings
236 * - don't apply global settings to groups which don't already have
237 * group associated annotation
239 void updateGroupAnnotationSettings(boolean applyGlobalSettings,
240 boolean preserveNewGroupSettings);
242 void setSequenceColour(SequenceI seq, Color col);
244 Color getSequenceColour(SequenceI seq);
246 void updateSequenceIdColours();
248 SequenceGroup getSelectionGroup();
251 * get the currently selected sequence objects or all the sequences in the
252 * alignment. TODO: change to List<>
254 * @return array of references to sequence objects
256 SequenceI[] getSequenceSelection();
258 void clearSequenceColours();
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
266 * @return AlignmentView
268 AlignmentView getAlignmentView(boolean selectedOnly);
271 * return a compact representation of the current alignment selection to pass
272 * to an analysis function
274 * @param selectedOnly
275 * boolean true to just return the selected view
277 * boolean true to annotate the alignment view with groups on the
278 * alignment (and intersecting with selected region if selectedOnly
280 * @return AlignmentView
282 AlignmentView getAlignmentView(boolean selectedOnly, boolean markGroups);
285 * This method returns the visible alignment as text, as seen on the GUI, ie
286 * if columns are hidden they will not be returned in the result. Use this for
287 * calculating trees, PCA, redundancy etc on views which contain hidden
288 * columns. This method doesn't exclude hidden sequences from the output.
290 * @param selectedRegionOnly
291 * - determines if only the selected region or entire alignment is
295 String[] getViewAsString(boolean selectedRegionOnly);
298 * This method returns the visible alignment as text, as seen on the GUI, ie
299 * if columns are hidden they will not be returned in the result. Use this for
300 * calculating trees, PCA, redundancy etc on views which contain hidden
303 * @param selectedRegionOnly
304 * - determines if only the selected region or entire alignment is
306 * @param isExportHiddenSeqs
307 * - determines if hidden sequences would be exported or not.
311 String[] getViewAsString(boolean selectedRegionOnly,
312 boolean isExportHiddenSeqs);
314 void setSelectionGroup(SequenceGroup sg);
316 char getGapCharacter();
318 void setColumnSelection(ColumnSelection cs);
320 void setConservation(Conservation cons);
323 * get a copy of the currently visible alignment annotation
325 * @param selectedOnly
326 * if true - trim to selected regions on the alignment
327 * @return an empty list or new alignment annotation objects shown only
328 * visible columns trimmed to selected region only
330 List<AlignmentAnnotation> getVisibleAlignmentAnnotation(
331 boolean selectedOnly);
333 FeaturesDisplayedI getFeaturesDisplayed();
335 String getSequenceSetId();
337 boolean areFeaturesDisplayed();
339 void setFeaturesDisplayed(FeaturesDisplayedI featuresDisplayedI);
341 void alignmentChanged(AlignmentViewPanel ap);
344 * @return the padGaps
352 void setPadGaps(boolean padGaps);
355 * return visible region boundaries within given column range
358 * first column (inclusive, from 0)
360 * last column (exclusive)
361 * @return int[][] range of {start,end} visible positions
363 List<int[]> getVisibleRegionBoundaries(int min, int max);
366 * This method returns an array of new SequenceI objects derived from the
367 * whole alignment or just the current selection with start and end points
370 * @note if you need references to the actual SequenceI objects in the
371 * alignment or currently selected then use getSequenceSelection()
372 * @return selection as new sequenceI objects
374 SequenceI[] getSelectionAsNewSequence();
376 void invertColumnSelection();
379 * broadcast selection to any interested parties
381 void sendSelection();
384 * calculate the row position for alignmentIndex if all hidden sequences were
387 * @param alignmentIndex
388 * @return adjusted row position
390 int adjustForHiddenSeqs(int alignmentIndex);
392 boolean hasHiddenRows();
396 * @return a copy of this view's current display settings
398 public ViewStyleI getViewStyle();
401 * update the view's display settings with the given style set
403 * @param settingsForView
405 public void setViewStyle(ViewStyleI settingsForView);
408 * Returns a viewport which holds the cDna for this (protein), or vice versa,
409 * or null if none is set.
413 AlignViewportI getCodingComplement();
416 * Sets the viewport which holds the cDna for this (protein), or vice versa.
417 * Implementation should guarantee that the reciprocal relationship is always
418 * set, i.e. each viewport is the complement of the other.
420 void setCodingComplement(AlignViewportI sl);
423 * Answers true if viewport hosts DNA/RNA, else false.
427 boolean isNucleotide();
430 * Returns an id guaranteed to be unique for this viewport.
437 * Return true if view should scroll to show the highlighted region of a
442 boolean isFollowHighlight();
445 * Set whether view should scroll to show the highlighted region of a sequence
447 void setFollowHighlight(boolean b);
450 * configure the feature renderer with predefined feature settings
452 * @param featureSettings
454 public void applyFeaturesStyle(FeatureSettingsModelI featureSettings);
457 * Apply the given feature settings on top of existing feature settings.
459 public void mergeFeaturesStyle(FeatureSettingsModelI featureSettings);
462 * check if current selection group is defined on the view, or is simply a
465 * @return true if group is defined on the alignment
467 boolean isSelectionDefinedGroup();
471 * @return true if there are search results on the view
473 boolean hasSearchResults();
476 * set the search results for the view
479 * - or null to clear current results
481 void setSearchResults(SearchResultsI results);
484 * get search results for this view (if any)
486 * @return search results or null
488 SearchResultsI getSearchResults();
491 * Retrieve a ContactListI corresponding to column in an annotation row in an
495 * - annotation with associated matrix data
497 * - column in alignment where _aa is associated
499 ContactListI getContactList(AlignmentAnnotation _aa, int column);
502 * Updates view settings with the given font. You may need to call
503 * AlignmentPanel.fontChanged to update the layout geometry.
506 * when true, charWidth/height is set according to font metrics
508 void setFont(Font newFont, boolean b);
511 * Answers true if split screen protein and cDNA use the same font
516 boolean isProteinFontAsCdna();
519 * Set the flag for whether split screen protein and cDNA use the same font
524 void setProteinFontAsCdna(boolean b);
526 TreeModel getCurrentTree();
528 void setCurrentTree(TreeModel tree);
531 * Answers a data bean containing data for export as configured by the
537 AlignmentExportData getAlignExportData(AlignExportSettingsI options);
541 * - set the flag for updating structures on next repaint
543 void setUpdateStructures(boolean update);
547 * @return true if structure views will be updated on next refresh
549 boolean isUpdateStructures();
552 * check if structure views need to be updated, and clear the flag afterwards.
554 * @return if an update is needed
556 boolean needToUpdateStructureViews();
559 * Adds sequencegroup to the alignment in the view. Also adds a group to the
560 * complement view if one is defined.
562 * @param sequenceGroup
563 * - a group defined on sequences in the alignment held by the view
565 void addSequenceGroup(SequenceGroup sequenceGroup);
568 * Returns an interator over the [start, end] column positions of the visible
569 * regions of the alignment
571 * @param selectedRegionOnly
572 * if true, and the view has a selection region, then only the
573 * intersection of visible columns with the selection region is
577 Iterator<int[]> getViewAsVisibleContigs(boolean selectedRegionOnly);
579 * notify all concerned that the alignment data has changed and derived data
580 * needs to be recalculated
582 public void notifyAlignmentChanged();
585 * retrieve a matrix associated with the view's alignment's annotation
586 * @param alignmentAnnotation
587 * @return contact matrix or NULL
589 ContactMatrixI getContactMatrix(AlignmentAnnotation alignmentAnnotation);
591 ProfilesI getSequenceSSConsensusHash();