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.schemes.ColourSchemeI;
37 import java.awt.Color;
38 import java.util.Hashtable;
39 import java.util.List;
46 public interface AlignViewportI extends ViewStyleI
52 * calculate the height for visible annotation, revalidating bounds where
53 * necessary ABSTRACT GUI METHOD
55 * @return total height of annotation
57 public int calcPanelHeight();
60 * Answers true if the viewport has at least one column selected
64 boolean hasSelectedColumns();
67 * Answers true if the viewport has at least one hidden column
71 boolean hasHiddenColumns();
73 boolean isValidCharWidth();
75 boolean isShowConsensusHistogram();
77 boolean isShowSequenceLogo();
79 boolean isNormaliseSequenceLogo();
81 ColourSchemeI getGlobalColourScheme();
83 AlignmentI getAlignment();
85 ColumnSelection getColumnSelection();
87 ProfilesI getSequenceConsensusHash();
90 * Get consensus data table for the cDNA complement of this alignment (if any)
94 Hashtable[] getComplementConsensusHash();
96 Hashtable[] getRnaStructureConsensusHash();
98 boolean isIgnoreGapsConsensus();
100 boolean isCalculationInProgress(AlignmentAnnotation alignmentAnnotation);
102 AlignmentAnnotation getAlignmentQualityAnnot();
104 AlignmentAnnotation getAlignmentConservationAnnotation();
107 * get the container for alignment consensus annotation
111 AlignmentAnnotation getAlignmentConsensusAnnotation();
114 * get the container for cDNA complement consensus annotation
118 AlignmentAnnotation getComplementConsensusAnnotation();
121 * Test to see if viewport is still open and active
123 * @return true indicates that all references to viewport should be dropped
128 * Dispose of all references or resources held by the viewport
133 * get the associated calculation thread manager for the view
137 AlignCalcManagerI getCalcManager();
140 * get the percentage gaps allowed in a conservation calculation
143 public int getConsPercGaps();
146 * set the consensus result object for the viewport
150 void setSequenceConsensusHash(ProfilesI hconsensus);
153 * Set the cDNA complement consensus for the viewport
157 void setComplementConsensusHash(Hashtable[] hconsensus);
161 * @return the alignment annotatino row for the structure consensus
164 AlignmentAnnotation getAlignmentStrucConsensusAnnotation();
167 * set the Rna structure consensus result object for the viewport
169 * @param hStrucConsensus
171 void setRnaStructureConsensusHash(Hashtable[] hStrucConsensus);
174 * set global colourscheme
178 void setGlobalColourScheme(ColourSchemeI rhc);
180 Map<SequenceI, SequenceCollectionI> getHiddenRepSequences();
182 void setHiddenRepSequences(
183 Map<SequenceI, SequenceCollectionI> hiddenRepSequences);
186 * hides or shows dynamic annotation rows based on groups and group and
187 * alignment associated auto-annotation state flags apply the current
188 * group/autoannotation settings to the alignment view. Usually you should
189 * call the AlignmentViewPanel.adjustAnnotationHeight() method afterwards to
190 * ensure the annotation panel bounds are set correctly.
192 * @param applyGlobalSettings
193 * - apply to all autoannotation rows or just the ones associated
194 * with the current visible region
195 * @param preserveNewGroupSettings
196 * - don't apply global settings to groups which don't already have
197 * group associated annotation
199 void updateGroupAnnotationSettings(boolean applyGlobalSettings,
200 boolean preserveNewGroupSettings);
202 void setSequenceColour(SequenceI seq, Color col);
204 Color getSequenceColour(SequenceI seq);
206 void updateSequenceIdColours();
208 SequenceGroup getSelectionGroup();
211 * get the currently selected sequence objects or all the sequences in the
212 * alignment. TODO: change to List<>
214 * @return array of references to sequence objects
216 SequenceI[] getSequenceSelection();
218 void clearSequenceColours();
221 * This method returns the visible alignment as text, as seen on the GUI, ie
222 * if columns are hidden they will not be returned in the result. Use this for
223 * calculating trees, PCA, redundancy etc on views which contain hidden
228 CigarArray getViewAsCigars(boolean selectedRegionOnly);
231 * return a compact representation of the current alignment selection to pass
232 * to an analysis function
234 * @param selectedOnly
235 * boolean true to just return the selected view
236 * @return AlignmentView
238 AlignmentView getAlignmentView(boolean selectedOnly);
241 * return a compact representation of the current alignment selection to pass
242 * to an analysis function
244 * @param selectedOnly
245 * boolean true to just return the selected view
247 * boolean true to annotate the alignment view with groups on the
248 * alignment (and intersecting with selected region if selectedOnly
250 * @return AlignmentView
252 AlignmentView getAlignmentView(boolean selectedOnly, boolean markGroups);
255 * This method returns the visible alignment as text, as seen on the GUI, ie
256 * if columns are hidden they will not be returned in the result. Use this for
257 * calculating trees, PCA, redundancy etc on views which contain hidden
258 * columns. This method doesn't exclude hidden sequences from the output.
260 * @param selectedRegionOnly
261 * - determines if only the selected region or entire alignment is
265 String[] getViewAsString(boolean selectedRegionOnly);
268 * This method returns the visible alignment as text, as seen on the GUI, ie
269 * if columns are hidden they will not be returned in the result. Use this for
270 * calculating trees, PCA, redundancy etc on views which contain hidden
273 * @param selectedRegionOnly
274 * - determines if only the selected region or entire alignment is
276 * @param isExportHiddenSeqs
277 * - determines if hidden sequences would be exported or not.
281 String[] getViewAsString(boolean selectedRegionOnly,
282 boolean isExportHiddenSeqs);
284 void setSelectionGroup(SequenceGroup sg);
286 char getGapCharacter();
288 void setColumnSelection(ColumnSelection cs);
290 void setConservation(Conservation cons);
293 * get a copy of the currently visible alignment annotation
295 * @param selectedOnly
296 * if true - trim to selected regions on the alignment
297 * @return an empty list or new alignment annotation objects shown only
298 * visible columns trimmed to selected region only
300 List<AlignmentAnnotation> getVisibleAlignmentAnnotation(
301 boolean selectedOnly);
303 FeaturesDisplayedI getFeaturesDisplayed();
305 String getSequenceSetId();
307 boolean areFeaturesDisplayed();
309 void setFeaturesDisplayed(FeaturesDisplayedI featuresDisplayedI);
311 void alignmentChanged(AlignmentViewPanel ap);
314 * @return the padGaps
322 void setPadGaps(boolean padGaps);
325 * return visible region boundaries within given column range
328 * first column (inclusive, from 0)
330 * last column (exclusive)
331 * @return int[][] range of {start,end} visible positions
333 List<int[]> getVisibleRegionBoundaries(int min, int max);
336 * This method returns an array of new SequenceI objects derived from the
337 * whole alignment or just the current selection with start and end points
340 * @note if you need references to the actual SequenceI objects in the
341 * alignment or currently selected then use getSequenceSelection()
342 * @return selection as new sequenceI objects
344 SequenceI[] getSelectionAsNewSequence();
346 void invertColumnSelection();
349 * broadcast selection to any interested parties
351 void sendSelection();
354 * calculate the row position for alignmentIndex if all hidden sequences were
357 * @param alignmentIndex
358 * @return adjusted row position
360 int adjustForHiddenSeqs(int alignmentIndex);
362 boolean hasHiddenRows();
366 * @return a copy of this view's current display settings
368 public ViewStyleI getViewStyle();
371 * update the view's display settings with the given style set
373 * @param settingsForView
375 public void setViewStyle(ViewStyleI settingsForView);
378 * Returns a viewport which holds the cDna for this (protein), or vice versa,
379 * or null if none is set.
383 AlignViewportI getCodingComplement();
386 * Sets the viewport which holds the cDna for this (protein), or vice versa.
387 * Implementation should guarantee that the reciprocal relationship is always
388 * set, i.e. each viewport is the complement of the other.
390 void setCodingComplement(AlignViewportI sl);
393 * Answers true if viewport hosts DNA/RNA, else false.
397 boolean isNucleotide();
400 * Returns an id guaranteed to be unique for this viewport.
407 * Return true if view should scroll to show the highlighted region of a
412 boolean isFollowHighlight();
415 * Set whether view should scroll to show the highlighted region of a sequence
417 void setFollowHighlight(boolean b);
419 public void applyFeaturesStyle(FeatureSettingsModelI featureSettings);
422 * check if current selection group is defined on the view, or is simply a
425 * @return true if group is defined on the alignment
427 boolean isSelectionDefinedGroup();
431 * @return true if there are search results on the view
433 boolean hasSearchResults();
436 * set the search results for the view
439 * - or null to clear current results
441 void setSearchResults(SearchResultsI results);
444 * get search results for this view (if any)
446 * @return search results or null
448 SearchResultsI getSearchResults();
450 ContactListI getContactList(AlignmentAnnotation _aa, int column);