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.schemes.ColourSchemeI;
36 import java.awt.Color;
37 import java.util.Hashtable;
38 import java.util.List;
45 public interface AlignViewportI extends ViewStyleI
51 * calculate the height for visible annotation, revalidating bounds where
52 * necessary ABSTRACT GUI METHOD
54 * @return total height of annotation
56 public int calcPanelHeight();
59 * Answers true if the viewport has at least one column selected
63 boolean hasSelectedColumns();
66 * Answers true if the viewport has at least one hidden column
70 boolean hasHiddenColumns();
72 boolean isValidCharWidth();
74 boolean isShowConsensusHistogram();
76 boolean isShowSequenceLogo();
78 boolean isNormaliseSequenceLogo();
80 ColourSchemeI getGlobalColourScheme();
82 AlignmentI getAlignment();
84 ColumnSelection getColumnSelection();
86 ProfilesI getSequenceConsensusHash();
89 * Get consensus data table for the cDNA complement of this alignment (if any)
93 Hashtable[] getComplementConsensusHash();
95 Hashtable[] getRnaStructureConsensusHash();
97 boolean isIgnoreGapsConsensus();
99 boolean isCalculationInProgress(AlignmentAnnotation alignmentAnnotation);
101 AlignmentAnnotation getAlignmentQualityAnnot();
103 AlignmentAnnotation getAlignmentConservationAnnotation();
106 * get the container for alignment consensus annotation
110 AlignmentAnnotation getAlignmentConsensusAnnotation();
113 * get the container for cDNA complement consensus annotation
117 AlignmentAnnotation getComplementConsensusAnnotation();
120 * Test to see if viewport is still open and active
122 * @return true indicates that all references to viewport should be dropped
127 * Dispose of all references or resources held by the viewport
132 * get the associated calculation thread manager for the view
136 AlignCalcManagerI getCalcManager();
139 * get the percentage gaps allowed in a conservation calculation
142 public int getConsPercGaps();
145 * set the consensus result object for the viewport
149 void setSequenceConsensusHash(ProfilesI hconsensus);
152 * Set the cDNA complement consensus for the viewport
156 void setComplementConsensusHash(Hashtable[] hconsensus);
160 * @return the alignment annotatino row for the structure consensus
163 AlignmentAnnotation getAlignmentStrucConsensusAnnotation();
166 * set the Rna structure consensus result object for the viewport
168 * @param hStrucConsensus
170 void setRnaStructureConsensusHash(Hashtable[] hStrucConsensus);
173 * set global colourscheme
177 void setGlobalColourScheme(ColourSchemeI rhc);
179 Map<SequenceI, SequenceCollectionI> getHiddenRepSequences();
181 void setHiddenRepSequences(
182 Map<SequenceI, SequenceCollectionI> hiddenRepSequences);
185 * hides or shows dynamic annotation rows based on groups and group and
186 * alignment associated auto-annotation state flags apply the current
187 * group/autoannotation settings to the alignment view. Usually you should
188 * call the AlignmentViewPanel.adjustAnnotationHeight() method afterwards to
189 * ensure the annotation panel bounds are set correctly.
191 * @param applyGlobalSettings
192 * - apply to all autoannotation rows or just the ones associated
193 * with the current visible region
194 * @param preserveNewGroupSettings
195 * - don't apply global settings to groups which don't already have
196 * group associated annotation
198 void updateGroupAnnotationSettings(boolean applyGlobalSettings,
199 boolean preserveNewGroupSettings);
201 void setSequenceColour(SequenceI seq, Color col);
203 Color getSequenceColour(SequenceI seq);
205 void updateSequenceIdColours();
207 SequenceGroup getSelectionGroup();
210 * get the currently selected sequence objects or all the sequences in the
211 * alignment. TODO: change to List<>
213 * @return array of references to sequence objects
215 SequenceI[] getSequenceSelection();
217 void clearSequenceColours();
220 * This method returns the visible alignment as text, as seen on the GUI, ie
221 * if columns are hidden they will not be returned in the result. Use this for
222 * calculating trees, PCA, redundancy etc on views which contain hidden
227 CigarArray getViewAsCigars(boolean selectedRegionOnly);
230 * return a compact representation of the current alignment selection to pass
231 * to an analysis function
233 * @param selectedOnly
234 * boolean true to just return the selected view
235 * @return AlignmentView
237 AlignmentView getAlignmentView(boolean selectedOnly);
240 * return a compact representation of the current alignment selection to pass
241 * to an analysis function
243 * @param selectedOnly
244 * boolean true to just return the selected view
246 * boolean true to annotate the alignment view with groups on the
247 * alignment (and intersecting with selected region if selectedOnly
249 * @return AlignmentView
251 AlignmentView getAlignmentView(boolean selectedOnly, boolean markGroups);
254 * This method returns the visible alignment as text, as seen on the GUI, ie
255 * if columns are hidden they will not be returned in the result. Use this for
256 * calculating trees, PCA, redundancy etc on views which contain hidden
257 * columns. This method doesn't exclude hidden sequences from the output.
259 * @param selectedRegionOnly
260 * - determines if only the selected region or entire alignment is
264 String[] getViewAsString(boolean selectedRegionOnly);
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
272 * @param selectedRegionOnly
273 * - determines if only the selected region or entire alignment is
275 * @param isExportHiddenSeqs
276 * - determines if hidden sequences would be exported or not.
280 String[] getViewAsString(boolean selectedRegionOnly,
281 boolean isExportHiddenSeqs);
283 void setSelectionGroup(SequenceGroup sg);
285 char getGapCharacter();
287 void setColumnSelection(ColumnSelection cs);
289 void setConservation(Conservation cons);
292 * get a copy of the currently visible alignment annotation
294 * @param selectedOnly
295 * if true - trim to selected regions on the alignment
296 * @return an empty list or new alignment annotation objects shown only
297 * visible columns trimmed to selected region only
299 List<AlignmentAnnotation> getVisibleAlignmentAnnotation(
300 boolean selectedOnly);
302 FeaturesDisplayedI getFeaturesDisplayed();
304 String getSequenceSetId();
306 boolean areFeaturesDisplayed();
308 void setFeaturesDisplayed(FeaturesDisplayedI featuresDisplayedI);
310 void alignmentChanged(AlignmentViewPanel ap);
313 * @return the padGaps
321 void setPadGaps(boolean padGaps);
324 * return visible region boundaries within given column range
327 * first column (inclusive, from 0)
329 * last column (exclusive)
330 * @return int[][] range of {start,end} visible positions
332 List<int[]> getVisibleRegionBoundaries(int min, int max);
335 * This method returns an array of new SequenceI objects derived from the
336 * whole alignment or just the current selection with start and end points
339 * @note if you need references to the actual SequenceI objects in the
340 * alignment or currently selected then use getSequenceSelection()
341 * @return selection as new sequenceI objects
343 SequenceI[] getSelectionAsNewSequence();
345 void invertColumnSelection();
348 * broadcast selection to any interested parties
350 void sendSelection();
353 * calculate the row position for alignmentIndex if all hidden sequences were
356 * @param alignmentIndex
357 * @return adjusted row position
359 int adjustForHiddenSeqs(int alignmentIndex);
361 boolean hasHiddenRows();
365 * @return a copy of this view's current display settings
367 public ViewStyleI getViewStyle();
370 * update the view's display settings with the given style set
372 * @param settingsForView
374 public void setViewStyle(ViewStyleI settingsForView);
377 * Returns a viewport which holds the cDna for this (protein), or vice versa,
378 * or null if none is set.
382 AlignViewportI getCodingComplement();
385 * Sets the viewport which holds the cDna for this (protein), or vice versa.
386 * Implementation should guarantee that the reciprocal relationship is always
387 * set, i.e. each viewport is the complement of the other.
389 void setCodingComplement(AlignViewportI sl);
392 * Answers true if viewport hosts DNA/RNA, else false.
396 boolean isNucleotide();
399 * Returns an id guaranteed to be unique for this viewport.
406 * Return true if view should scroll to show the highlighted region of a
411 boolean isFollowHighlight();
414 * Set whether view should scroll to show the highlighted region of a sequence
416 void setFollowHighlight(boolean b);
418 public void applyFeaturesStyle(FeatureSettingsModelI featureSettings);
421 * check if current selection group is defined on the view, or is simply a
424 * @return true if group is defined on the alignment
426 boolean isSelectionDefinedGroup();
430 * @return true if there are search results on the view
432 boolean hasSearchResults();
435 * set the search results for the view
438 * - or null to clear current results
440 void setSearchResults(SearchResultsI results);
443 * get search results for this view (if any)
445 * @return search results or null
447 SearchResultsI getSearchResults();