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;
47 import jalview.viewmodel.seqfeatures.IdColumns;
53 public interface AlignViewportI extends ViewStyleI
57 * Get the ranges object containing details of the start and end sequences and
62 public ViewportRanges getRanges();
65 * calculate the height for visible annotation, revalidating bounds where
66 * necessary ABSTRACT GUI METHOD
68 * @return total height of annotation
70 public int calcPanelHeight();
73 * Answers true if the viewport has at least one column selected
77 boolean hasSelectedColumns();
80 * Answers true if the viewport has at least one hidden column
84 boolean hasHiddenColumns();
86 boolean isValidCharWidth();
88 boolean isShowConsensusHistogram();
90 boolean isShowSequenceLogo();
92 boolean isNormaliseSequenceLogo();
94 ColourSchemeI getGlobalColourScheme();
97 * Returns an object that describes colouring (including any thresholding or
98 * fading) of the alignment
102 ResidueShaderI getResidueShading();
104 AlignmentI getAlignment();
106 ColumnSelection getColumnSelection();
108 ProfilesI getSequenceConsensusHash();
111 * Get consensus data table for the cDNA complement of this alignment (if any)
115 Hashtable<String, Object>[] getComplementConsensusHash();
117 Hashtable<String, Object>[] getRnaStructureConsensusHash();
119 boolean isIgnoreGapsConsensus();
121 boolean isCalculationInProgress(AlignmentAnnotation alignmentAnnotation);
123 AlignmentAnnotation getAlignmentQualityAnnot();
125 AlignmentAnnotation getAlignmentConservationAnnotation();
128 * get the container for alignment consensus annotation
132 AlignmentAnnotation getAlignmentConsensusAnnotation();
135 * get the container for alignment gap annotation
139 AlignmentAnnotation getAlignmentGapAnnotation();
142 * get the container for cDNA complement consensus annotation
146 AlignmentAnnotation getComplementConsensusAnnotation();
149 * Test to see if viewport is still open and active
151 * @return true indicates that all references to viewport should be dropped
156 * Dispose of all references or resources held by the viewport
161 * get the associated calculation thread manager for the view
165 AlignCalcManagerI getCalcManager();
168 * get the percentage gaps allowed in a conservation calculation
171 public int getConsPercGaps();
174 * set the consensus result object for the viewport
178 void setSequenceConsensusHash(ProfilesI hconsensus);
181 * Set the cDNA complement consensus for the viewport
185 void setComplementConsensusHash(Hashtable<String, Object>[] hconsensus);
189 * @return the alignment annotation row for the structure consensus
192 AlignmentAnnotation getAlignmentStrucConsensusAnnotation();
195 * set the Rna structure consensus result object for the viewport
197 * @param hStrucConsensus
199 void setRnaStructureConsensusHash(
200 Hashtable<String, Object>[] hStrucConsensus);
203 * Sets the colour scheme for the background alignment (as distinct from
204 * sub-groups, which may have their own colour schemes). A null value is used
205 * for no residue colour (white).
209 void setGlobalColourScheme(ColourSchemeI cs);
211 Map<SequenceI, SequenceCollectionI> getHiddenRepSequences();
213 void setHiddenRepSequences(
214 Map<SequenceI, SequenceCollectionI> hiddenRepSequences);
217 * hides or shows dynamic annotation rows based on groups and group and
218 * alignment associated auto-annotation state flags apply the current
219 * group/autoannotation settings to the alignment view. Usually you should
220 * call the AlignmentViewPanel.adjustAnnotationHeight() method afterwards to
221 * ensure the annotation panel bounds are set correctly.
223 * @param applyGlobalSettings
224 * - apply to all autoannotation rows or just the ones associated
225 * with the current visible region
226 * @param preserveNewGroupSettings
227 * - don't apply global settings to groups which don't already have
228 * group associated annotation
230 void updateGroupAnnotationSettings(boolean applyGlobalSettings,
231 boolean preserveNewGroupSettings);
233 void setSequenceColour(SequenceI seq, Color col);
235 Color getSequenceColour(SequenceI seq);
237 void updateSequenceIdColours();
239 SequenceGroup getSelectionGroup();
242 * get the currently selected sequence objects or all the sequences in the
243 * alignment. TODO: change to List<>
245 * @return array of references to sequence objects
247 SequenceI[] getSequenceSelection();
249 void clearSequenceColours();
252 * return a compact representation of the current alignment selection to pass
253 * to an analysis function
255 * @param selectedOnly
256 * boolean true to just return the selected view
257 * @return AlignmentView
259 AlignmentView getAlignmentView(boolean selectedOnly);
262 * return a compact representation of the current alignment selection to pass
263 * to an analysis function
265 * @param selectedOnly
266 * boolean true to just return the selected view
268 * boolean true to annotate the alignment view with groups on the
269 * alignment (and intersecting with selected region if selectedOnly
271 * @return AlignmentView
273 AlignmentView getAlignmentView(boolean selectedOnly, boolean markGroups);
276 * This method returns the visible alignment as text, as seen on the GUI, ie
277 * if columns are hidden they will not be returned in the result. Use this for
278 * calculating trees, PCA, redundancy etc on views which contain hidden
279 * columns. This method doesn't exclude hidden sequences from the output.
281 * @param selectedRegionOnly
282 * - determines if only the selected region or entire alignment is
286 String[] getViewAsString(boolean selectedRegionOnly);
289 * This method returns the visible alignment as text, as seen on the GUI, ie
290 * if columns are hidden they will not be returned in the result. Use this for
291 * calculating trees, PCA, redundancy etc on views which contain hidden
294 * @param selectedRegionOnly
295 * - determines if only the selected region or entire alignment is
297 * @param isExportHiddenSeqs
298 * - determines if hidden sequences would be exported or not.
302 String[] getViewAsString(boolean selectedRegionOnly,
303 boolean isExportHiddenSeqs);
305 void setSelectionGroup(SequenceGroup sg);
307 char getGapCharacter();
309 void setColumnSelection(ColumnSelection cs);
311 void setConservation(Conservation cons);
314 * get a copy of the currently visible alignment annotation
316 * @param selectedOnly
317 * if true - trim to selected regions on the alignment
318 * @return an empty list or new alignment annotation objects shown only
319 * visible columns trimmed to selected region only
321 List<AlignmentAnnotation> getVisibleAlignmentAnnotation(
322 boolean selectedOnly);
324 FeaturesDisplayedI getFeaturesDisplayed();
326 String getSequenceSetId();
328 boolean areFeaturesDisplayed();
330 void setFeaturesDisplayed(FeaturesDisplayedI featuresDisplayedI);
332 void alignmentChanged(AlignmentViewPanel ap);
335 * @return the padGaps
343 void setPadGaps(boolean padGaps);
346 * return visible region boundaries within given column range
349 * first column (inclusive, from 0)
351 * last column (exclusive)
352 * @return int[][] range of {start,end} visible positions
354 List<int[]> getVisibleRegionBoundaries(int min, int max);
357 * This method returns an array of new SequenceI objects derived from the
358 * whole alignment or just the current selection with start and end points
361 * @note if you need references to the actual SequenceI objects in the
362 * alignment or currently selected then use getSequenceSelection()
363 * @return selection as new sequenceI objects
365 SequenceI[] getSelectionAsNewSequence();
367 void invertColumnSelection();
370 * broadcast selection to any interested parties
372 void sendSelection();
375 * calculate the row position for alignmentIndex if all hidden sequences were
378 * @param alignmentIndex
379 * @return adjusted row position
381 int adjustForHiddenSeqs(int alignmentIndex);
383 boolean hasHiddenRows();
387 * @return a copy of this view's current display settings
389 public ViewStyleI getViewStyle();
392 * update the view's display settings with the given style set
394 * @param settingsForView
396 public void setViewStyle(ViewStyleI settingsForView);
399 * Returns a viewport which holds the cDna for this (protein), or vice versa,
400 * or null if none is set.
404 AlignViewportI getCodingComplement();
407 * Sets the viewport which holds the cDna for this (protein), or vice versa.
408 * Implementation should guarantee that the reciprocal relationship is always
409 * set, i.e. each viewport is the complement of the other.
411 void setCodingComplement(AlignViewportI sl);
414 * Answers true if viewport hosts DNA/RNA, else false.
418 boolean isNucleotide();
421 * Returns an id guaranteed to be unique for this viewport.
428 * Return true if view should scroll to show the highlighted region of a
433 boolean isFollowHighlight();
436 * Set whether view should scroll to show the highlighted region of a sequence
438 void setFollowHighlight(boolean b);
441 * configure the feature renderer with predefined feature settings
443 * @param featureSettings
445 public void applyFeaturesStyle(FeatureSettingsModelI featureSettings);
448 * Apply the given feature settings on top of existing feature settings.
450 public void mergeFeaturesStyle(FeatureSettingsModelI featureSettings);
453 * check if current selection group is defined on the view, or is simply a
456 * @return true if group is defined on the alignment
458 boolean isSelectionDefinedGroup();
462 * @return true if there are search results on the view
464 boolean hasSearchResults();
467 * set the search results for the view
470 * - or null to clear current results
472 void setSearchResults(SearchResultsI results);
475 * get search results for this view (if any)
477 * @return search results or null
479 SearchResultsI getSearchResults();
481 ContactListI getContactList(AlignmentAnnotation _aa, int column);
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 TreeModel getCurrentTree();
510 void setCurrentTree(TreeModel tree);
513 * Answers a data bean containing data for export as configured by the
519 AlignmentExportData getAlignExportData(AlignExportSettingsI options);
523 * - set the flag for updating structures on next repaint
525 void setUpdateStructures(boolean update);
529 * @return true if structure views will be updated on next refresh
531 boolean isUpdateStructures();
534 * check if structure views need to be updated, and clear the flag afterwards.
536 * @return if an update is needed
538 boolean needToUpdateStructureViews();
541 * Adds sequencegroup to the alignment in the view. Also adds a group to the
542 * complement view if one is defined.
544 * @param sequenceGroup
545 * - a group defined on sequences in the alignment held by the view
547 void addSequenceGroup(SequenceGroup sequenceGroup);
550 * Returns an interator over the [start, end] column positions of the visible
551 * regions of the alignment
553 * @param selectedRegionOnly
554 * if true, and the view has a selection region, then only the
555 * intersection of visible columns with the selection region is
559 Iterator<int[]> getViewAsVisibleContigs(boolean selectedRegionOnly);
561 IdColumns getIdColumns();
563 ContactMatrixI getContactMatrix(AlignmentAnnotation alignmentAnnotation);