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.analysis.Profile;
25 import jalview.datamodel.AlignmentAnnotation;
26 import jalview.datamodel.AlignmentI;
27 import jalview.datamodel.AlignmentView;
28 import jalview.datamodel.CigarArray;
29 import jalview.datamodel.ColumnSelection;
30 import jalview.datamodel.SequenceCollectionI;
31 import jalview.datamodel.SequenceGroup;
32 import jalview.datamodel.SequenceI;
33 import jalview.schemes.ColourSchemeI;
35 import java.awt.Color;
36 import java.util.Hashtable;
37 import java.util.List;
44 public interface AlignViewportI extends ViewStyleI
50 * calculate the height for visible annotation, revalidating bounds where
51 * necessary ABSTRACT GUI METHOD
53 * @return total height of annotation
55 public int calcPanelHeight();
58 * Answers true if the viewport has at least one column selected
62 boolean hasSelectedColumns();
65 * Answers true if the viewport has at least one hidden column
69 boolean hasHiddenColumns();
71 boolean isValidCharWidth();
73 boolean isShowConsensusHistogram();
75 boolean isShowSequenceLogo();
77 boolean isNormaliseSequenceLogo();
79 ColourSchemeI getGlobalColourScheme();
81 AlignmentI getAlignment();
83 ColumnSelection getColumnSelection();
85 Profile[] getSequenceConsensusHash();
88 * Get consensus data table for the cDNA complement of this alignment (if any)
92 Hashtable[] getComplementConsensusHash();
94 Hashtable[] getRnaStructureConsensusHash();
96 boolean isIgnoreGapsConsensus();
98 boolean isCalculationInProgress(AlignmentAnnotation alignmentAnnotation);
100 AlignmentAnnotation getAlignmentQualityAnnot();
102 AlignmentAnnotation getAlignmentConservationAnnotation();
105 * get the container for alignment consensus annotation
109 AlignmentAnnotation getAlignmentConsensusAnnotation();
112 * get the container for cDNA complement consensus annotation
116 AlignmentAnnotation getComplementConsensusAnnotation();
119 * Test to see if viewport is still open and active
121 * @return true indicates that all references to viewport should be dropped
126 * Dispose of all references or resources held by the viewport
131 * get the associated calculation thread manager for the view
135 AlignCalcManagerI getCalcManager();
138 * get the percentage gaps allowed in a conservation calculation
141 public int getConsPercGaps();
144 * set the consensus result object for the viewport
148 void setSequenceConsensusHash(Profile[] hconsensus);
151 * Set the cDNA complement consensus for the viewport
155 void setComplementConsensusHash(Hashtable[] hconsensus);
159 * @return the alignment annotatino row for the structure consensus
162 AlignmentAnnotation getAlignmentStrucConsensusAnnotation();
165 * set the Rna structure consensus result object for the viewport
167 * @param hStrucConsensus
169 void setRnaStructureConsensusHash(Hashtable[] hStrucConsensus);
172 * set global colourscheme
176 void setGlobalColourScheme(ColourSchemeI rhc);
178 Map<SequenceI, SequenceCollectionI> getHiddenRepSequences();
180 void setHiddenRepSequences(
181 Map<SequenceI, SequenceCollectionI> hiddenRepSequences);
184 * hides or shows dynamic annotation rows based on groups and group and
185 * alignment associated auto-annotation state flags apply the current
186 * group/autoannotation settings to the alignment view. Usually you should
187 * call the AlignmentViewPanel.adjustAnnotationHeight() method afterwards to
188 * ensure the annotation panel bounds are set correctly.
190 * @param applyGlobalSettings
191 * - apply to all autoannotation rows or just the ones associated
192 * with the current visible region
193 * @param preserveNewGroupSettings
194 * - don't apply global settings to groups which don't already have
195 * group associated annotation
197 void updateGroupAnnotationSettings(boolean applyGlobalSettings,
198 boolean preserveNewGroupSettings);
200 void setSequenceColour(SequenceI seq, Color col);
202 Color getSequenceColour(SequenceI seq);
204 void updateSequenceIdColours();
206 SequenceGroup getSelectionGroup();
209 * get the currently selected sequence objects or all the sequences in the
210 * alignment. TODO: change to List<>
212 * @return array of references to sequence objects
214 SequenceI[] getSequenceSelection();
216 void clearSequenceColours();
219 * This method returns the visible alignment as text, as seen on the GUI, ie
220 * if columns are hidden they will not be returned in the result. Use this for
221 * calculating trees, PCA, redundancy etc on views which contain hidden
226 CigarArray getViewAsCigars(boolean selectedRegionOnly);
229 * return a compact representation of the current alignment selection to pass
230 * to an analysis function
232 * @param selectedOnly
233 * boolean true to just return the selected view
234 * @return AlignmentView
236 AlignmentView getAlignmentView(boolean selectedOnly);
239 * return a compact representation of the current alignment selection to pass
240 * to an analysis function
242 * @param selectedOnly
243 * boolean true to just return the selected view
245 * boolean true to annotate the alignment view with groups on the
246 * alignment (and intersecting with selected region if selectedOnly
248 * @return AlignmentView
250 AlignmentView getAlignmentView(boolean selectedOnly, boolean markGroups);
253 * This method returns the visible alignment as text, as seen on the GUI, ie
254 * if columns are hidden they will not be returned in the result. Use this for
255 * calculating trees, PCA, redundancy etc on views which contain hidden
256 * columns. This method doesn't exclude hidden sequences from the output.
258 * @param selectedRegionOnly
259 * - determines if only the selected region or entire alignment is
263 String[] getViewAsString(boolean selectedRegionOnly);
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
271 * @param selectedRegionOnly
272 * - determines if only the selected region or entire alignment is
274 * @param isExportHiddenSeqs
275 * - determines if hidden sequences would be exported or not.
279 String[] getViewAsString(boolean selectedRegionOnly,
280 boolean isExportHiddenSeqs);
282 void setSelectionGroup(SequenceGroup sg);
284 char getGapCharacter();
286 void setColumnSelection(ColumnSelection cs);
288 void setConservation(Conservation cons);
291 * get a copy of the currently visible alignment annotation
293 * @param selectedOnly
294 * if true - trim to selected regions on the alignment
295 * @return an empty list or new alignment annotation objects shown only
296 * visible columns trimmed to selected region only
298 List<AlignmentAnnotation> getVisibleAlignmentAnnotation(
299 boolean selectedOnly);
301 FeaturesDisplayedI getFeaturesDisplayed();
303 String getSequenceSetId();
305 boolean areFeaturesDisplayed();
307 void setFeaturesDisplayed(FeaturesDisplayedI featuresDisplayedI);
309 void alignmentChanged(AlignmentViewPanel ap);
312 * @return the padGaps
320 void setPadGaps(boolean padGaps);
323 * return visible region boundaries within given column range
326 * first column (inclusive, from 0)
328 * last column (exclusive)
329 * @return int[][] range of {start,end} visible positions
331 List<int[]> getVisibleRegionBoundaries(int min, int max);
334 * This method returns an array of new SequenceI objects derived from the
335 * whole alignment or just the current selection with start and end points
338 * @note if you need references to the actual SequenceI objects in the
339 * alignment or currently selected then use getSequenceSelection()
340 * @return selection as new sequenceI objects
342 SequenceI[] getSelectionAsNewSequence();
344 void invertColumnSelection();
347 * broadcast selection to any interested parties
349 void sendSelection();
352 * calculate the row position for alignmentIndex if all hidden sequences were
355 * @param alignmentIndex
356 * @return adjusted row position
358 int adjustForHiddenSeqs(int alignmentIndex);
360 boolean hasHiddenRows();
364 * @return a copy of this view's current display settings
366 public ViewStyleI getViewStyle();
369 * update the view's display settings with the given style set
371 * @param settingsForView
373 public void setViewStyle(ViewStyleI settingsForView);
376 * Returns a viewport which holds the cDna for this (protein), or vice versa,
377 * or null if none is set.
381 AlignViewportI getCodingComplement();
384 * Sets the viewport which holds the cDna for this (protein), or vice versa.
385 * Implementation should guarantee that the reciprocal relationship is always
386 * set, i.e. each viewport is the complement of the other.
388 void setCodingComplement(AlignViewportI sl);
391 * Answers true if viewport hosts DNA/RNA, else false.
395 boolean isNucleotide();
398 * Returns an id guaranteed to be unique for this viewport.
405 * Return true if view should scroll to show the highlighted region of a
410 boolean isFollowHighlight();
413 * Set whether view should scroll to show the highlighted region of a sequence
415 void setFollowHighlight(boolean b);
417 public void applyFeaturesStyle(FeatureSettingsModelI featureSettings);
420 * check if current selection group is defined on the view, or is simply a
423 * @return true if group is defined on the alignment
425 boolean isSelectionDefinedGroup();