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.ContactListI;
30 import jalview.datamodel.ProfilesI;
31 import jalview.datamodel.SearchResultsI;
32 import jalview.datamodel.SequenceCollectionI;
33 import jalview.datamodel.SequenceGroup;
34 import jalview.datamodel.SequenceI;
35 import jalview.renderer.ResidueShaderI;
36 import jalview.schemes.ColourSchemeI;
38 import java.awt.Color;
39 import java.util.Hashtable;
40 import java.util.List;
47 public interface AlignViewportI extends ViewStyleI
53 * calculate the height for visible annotation, revalidating bounds where
54 * necessary ABSTRACT GUI METHOD
56 * @return total height of annotation
58 public int calcPanelHeight();
61 * Answers true if the viewport has at least one column selected
65 boolean hasSelectedColumns();
68 * Answers true if the viewport has at least one hidden column
72 boolean hasHiddenColumns();
74 boolean isValidCharWidth();
76 boolean isShowConsensusHistogram();
78 boolean isShowSequenceLogo();
80 boolean isNormaliseSequenceLogo();
82 ColourSchemeI getGlobalColourScheme();
85 * Returns an object that describes colouring (including any thresholding or
86 * fading) of the alignment
90 ResidueShaderI getResidueShading();
92 AlignmentI getAlignment();
94 ColumnSelection getColumnSelection();
96 ProfilesI getSequenceConsensusHash();
99 * Get consensus data table for the cDNA complement of this alignment (if any)
103 Hashtable[] getComplementConsensusHash();
105 Hashtable[] getRnaStructureConsensusHash();
107 boolean isIgnoreGapsConsensus();
109 boolean isCalculationInProgress(AlignmentAnnotation alignmentAnnotation);
111 AlignmentAnnotation getAlignmentQualityAnnot();
113 AlignmentAnnotation getAlignmentConservationAnnotation();
116 * get the container for alignment consensus annotation
120 AlignmentAnnotation getAlignmentConsensusAnnotation();
123 * get the container for cDNA complement consensus annotation
127 AlignmentAnnotation getComplementConsensusAnnotation();
130 * Test to see if viewport is still open and active
132 * @return true indicates that all references to viewport should be dropped
137 * Dispose of all references or resources held by the viewport
142 * get the associated calculation thread manager for the view
146 AlignCalcManagerI getCalcManager();
149 * get the percentage gaps allowed in a conservation calculation
152 public int getConsPercGaps();
155 * set the consensus result object for the viewport
159 void setSequenceConsensusHash(ProfilesI hconsensus);
162 * Set the cDNA complement consensus for the viewport
166 void setComplementConsensusHash(Hashtable[] hconsensus);
170 * @return the alignment annotation row for the structure consensus
173 AlignmentAnnotation getAlignmentStrucConsensusAnnotation();
176 * set the Rna structure consensus result object for the viewport
178 * @param hStrucConsensus
180 void setRnaStructureConsensusHash(Hashtable[] hStrucConsensus);
183 * Sets the colour scheme for the background alignment (as distinct from
184 * sub-groups, which may have their own colour schemes). A null value is used
185 * for no residue colour (white).
189 void setGlobalColourScheme(ColourSchemeI cs);
191 Map<SequenceI, SequenceCollectionI> getHiddenRepSequences();
193 void setHiddenRepSequences(
194 Map<SequenceI, SequenceCollectionI> hiddenRepSequences);
197 * hides or shows dynamic annotation rows based on groups and group and
198 * alignment associated auto-annotation state flags apply the current
199 * group/autoannotation settings to the alignment view. Usually you should
200 * call the AlignmentViewPanel.adjustAnnotationHeight() method afterwards to
201 * ensure the annotation panel bounds are set correctly.
203 * @param applyGlobalSettings
204 * - apply to all autoannotation rows or just the ones associated
205 * with the current visible region
206 * @param preserveNewGroupSettings
207 * - don't apply global settings to groups which don't already have
208 * group associated annotation
210 void updateGroupAnnotationSettings(boolean applyGlobalSettings,
211 boolean preserveNewGroupSettings);
213 void setSequenceColour(SequenceI seq, Color col);
215 Color getSequenceColour(SequenceI seq);
217 void updateSequenceIdColours();
219 SequenceGroup getSelectionGroup();
222 * get the currently selected sequence objects or all the sequences in the
223 * alignment. TODO: change to List<>
225 * @return array of references to sequence objects
227 SequenceI[] getSequenceSelection();
229 void clearSequenceColours();
232 * This method returns the visible alignment as text, as seen on the GUI, ie
233 * if columns are hidden they will not be returned in the result. Use this for
234 * calculating trees, PCA, redundancy etc on views which contain hidden
239 CigarArray getViewAsCigars(boolean selectedRegionOnly);
242 * return a compact representation of the current alignment selection to pass
243 * to an analysis function
245 * @param selectedOnly
246 * boolean true to just return the selected view
247 * @return AlignmentView
249 AlignmentView getAlignmentView(boolean selectedOnly);
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
258 * boolean true to annotate the alignment view with groups on the
259 * alignment (and intersecting with selected region if selectedOnly
261 * @return AlignmentView
263 AlignmentView getAlignmentView(boolean selectedOnly, boolean markGroups);
266 * This method returns the visible alignment as text, as seen on the GUI, ie
267 * if columns are hidden they will not be returned in the result. Use this for
268 * calculating trees, PCA, redundancy etc on views which contain hidden
269 * columns. This method doesn't exclude hidden sequences from the output.
271 * @param selectedRegionOnly
272 * - determines if only the selected region or entire alignment is
276 String[] getViewAsString(boolean selectedRegionOnly);
279 * This method returns the visible alignment as text, as seen on the GUI, ie
280 * if columns are hidden they will not be returned in the result. Use this for
281 * calculating trees, PCA, redundancy etc on views which contain hidden
284 * @param selectedRegionOnly
285 * - determines if only the selected region or entire alignment is
287 * @param isExportHiddenSeqs
288 * - determines if hidden sequences would be exported or not.
292 String[] getViewAsString(boolean selectedRegionOnly,
293 boolean isExportHiddenSeqs);
295 void setSelectionGroup(SequenceGroup sg);
297 char getGapCharacter();
299 void setColumnSelection(ColumnSelection cs);
301 void setConservation(Conservation cons);
304 * get a copy of the currently visible alignment annotation
306 * @param selectedOnly
307 * if true - trim to selected regions on the alignment
308 * @return an empty list or new alignment annotation objects shown only
309 * visible columns trimmed to selected region only
311 List<AlignmentAnnotation> getVisibleAlignmentAnnotation(
312 boolean selectedOnly);
314 FeaturesDisplayedI getFeaturesDisplayed();
316 String getSequenceSetId();
318 boolean areFeaturesDisplayed();
320 void setFeaturesDisplayed(FeaturesDisplayedI featuresDisplayedI);
322 void alignmentChanged(AlignmentViewPanel ap);
325 * @return the padGaps
333 void setPadGaps(boolean padGaps);
336 * return visible region boundaries within given column range
339 * first column (inclusive, from 0)
341 * last column (exclusive)
342 * @return int[][] range of {start,end} visible positions
344 List<int[]> getVisibleRegionBoundaries(int min, int max);
347 * This method returns an array of new SequenceI objects derived from the
348 * whole alignment or just the current selection with start and end points
351 * @note if you need references to the actual SequenceI objects in the
352 * alignment or currently selected then use getSequenceSelection()
353 * @return selection as new sequenceI objects
355 SequenceI[] getSelectionAsNewSequence();
357 void invertColumnSelection();
360 * broadcast selection to any interested parties
362 void sendSelection();
365 * calculate the row position for alignmentIndex if all hidden sequences were
368 * @param alignmentIndex
369 * @return adjusted row position
371 int adjustForHiddenSeqs(int alignmentIndex);
373 boolean hasHiddenRows();
377 * @return a copy of this view's current display settings
379 public ViewStyleI getViewStyle();
382 * update the view's display settings with the given style set
384 * @param settingsForView
386 public void setViewStyle(ViewStyleI settingsForView);
389 * Returns a viewport which holds the cDna for this (protein), or vice versa,
390 * or null if none is set.
394 AlignViewportI getCodingComplement();
397 * Sets the viewport which holds the cDna for this (protein), or vice versa.
398 * Implementation should guarantee that the reciprocal relationship is always
399 * set, i.e. each viewport is the complement of the other.
401 void setCodingComplement(AlignViewportI sl);
404 * Answers true if viewport hosts DNA/RNA, else false.
408 boolean isNucleotide();
411 * Returns an id guaranteed to be unique for this viewport.
418 * Return true if view should scroll to show the highlighted region of a
423 boolean isFollowHighlight();
426 * Set whether view should scroll to show the highlighted region of a sequence
428 void setFollowHighlight(boolean b);
430 public void applyFeaturesStyle(FeatureSettingsModelI featureSettings);
433 * check if current selection group is defined on the view, or is simply a
436 * @return true if group is defined on the alignment
438 boolean isSelectionDefinedGroup();
442 * @return true if there are search results on the view
444 boolean hasSearchResults();
447 * set the search results for the view
450 * - or null to clear current results
452 void setSearchResults(SearchResultsI results);
455 * get search results for this view (if any)
457 * @return search results or null
459 SearchResultsI getSearchResults();
461 ContactListI getContactList(AlignmentAnnotation _aa, int column);