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.TreeModel;
25 import jalview.datamodel.AlignmentAnnotation;
26 import jalview.datamodel.AlignmentExportData;
27 import jalview.datamodel.AlignmentI;
28 import jalview.datamodel.AlignmentView;
29 import jalview.datamodel.ColumnSelection;
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;
37 import jalview.viewmodel.ViewportRanges;
39 import java.awt.Color;
41 import java.util.Hashtable;
42 import java.util.List;
49 public interface AlignViewportI extends ViewStyleI
53 * Get the ranges object containing details of the start and end sequences and
58 public ViewportRanges getRanges();
61 * calculate the height for visible annotation, revalidating bounds where
62 * necessary ABSTRACT GUI METHOD
64 * @return total height of annotation
66 public int calcPanelHeight();
69 * Answers true if the viewport has at least one column selected
73 boolean hasSelectedColumns();
76 * Answers true if the viewport has at least one hidden column
80 boolean hasHiddenColumns();
82 boolean isValidCharWidth();
84 boolean isShowConsensusHistogram();
86 boolean isShowSequenceLogo();
88 boolean isNormaliseSequenceLogo();
90 ColourSchemeI getGlobalColourScheme();
93 * Returns an object that describes colouring (including any thresholding or
94 * fading) of the alignment
98 ResidueShaderI getResidueShading();
100 AlignmentI getAlignment();
102 ColumnSelection getColumnSelection();
104 ProfilesI getSequenceConsensusHash();
107 * Get consensus data table for the cDNA complement of this alignment (if any)
111 Hashtable<String, Object>[] getComplementConsensusHash();
113 Hashtable<String, Object>[] getRnaStructureConsensusHash();
115 boolean isIgnoreGapsConsensus();
117 boolean isCalculationInProgress(AlignmentAnnotation alignmentAnnotation);
119 AlignmentAnnotation getAlignmentQualityAnnot();
121 AlignmentAnnotation getAlignmentConservationAnnotation();
124 * get the container for alignment consensus annotation
128 AlignmentAnnotation getAlignmentConsensusAnnotation();
131 * get the container for alignment gap annotation
135 AlignmentAnnotation getAlignmentGapAnnotation();
138 * get the container for cDNA complement consensus annotation
142 AlignmentAnnotation getComplementConsensusAnnotation();
145 * Test to see if viewport is still open and active
147 * @return true indicates that all references to viewport should be dropped
152 * Dispose of all references or resources held by the viewport
157 * get the associated calculation thread manager for the view
161 AlignCalcManagerI getCalcManager();
164 * get the percentage gaps allowed in a conservation calculation
167 public int getConsPercGaps();
170 * set the consensus result object for the viewport
174 void setSequenceConsensusHash(ProfilesI hconsensus);
177 * Set the cDNA complement consensus for the viewport
181 void setComplementConsensusHash(Hashtable<String, Object>[] hconsensus);
185 * @return the alignment annotation row for the structure consensus
188 AlignmentAnnotation getAlignmentStrucConsensusAnnotation();
191 * set the Rna structure consensus result object for the viewport
193 * @param hStrucConsensus
195 void setRnaStructureConsensusHash(
196 Hashtable<String, Object>[] hStrucConsensus);
199 * Sets the colour scheme for the background alignment (as distinct from
200 * sub-groups, which may have their own colour schemes). A null value is used
201 * for no residue colour (white).
205 void setGlobalColourScheme(ColourSchemeI cs);
207 Map<SequenceI, SequenceCollectionI> getHiddenRepSequences();
209 void setHiddenRepSequences(
210 Map<SequenceI, SequenceCollectionI> hiddenRepSequences);
213 * hides or shows dynamic annotation rows based on groups and group and
214 * alignment associated auto-annotation state flags apply the current
215 * group/autoannotation settings to the alignment view. Usually you should
216 * call the AlignmentViewPanel.adjustAnnotationHeight() method afterwards to
217 * ensure the annotation panel bounds are set correctly.
219 * @param applyGlobalSettings
220 * - apply to all autoannotation rows or just the ones associated
221 * with the current visible region
222 * @param preserveNewGroupSettings
223 * - don't apply global settings to groups which don't already have
224 * group associated annotation
226 void updateGroupAnnotationSettings(boolean applyGlobalSettings,
227 boolean preserveNewGroupSettings);
229 void setSequenceColour(SequenceI seq, Color col);
231 Color getSequenceColour(SequenceI seq);
233 void updateSequenceIdColours();
235 SequenceGroup getSelectionGroup();
238 * get the currently selected sequence objects or all the sequences in the
239 * alignment. TODO: change to List<>
241 * @return array of references to sequence objects
243 SequenceI[] getSequenceSelection();
245 void clearSequenceColours();
248 * return a compact representation of the current alignment selection to pass
249 * to an analysis function
251 * @param selectedOnly
252 * boolean true to just return the selected view
253 * @return AlignmentView
255 AlignmentView getAlignmentView(boolean selectedOnly);
258 * return a compact representation of the current alignment selection to pass
259 * to an analysis function
261 * @param selectedOnly
262 * boolean true to just return the selected view
264 * boolean true to annotate the alignment view with groups on the
265 * alignment (and intersecting with selected region if selectedOnly
267 * @return AlignmentView
269 AlignmentView getAlignmentView(boolean selectedOnly, boolean markGroups);
272 * This method returns the visible alignment as text, as seen on the GUI, ie
273 * if columns are hidden they will not be returned in the result. Use this for
274 * calculating trees, PCA, redundancy etc on views which contain hidden
275 * columns. This method doesn't exclude hidden sequences from the output.
277 * @param selectedRegionOnly
278 * - determines if only the selected region or entire alignment is
282 String[] getViewAsString(boolean selectedRegionOnly);
285 * This method returns the visible alignment as text, as seen on the GUI, ie
286 * if columns are hidden they will not be returned in the result. Use this for
287 * calculating trees, PCA, redundancy etc on views which contain hidden
290 * @param selectedRegionOnly
291 * - determines if only the selected region or entire alignment is
293 * @param isExportHiddenSeqs
294 * - determines if hidden sequences would be exported or not.
298 String[] getViewAsString(boolean selectedRegionOnly,
299 boolean isExportHiddenSeqs);
301 void setSelectionGroup(SequenceGroup sg);
303 char getGapCharacter();
305 void setColumnSelection(ColumnSelection cs);
307 void setConservation(Conservation cons);
310 * get a copy of the currently visible alignment annotation
312 * @param selectedOnly
313 * if true - trim to selected regions on the alignment
314 * @return an empty list or new alignment annotation objects shown only
315 * visible columns trimmed to selected region only
317 List<AlignmentAnnotation> getVisibleAlignmentAnnotation(
318 boolean selectedOnly);
320 FeaturesDisplayedI getFeaturesDisplayed();
322 String getSequenceSetId();
324 boolean areFeaturesDisplayed();
326 void setFeaturesDisplayed(FeaturesDisplayedI featuresDisplayedI);
328 void alignmentChanged(AlignmentViewPanel ap);
331 * @return the padGaps
339 void setPadGaps(boolean padGaps);
342 * return visible region boundaries within given column range
345 * first column (inclusive, from 0)
347 * last column (exclusive)
348 * @return int[][] range of {start,end} visible positions
350 List<int[]> getVisibleRegionBoundaries(int min, int max);
353 * This method returns an array of new SequenceI objects derived from the
354 * whole alignment or just the current selection with start and end points
357 * @note if you need references to the actual SequenceI objects in the
358 * alignment or currently selected then use getSequenceSelection()
359 * @return selection as new sequenceI objects
361 SequenceI[] getSelectionAsNewSequence();
363 void invertColumnSelection();
366 * broadcast selection to any interested parties
368 void sendSelection();
371 * calculate the row position for alignmentIndex if all hidden sequences were
374 * @param alignmentIndex
375 * @return adjusted row position
377 int adjustForHiddenSeqs(int alignmentIndex);
379 boolean hasHiddenRows();
383 * @return a copy of this view's current display settings
385 public ViewStyleI getViewStyle();
388 * update the view's display settings with the given style set
390 * @param settingsForView
392 public void setViewStyle(ViewStyleI settingsForView);
395 * Returns a viewport which holds the cDna for this (protein), or vice versa,
396 * or null if none is set.
400 AlignViewportI getCodingComplement();
403 * Sets the viewport which holds the cDna for this (protein), or vice versa.
404 * Implementation should guarantee that the reciprocal relationship is always
405 * set, i.e. each viewport is the complement of the other.
407 void setCodingComplement(AlignViewportI sl);
410 * Answers true if viewport hosts DNA/RNA, else false.
414 boolean isNucleotide();
417 * Returns an id guaranteed to be unique for this viewport.
424 * Return true if view should scroll to show the highlighted region of a
429 boolean isFollowHighlight();
432 * Set whether view should scroll to show the highlighted region of a sequence
434 void setFollowHighlight(boolean b);
437 * configure the feature renderer with predefined feature settings
439 * @param featureSettings
441 public void applyFeaturesStyle(FeatureSettingsModelI featureSettings);
444 * Apply the given feature settings on top of existing feature settings.
446 public void mergeFeaturesStyle(FeatureSettingsModelI featureSettings);
449 * check if current selection group is defined on the view, or is simply a
452 * @return true if group is defined on the alignment
454 boolean isSelectionDefinedGroup();
458 * @return true if there are search results on the view
460 boolean hasSearchResults();
463 * set the search results for the view
466 * - or null to clear current results
468 void setSearchResults(SearchResultsI results);
471 * get search results for this view (if any)
473 * @return search results or null
475 SearchResultsI getSearchResults();
478 * Updates view settings with the given font. You may need to call
479 * AlignmentPanel.fontChanged to update the layout geometry.
482 * when true, charWidth/height is set according to font metrics
484 void setFont(Font newFont, boolean b);
487 * Answers true if split screen protein and cDNA use the same font
492 boolean isProteinFontAsCdna();
495 * Set the flag for whether split screen protein and cDNA use the same font
500 void setProteinFontAsCdna(boolean b);
502 TreeModel getCurrentTree();
504 void setCurrentTree(TreeModel tree);
507 * Answers a data bean containing data for export as configured by the
513 AlignmentExportData getAlignExportData(AlignExportSettingsI options);
517 * - set the flag for updating structures on next repaint
519 void setUpdateStructures(boolean update);
523 * @return true if structure views will be updated on next refresh
525 boolean isUpdateStructures();
528 * check if structure views need to be updated, and clear the flag afterwards.
530 * @return if an update is needed
532 boolean needToUpdateStructureViews();
535 * Adds sequencegroup to the alignment in the view. Also adds a group to the
536 * complement view if one is defined.
538 * @param sequenceGroup
539 * - a group defined on sequences in the alignment held by the view
541 void addSequenceGroup(SequenceGroup sequenceGroup);