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;
37 import java.awt.Color;
38 import java.util.Hashtable;
39 import java.util.List;
46 public interface AlignViewportI extends ViewStyleI
54 * calculate the height for visible annotation, revalidating bounds where
55 * necessary ABSTRACT GUI METHOD
57 * @return total height of annotation
59 public int calcPanelHeight();
62 * Answers true if the viewport has at least one column selected
66 boolean hasSelectedColumns();
69 * Answers true if the viewport has at least one hidden column
73 boolean hasHiddenColumns();
75 boolean isValidCharWidth();
77 boolean isShowConsensusHistogram();
79 boolean isShowSequenceLogo();
81 boolean isNormaliseSequenceLogo();
83 ColourSchemeI getGlobalColourScheme();
86 * Returns an object that describes colouring (including any thresholding or
87 * fading) of the alignment
91 ResidueShaderI getResidueShading();
93 AlignmentI getAlignment();
95 ColumnSelection getColumnSelection();
97 ProfilesI getSequenceConsensusHash();
100 * Get consensus data table for the cDNA complement of this alignment (if any)
104 Hashtable[] getComplementConsensusHash();
106 Hashtable[] getRnaStructureConsensusHash();
108 boolean isIgnoreGapsConsensus();
110 boolean isCalculationInProgress(AlignmentAnnotation alignmentAnnotation);
112 AlignmentAnnotation getAlignmentQualityAnnot();
114 AlignmentAnnotation getAlignmentConservationAnnotation();
117 * get the container for alignment consensus annotation
121 AlignmentAnnotation getAlignmentConsensusAnnotation();
124 * get the container for cDNA complement consensus annotation
128 AlignmentAnnotation getComplementConsensusAnnotation();
131 * Test to see if viewport is still open and active
133 * @return true indicates that all references to viewport should be dropped
138 * Dispose of all references or resources held by the viewport
143 * get the associated calculation thread manager for the view
147 AlignCalcManagerI getCalcManager();
150 * get the percentage gaps allowed in a conservation calculation
153 public int getConsPercGaps();
156 * set the consensus result object for the viewport
160 void setSequenceConsensusHash(ProfilesI hconsensus);
163 * Set the cDNA complement consensus for the viewport
167 void setComplementConsensusHash(Hashtable[] hconsensus);
171 * @return the alignment annotation row for the structure consensus
174 AlignmentAnnotation getAlignmentStrucConsensusAnnotation();
177 * set the Rna structure consensus result object for the viewport
179 * @param hStrucConsensus
181 void setRnaStructureConsensusHash(Hashtable[] hStrucConsensus);
184 * Sets the colour scheme for the background alignment (as distinct from
185 * sub-groups, which may have their own colour schemes). A null value is used
186 * for no residue colour (white).
190 void setGlobalColourScheme(ColourSchemeI cs);
192 Map<SequenceI, SequenceCollectionI> getHiddenRepSequences();
194 void setHiddenRepSequences(
195 Map<SequenceI, SequenceCollectionI> hiddenRepSequences);
198 * hides or shows dynamic annotation rows based on groups and group and
199 * alignment associated auto-annotation state flags apply the current
200 * group/autoannotation settings to the alignment view. Usually you should
201 * call the AlignmentViewPanel.adjustAnnotationHeight() method afterwards to
202 * ensure the annotation panel bounds are set correctly.
204 * @param applyGlobalSettings
205 * - apply to all autoannotation rows or just the ones associated
206 * with the current visible region
207 * @param preserveNewGroupSettings
208 * - don't apply global settings to groups which don't already have
209 * group associated annotation
211 void updateGroupAnnotationSettings(boolean applyGlobalSettings,
212 boolean preserveNewGroupSettings);
214 void setSequenceColour(SequenceI seq, Color col);
216 Color getSequenceColour(SequenceI seq);
218 void updateSequenceIdColours();
220 SequenceGroup getSelectionGroup();
223 * get the currently selected sequence objects or all the sequences in the
224 * alignment. TODO: change to List<>
226 * @return array of references to sequence objects
228 SequenceI[] getSequenceSelection();
230 void clearSequenceColours();
233 * This method returns the visible alignment as text, as seen on the GUI, ie
234 * if columns are hidden they will not be returned in the result. Use this for
235 * calculating trees, PCA, redundancy etc on views which contain hidden
240 CigarArray getViewAsCigars(boolean selectedRegionOnly);
243 * return a compact representation of the current alignment selection to pass
244 * to an analysis function
246 * @param selectedOnly
247 * boolean true to just return the selected view
248 * @return AlignmentView
250 AlignmentView getAlignmentView(boolean selectedOnly);
253 * return a compact representation of the current alignment selection to pass
254 * to an analysis function
256 * @param selectedOnly
257 * boolean true to just return the selected view
259 * boolean true to annotate the alignment view with groups on the
260 * alignment (and intersecting with selected region if selectedOnly
262 * @return AlignmentView
264 AlignmentView getAlignmentView(boolean selectedOnly, boolean markGroups);
267 * This method returns the visible alignment as text, as seen on the GUI, ie
268 * if columns are hidden they will not be returned in the result. Use this for
269 * calculating trees, PCA, redundancy etc on views which contain hidden
270 * columns. This method doesn't exclude hidden sequences from the output.
272 * @param selectedRegionOnly
273 * - determines if only the selected region or entire alignment is
277 String[] getViewAsString(boolean selectedRegionOnly);
280 * This method returns the visible alignment as text, as seen on the GUI, ie
281 * if columns are hidden they will not be returned in the result. Use this for
282 * calculating trees, PCA, redundancy etc on views which contain hidden
285 * @param selectedRegionOnly
286 * - determines if only the selected region or entire alignment is
288 * @param isExportHiddenSeqs
289 * - determines if hidden sequences would be exported or not.
293 String[] getViewAsString(boolean selectedRegionOnly,
294 boolean isExportHiddenSeqs);
296 void setSelectionGroup(SequenceGroup sg);
298 char getGapCharacter();
300 void setColumnSelection(ColumnSelection cs);
302 void setConservation(Conservation cons);
305 * get a copy of the currently visible alignment annotation
307 * @param selectedOnly
308 * if true - trim to selected regions on the alignment
309 * @return an empty list or new alignment annotation objects shown only
310 * visible columns trimmed to selected region only
312 List<AlignmentAnnotation> getVisibleAlignmentAnnotation(
313 boolean selectedOnly);
315 FeaturesDisplayedI getFeaturesDisplayed();
317 String getSequenceSetId();
319 boolean areFeaturesDisplayed();
321 void setFeaturesDisplayed(FeaturesDisplayedI featuresDisplayedI);
323 void alignmentChanged(AlignmentViewPanel ap);
326 * @return the padGaps
334 void setPadGaps(boolean padGaps);
337 * return visible region boundaries within given column range
340 * first column (inclusive, from 0)
342 * last column (exclusive)
343 * @return int[][] range of {start,end} visible positions
345 List<int[]> getVisibleRegionBoundaries(int min, int max);
348 * This method returns an array of new SequenceI objects derived from the
349 * whole alignment or just the current selection with start and end points
352 * @note if you need references to the actual SequenceI objects in the
353 * alignment or currently selected then use getSequenceSelection()
354 * @return selection as new sequenceI objects
356 SequenceI[] getSelectionAsNewSequence();
358 void invertColumnSelection();
361 * broadcast selection to any interested parties
363 void sendSelection();
366 * calculate the row position for alignmentIndex if all hidden sequences were
369 * @param alignmentIndex
370 * @return adjusted row position
372 int adjustForHiddenSeqs(int alignmentIndex);
374 boolean hasHiddenRows();
378 * @return a copy of this view's current display settings
380 public ViewStyleI getViewStyle();
383 * update the view's display settings with the given style set
385 * @param settingsForView
387 public void setViewStyle(ViewStyleI settingsForView);
390 * Returns a viewport which holds the cDna for this (protein), or vice versa,
391 * or null if none is set.
395 AlignViewportI getCodingComplement();
398 * Sets the viewport which holds the cDna for this (protein), or vice versa.
399 * Implementation should guarantee that the reciprocal relationship is always
400 * set, i.e. each viewport is the complement of the other.
402 void setCodingComplement(AlignViewportI sl);
405 * Answers true if viewport hosts DNA/RNA, else false.
409 boolean isNucleotide();
412 * Returns an id guaranteed to be unique for this viewport.
419 * Return true if view should scroll to show the highlighted region of a
424 boolean isFollowHighlight();
427 * Set whether view should scroll to show the highlighted region of a sequence
429 void setFollowHighlight(boolean b);
431 public void applyFeaturesStyle(FeatureSettingsModelI featureSettings);
434 * check if current selection group is defined on the view, or is simply a
437 * @return true if group is defined on the alignment
439 boolean isSelectionDefinedGroup();
443 * @return true if there are search results on the view
445 boolean hasSearchResults();
448 * set the search results for the view
451 * - or null to clear current results
453 void setSearchResults(SearchResultsI results);
456 * get search results for this view (if any)
458 * @return search results or null
460 SearchResultsI getSearchResults();