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.SequenceCollectionI;
30 import jalview.datamodel.SequenceGroup;
31 import jalview.datamodel.SequenceI;
32 import jalview.schemes.ColourSchemeI;
34 import java.util.Hashtable;
35 import java.util.List;
42 public interface AlignViewportI extends ViewStyleI
48 * calculate the height for visible annotation, revalidating bounds where
49 * necessary ABSTRACT GUI METHOD
51 * @return total height of annotation
53 public int calcPanelHeight();
56 * Answers true if the viewport has at least one column selected
60 boolean hasSelectedColumns();
63 * Answers true if the viewport has at least one hidden column
67 boolean hasHiddenColumns();
69 boolean isValidCharWidth();
71 boolean isShowConsensusHistogram();
73 boolean isShowSequenceLogo();
75 boolean isNormaliseSequenceLogo();
77 ColourSchemeI getGlobalColourScheme();
79 AlignmentI getAlignment();
81 ColumnSelection getColumnSelection();
83 Hashtable[] getSequenceConsensusHash();
86 * Get consensus data table for the cDNA complement of this alignment (if any)
90 Hashtable[] getComplementConsensusHash();
92 Hashtable[] getRnaStructureConsensusHash();
94 boolean isIgnoreGapsConsensus();
96 boolean isCalculationInProgress(AlignmentAnnotation alignmentAnnotation);
98 AlignmentAnnotation getAlignmentQualityAnnot();
100 AlignmentAnnotation getAlignmentConservationAnnotation();
103 * get the container for alignment consensus annotation
107 AlignmentAnnotation getAlignmentConsensusAnnotation();
110 * get the container for cDNA complement consensus annotation
114 AlignmentAnnotation getComplementConsensusAnnotation();
117 * Test to see if viewport is still open and active
119 * @return true indicates that all references to viewport should be dropped
124 * get the associated calculation thread manager for the view
128 AlignCalcManagerI getCalcManager();
131 * get the percentage gaps allowed in a conservation calculation
134 public int getConsPercGaps();
137 * set the consensus result object for the viewport
141 void setSequenceConsensusHash(Hashtable[] hconsensus);
144 * Set the cDNA complement consensus for the viewport
148 void setComplementConsensusHash(Hashtable[] hconsensus);
152 * @return the alignment annotatino row for the structure consensus
155 AlignmentAnnotation getAlignmentStrucConsensusAnnotation();
158 * set the Rna structure consensus result object for the viewport
160 * @param hStrucConsensus
162 void setRnaStructureConsensusHash(Hashtable[] hStrucConsensus);
165 * set global colourscheme
169 void setGlobalColourScheme(ColourSchemeI rhc);
171 Map<SequenceI, SequenceCollectionI> getHiddenRepSequences();
173 void setHiddenRepSequences(
174 Map<SequenceI, SequenceCollectionI> hiddenRepSequences);
177 * hides or shows dynamic annotation rows based on groups and group and
178 * alignment associated auto-annotation state flags apply the current
179 * group/autoannotation settings to the alignment view. Usually you should
180 * call the AlignmentViewPanel.adjustAnnotationHeight() method afterwards to
181 * ensure the annotation panel bounds are set correctly.
183 * @param applyGlobalSettings
184 * - apply to all autoannotation rows or just the ones associated
185 * with the current visible region
186 * @param preserveNewGroupSettings
187 * - don't apply global settings to groups which don't already have
188 * group associated annotation
190 void updateGroupAnnotationSettings(boolean applyGlobalSettings,
191 boolean preserveNewGroupSettings);
193 void setSequenceColour(SequenceI seq, ColorI col);
195 ColorI getSequenceColour(SequenceI seq);
197 void updateSequenceIdColours();
199 SequenceGroup getSelectionGroup();
202 * get the currently selected sequence objects or all the sequences in the
203 * alignment. TODO: change to List<>
205 * @return array of references to sequence objects
207 SequenceI[] getSequenceSelection();
209 void clearSequenceColours();
212 * This method returns the visible alignment as text, as seen on the GUI, ie
213 * if columns are hidden they will not be returned in the result. Use this for
214 * calculating trees, PCA, redundancy etc on views which contain hidden
219 CigarArray getViewAsCigars(boolean selectedRegionOnly);
222 * return a compact representation of the current alignment selection to pass
223 * to an analysis function
225 * @param selectedOnly
226 * boolean true to just return the selected view
227 * @return AlignmentView
229 AlignmentView getAlignmentView(boolean selectedOnly);
232 * return a compact representation of the current alignment selection to pass
233 * to an analysis function
235 * @param selectedOnly
236 * boolean true to just return the selected view
238 * boolean true to annotate the alignment view with groups on the
239 * alignment (and intersecting with selected region if selectedOnly
241 * @return AlignmentView
243 AlignmentView getAlignmentView(boolean selectedOnly, boolean markGroups);
246 * This method returns the visible alignment as text, as seen on the GUI, ie
247 * if columns are hidden they will not be returned in the result. Use this for
248 * calculating trees, PCA, redundancy etc on views which contain hidden
249 * columns. This method doesn't exclude hidden sequences from the output.
251 * @param selectedRegionOnly
252 * - determines if only the selected region or entire alignment is
256 String[] getViewAsString(boolean selectedRegionOnly);
259 * This method returns the visible alignment as text, as seen on the GUI, ie
260 * if columns are hidden they will not be returned in the result. Use this for
261 * calculating trees, PCA, redundancy etc on views which contain hidden
264 * @param selectedRegionOnly
265 * - determines if only the selected region or entire alignment is
267 * @param isExportHiddenSeqs
268 * - determines if hidden sequences would be exported or not.
272 String[] getViewAsString(boolean selectedRegionOnly, boolean isExportHiddenSeqs);
274 void setSelectionGroup(SequenceGroup sg);
276 char getGapCharacter();
278 void setColumnSelection(ColumnSelection cs);
280 void setConservation(Conservation cons);
283 * get a copy of the currently visible alignment annotation
285 * @param selectedOnly
286 * if true - trim to selected regions on the alignment
287 * @return an empty list or new alignment annotation objects shown only
288 * visible columns trimmed to selected region only
290 List<AlignmentAnnotation> getVisibleAlignmentAnnotation(
291 boolean selectedOnly);
293 FeaturesDisplayedI getFeaturesDisplayed();
295 String getSequenceSetId();
297 boolean areFeaturesDisplayed();
299 void setFeaturesDisplayed(FeaturesDisplayedI featuresDisplayedI);
301 void alignmentChanged(AlignmentViewPanel ap);
304 * @return the padGaps
312 void setPadGaps(boolean padGaps);
315 * return visible region boundaries within given column range
318 * first column (inclusive, from 0)
320 * last column (exclusive)
321 * @return int[][] range of {start,end} visible positions
323 List<int[]> getVisibleRegionBoundaries(int min, int max);
326 * This method returns an array of new SequenceI objects derived from the
327 * whole alignment or just the current selection with start and end points
330 * @note if you need references to the actual SequenceI objects in the
331 * alignment or currently selected then use getSequenceSelection()
332 * @return selection as new sequenceI objects
334 SequenceI[] getSelectionAsNewSequence();
336 void invertColumnSelection();
339 * broadcast selection to any interested parties
341 void sendSelection();
344 * calculate the row position for alignmentIndex if all hidden sequences were
347 * @param alignmentIndex
348 * @return adjusted row position
350 int adjustForHiddenSeqs(int alignmentIndex);
352 boolean hasHiddenRows();
356 * @return a copy of this view's current display settings
358 public ViewStyleI getViewStyle();
361 * update the view's display settings with the given style set
363 * @param settingsForView
365 public void setViewStyle(ViewStyleI settingsForView);
368 * Returns a viewport which holds the cDna for this (protein), or vice versa,
369 * or null if none is set.
373 AlignViewportI getCodingComplement();
376 * Sets the viewport which holds the cDna for this (protein), or vice versa.
377 * Implementation should guarantee that the reciprocal relationship is always
378 * set, i.e. each viewport is the complement of the other.
380 void setCodingComplement(AlignViewportI sl);
383 * Answers true if viewport hosts DNA/RNA, else false.
387 boolean isNucleotide();
390 * Returns an id guaranteed to be unique for this viewport.
397 * Return true if view should scroll to show the highlighted region of a
402 boolean isFollowHighlight();
405 * Set whether view should scroll to show the highlighted region of a sequence
407 void setFollowHighlight(boolean b);
410 public void applyFeaturesStyle(FeatureSettingsModelI featureSettings);
413 * check if current selection group is defined on the view, or is simply a
416 * @return true if group is defined on the alignment
418 boolean isSelectionDefinedGroup();