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.analysis.TreeModel;
25 import jalview.datamodel.AlignmentAnnotation;
26 import jalview.datamodel.AlignmentExportData;
27 import jalview.datamodel.AlignmentI;
28 import jalview.datamodel.AlignmentView;
29 import jalview.datamodel.ColumnSelection;
30 import jalview.datamodel.ContactListI;
31 import jalview.datamodel.ProfilesI;
32 import jalview.datamodel.SearchResultsI;
33 import jalview.datamodel.SequenceCollectionI;
34 import jalview.datamodel.SequenceGroup;
35 import jalview.datamodel.SequenceI;
36 import jalview.renderer.ResidueShaderI;
37 import jalview.schemes.ColourSchemeI;
38 import jalview.viewmodel.ViewportRanges;
40 import java.awt.Color;
42 import java.util.Hashtable;
43 import java.util.Iterator;
44 import java.util.List;
51 public interface AlignViewportI extends ViewStyleI
55 * Get the ranges object containing details of the start and end sequences and
60 public ViewportRanges getRanges();
63 * calculate the height for visible annotation, revalidating bounds where
64 * necessary ABSTRACT GUI METHOD
66 * @return total height of annotation
68 public int calcPanelHeight();
71 * Answers true if the viewport has at least one column selected
75 boolean hasSelectedColumns();
78 * Answers true if the viewport has at least one hidden column
82 boolean hasHiddenColumns();
84 boolean isValidCharWidth();
86 boolean isShowConsensusHistogram();
88 boolean isShowSequenceLogo();
90 boolean isNormaliseSequenceLogo();
92 ColourSchemeI getGlobalColourScheme();
95 * Returns an object that describes colouring (including any thresholding or
96 * fading) of the alignment
100 ResidueShaderI getResidueShading();
102 AlignmentI getAlignment();
104 ColumnSelection getColumnSelection();
106 ProfilesI getSequenceConsensusHash();
109 * Get consensus data table for the cDNA complement of this alignment (if any)
113 Hashtable<String, Object>[] getComplementConsensusHash();
115 Hashtable<String, Object>[] getRnaStructureConsensusHash();
117 boolean isIgnoreGapsConsensus();
119 boolean isCalculationInProgress(AlignmentAnnotation alignmentAnnotation);
121 AlignmentAnnotation getAlignmentQualityAnnot();
123 AlignmentAnnotation getAlignmentConservationAnnotation();
126 * get the container for alignment consensus annotation
130 AlignmentAnnotation getAlignmentConsensusAnnotation();
133 * get the container for alignment gap annotation
137 AlignmentAnnotation getAlignmentGapAnnotation();
140 * get the container for cDNA complement consensus annotation
144 AlignmentAnnotation getComplementConsensusAnnotation();
147 * Test to see if viewport is still open and active
149 * @return true indicates that all references to viewport should be dropped
154 * Dispose of all references or resources held by the viewport
159 * get the associated calculation thread manager for the view
163 AlignCalcManagerI getCalcManager();
166 * get the percentage gaps allowed in a conservation calculation
169 public int getConsPercGaps();
172 * set the consensus result object for the viewport
176 void setSequenceConsensusHash(ProfilesI hconsensus);
179 * Set the cDNA complement consensus for the viewport
183 void setComplementConsensusHash(Hashtable<String, Object>[] hconsensus);
187 * @return the alignment annotation row for the structure consensus
190 AlignmentAnnotation getAlignmentStrucConsensusAnnotation();
193 * set the Rna structure consensus result object for the viewport
195 * @param hStrucConsensus
197 void setRnaStructureConsensusHash(
198 Hashtable<String, Object>[] hStrucConsensus);
201 * Sets the colour scheme for the background alignment (as distinct from
202 * sub-groups, which may have their own colour schemes). A null value is used
203 * for no residue colour (white).
207 void setGlobalColourScheme(ColourSchemeI cs);
209 Map<SequenceI, SequenceCollectionI> getHiddenRepSequences();
211 void setHiddenRepSequences(
212 Map<SequenceI, SequenceCollectionI> hiddenRepSequences);
215 * hides or shows dynamic annotation rows based on groups and group and
216 * alignment associated auto-annotation state flags apply the current
217 * group/autoannotation settings to the alignment view. Usually you should
218 * call the AlignmentViewPanel.adjustAnnotationHeight() method afterwards to
219 * ensure the annotation panel bounds are set correctly.
221 * @param applyGlobalSettings
222 * - apply to all autoannotation rows or just the ones associated
223 * with the current visible region
224 * @param preserveNewGroupSettings
225 * - don't apply global settings to groups which don't already have
226 * group associated annotation
228 void updateGroupAnnotationSettings(boolean applyGlobalSettings,
229 boolean preserveNewGroupSettings);
231 void setSequenceColour(SequenceI seq, Color col);
233 Color getSequenceColour(SequenceI seq);
235 void updateSequenceIdColours();
237 SequenceGroup getSelectionGroup();
240 * get the currently selected sequence objects or all the sequences in the
241 * alignment. TODO: change to List<>
243 * @return array of references to sequence objects
245 SequenceI[] getSequenceSelection();
247 void clearSequenceColours();
250 * return a compact representation of the current alignment selection to pass
251 * to an analysis function
253 * @param selectedOnly
254 * boolean true to just return the selected view
255 * @return AlignmentView
257 AlignmentView getAlignmentView(boolean selectedOnly);
260 * return a compact representation of the current alignment selection to pass
261 * to an analysis function
263 * @param selectedOnly
264 * boolean true to just return the selected view
266 * boolean true to annotate the alignment view with groups on the
267 * alignment (and intersecting with selected region if selectedOnly
269 * @return AlignmentView
271 AlignmentView getAlignmentView(boolean selectedOnly, boolean markGroups);
274 * This method returns the visible alignment as text, as seen on the GUI, ie
275 * if columns are hidden they will not be returned in the result. Use this for
276 * calculating trees, PCA, redundancy etc on views which contain hidden
277 * columns. This method doesn't exclude hidden sequences from the output.
279 * @param selectedRegionOnly
280 * - determines if only the selected region or entire alignment is
284 String[] getViewAsString(boolean selectedRegionOnly);
287 * This method returns the visible alignment as text, as seen on the GUI, ie
288 * if columns are hidden they will not be returned in the result. Use this for
289 * calculating trees, PCA, redundancy etc on views which contain hidden
292 * @param selectedRegionOnly
293 * - determines if only the selected region or entire alignment is
295 * @param isExportHiddenSeqs
296 * - determines if hidden sequences would be exported or not.
300 String[] getViewAsString(boolean selectedRegionOnly,
301 boolean isExportHiddenSeqs);
303 void setSelectionGroup(SequenceGroup sg);
305 char getGapCharacter();
307 void setColumnSelection(ColumnSelection cs);
309 void setConservation(Conservation cons);
312 * get a copy of the currently visible alignment annotation
314 * @param selectedOnly
315 * if true - trim to selected regions on the alignment
316 * @return an empty list or new alignment annotation objects shown only
317 * visible columns trimmed to selected region only
319 List<AlignmentAnnotation> getVisibleAlignmentAnnotation(
320 boolean selectedOnly);
322 FeaturesDisplayedI getFeaturesDisplayed();
324 String getSequenceSetId();
326 boolean areFeaturesDisplayed();
328 void setFeaturesDisplayed(FeaturesDisplayedI featuresDisplayedI);
330 void alignmentChanged(AlignmentViewPanel ap);
333 * @return the padGaps
341 void setPadGaps(boolean padGaps);
344 * return visible region boundaries within given column range
347 * first column (inclusive, from 0)
349 * last column (exclusive)
350 * @return int[][] range of {start,end} visible positions
352 List<int[]> getVisibleRegionBoundaries(int min, int max);
355 * This method returns an array of new SequenceI objects derived from the
356 * whole alignment or just the current selection with start and end points
359 * @note if you need references to the actual SequenceI objects in the
360 * alignment or currently selected then use getSequenceSelection()
361 * @return selection as new sequenceI objects
363 SequenceI[] getSelectionAsNewSequence();
365 void invertColumnSelection();
368 * broadcast selection to any interested parties
370 void sendSelection();
373 * calculate the row position for alignmentIndex if all hidden sequences were
376 * @param alignmentIndex
377 * @return adjusted row position
379 int adjustForHiddenSeqs(int alignmentIndex);
381 boolean hasHiddenRows();
385 * @return a copy of this view's current display settings
387 public ViewStyleI getViewStyle();
390 * update the view's display settings with the given style set
392 * @param settingsForView
394 public void setViewStyle(ViewStyleI settingsForView);
397 * Returns a viewport which holds the cDna for this (protein), or vice versa,
398 * or null if none is set.
402 AlignViewportI getCodingComplement();
405 * Sets the viewport which holds the cDna for this (protein), or vice versa.
406 * Implementation should guarantee that the reciprocal relationship is always
407 * set, i.e. each viewport is the complement of the other.
409 void setCodingComplement(AlignViewportI sl);
412 * Answers true if viewport hosts DNA/RNA, else false.
416 boolean isNucleotide();
419 * Returns an id guaranteed to be unique for this viewport.
426 * Return true if view should scroll to show the highlighted region of a
431 boolean isFollowHighlight();
434 * Set whether view should scroll to show the highlighted region of a sequence
436 void setFollowHighlight(boolean b);
439 * configure the feature renderer with predefined feature settings
441 * @param featureSettings
443 public void applyFeaturesStyle(FeatureSettingsModelI featureSettings);
446 * Apply the given feature settings on top of existing feature settings.
448 public void mergeFeaturesStyle(FeatureSettingsModelI featureSettings);
451 * check if current selection group is defined on the view, or is simply a
454 * @return true if group is defined on the alignment
456 boolean isSelectionDefinedGroup();
460 * @return true if there are search results on the view
462 boolean hasSearchResults();
465 * set the search results for the view
468 * - or null to clear current results
470 void setSearchResults(SearchResultsI results);
473 * get search results for this view (if any)
475 * @return search results or null
477 SearchResultsI getSearchResults();
479 ContactListI getContactList(AlignmentAnnotation _aa, int column);
482 * Updates view settings with the given font. You may need to call
483 * AlignmentPanel.fontChanged to update the layout geometry.
486 * when true, charWidth/height is set according to font metrics
488 void setFont(Font newFont, boolean b);
491 * Answers true if split screen protein and cDNA use the same font
496 boolean isProteinFontAsCdna();
499 * Set the flag for whether split screen protein and cDNA use the same font
504 void setProteinFontAsCdna(boolean b);
506 TreeModel getCurrentTree();
508 void setCurrentTree(TreeModel tree);
511 * Answers a data bean containing data for export as configured by the
517 AlignmentExportData getAlignExportData(AlignExportSettingsI options);
521 * - set the flag for updating structures on next repaint
523 void setUpdateStructures(boolean update);
527 * @return true if structure views will be updated on next refresh
529 boolean isUpdateStructures();
532 * check if structure views need to be updated, and clear the flag afterwards.
534 * @return if an update is needed
536 boolean needToUpdateStructureViews();
539 * Adds sequencegroup to the alignment in the view. Also adds a group to the
540 * complement view if one is defined.
542 * @param sequenceGroup
543 * - a group defined on sequences in the alignment held by the view
545 void addSequenceGroup(SequenceGroup sequenceGroup);
548 * Returns an interator over the [start, end] column positions of the visible
549 * regions of the alignment
551 * @param selectedRegionOnly
552 * if true, and the view has a selection region, then only the
553 * intersection of visible columns with the selection region is
557 Iterator<int[]> getViewAsVisibleContigs(boolean selectedRegionOnly);