Clover icon

Coverage Report

  1. Project Clover database Wed Jan 7 2026 02:49:01 GMT
  2. Package jalview.api

File AlignViewportI.java

 

Code metrics

0
0
0
1
645
152
0
-
-
0
-

Classes

Class Line # Actions
AlignViewportI 54 0 0
-1.0 -
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3    * Copyright (C) $$Year-Rel$$ The Jalview Authors
4    *
5    * This file is part of Jalview.
6    *
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.
11    *
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.
16    *
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.
20    */
21    package jalview.api;
22   
23    import java.awt.Color;
24    import java.awt.Font;
25    import java.util.Hashtable;
26    import java.util.Iterator;
27    import java.util.List;
28    import java.util.Map;
29   
30    import jalview.analysis.AlignmentUtils;
31    import jalview.analysis.Conservation;
32    import jalview.analysis.TreeModel;
33    import jalview.datamodel.AlignmentAnnotation;
34    import jalview.datamodel.AlignmentExportData;
35    import jalview.datamodel.AlignmentI;
36    import jalview.datamodel.AlignmentView;
37    import jalview.datamodel.ColumnSelection;
38    import jalview.datamodel.ContactListI;
39    import jalview.datamodel.ContactMatrixI;
40    import jalview.datamodel.ProfilesI;
41    import jalview.datamodel.SearchResultsI;
42    import jalview.datamodel.SequenceCollectionI;
43    import jalview.datamodel.SequenceGroup;
44    import jalview.datamodel.SequenceI;
45    import jalview.renderer.ResidueShaderI;
46    import jalview.schemes.ColourSchemeI;
47    import jalview.util.Constants;
48    import jalview.viewmodel.ViewportRanges;
49   
50    /**
51    * @author jimp
52    *
53    */
 
54    public interface AlignViewportI extends ViewStyleI
55    {
56   
57    /**
58    * Get the ranges object containing details of the start and end sequences and
59    * residues
60    *
61    * @return
62    */
63    ViewportRanges getRanges();
64   
65    /**
66    * calculate the height for visible annotation, revalidating bounds where
67    * necessary ABSTRACT GUI METHOD
68    *
69    * @return total height of annotation
70    */
71    int calcPanelHeight();
72   
73    /**
74    * Answers true if the viewport has at least one column selected
75    *
76    * @return
77    */
78    boolean hasSelectedColumns();
79   
80    /**
81    * Answers true if the viewport has at least one hidden column
82    *
83    * @return
84    */
85    boolean hasHiddenColumns();
86   
87    boolean isValidCharWidth();
88   
89    boolean isShowConsensusHistogram();
90   
91    boolean isShowSSConsensusHistogram();
92   
93    boolean isShowSequenceLogo();
94   
95    boolean isShowSequenceSSLogo();
96   
97    boolean isNormaliseSequenceLogo();
98   
99    boolean isShowInformationHistogram();
100   
101    boolean isShowHMMSequenceLogo();
102   
103    boolean isNormaliseHMMSequenceLogo();
104   
105    ColourSchemeI getGlobalColourScheme();
106   
107    /**
108    * Returns an object that describes colouring (including any thresholding or
109    * fading) of the alignment
110    *
111    * @return
112    */
113    ResidueShaderI getResidueShading();
114   
115    AlignmentI getAlignment();
116   
117    ColumnSelection getColumnSelection();
118   
119    ProfilesI getSequenceConsensusHash();
120   
121    /**
122    * Get consensus data table for the cDNA complement of this alignment (if any)
123    *
124    * @return
125    */
126    Hashtable<String, Object>[] getComplementConsensusHash();
127   
128    Hashtable<String, Object>[] getRnaStructureConsensusHash();
129   
130    boolean isIgnoreGapsConsensus();
131   
132    boolean isIgnoreBelowBackground();
133   
134    boolean isCalculationInProgress(AlignmentAnnotation alignmentAnnotation);
135   
136    AlignmentAnnotation getAlignmentQualityAnnot();
137   
138    AlignmentAnnotation getAlignmentConservationAnnotation();
139   
140    /**
141    * get the container for alignment consensus annotation
142    *
143    * @return
144    */
145    AlignmentAnnotation getAlignmentConsensusAnnotation();
146   
147    List<AlignmentAnnotation> getAlignmentSecondaryStructureConsensusAnnotation();
148   
149    /**
150    * get the container for alignment gap annotation
151    *
152    * @return
153    */
154    AlignmentAnnotation getAlignmentGapAnnotation();
155   
156    /**
157    * get the container for cDNA complement consensus annotation
158    *
159    * @return
160    */
161    AlignmentAnnotation getComplementConsensusAnnotation();
162   
163    /**
164    * Test to see if viewport is still open and active
165    *
166    * @return true indicates that all references to viewport should be dropped
167    */
168    boolean isClosed();
169   
170    /**
171    * Dispose of all references or resources held by the viewport
172    */
173    void dispose();
174   
175    /**
176    * get the associated calculation thread manager for the view
177    *
178    * @return
179    */
180    AlignCalcManagerI2 getCalcManager();
181   
182    /**
183    * get the percentage gaps allowed in a conservation calculation
184    *
185    */
186    public int getConsPercGaps();
187   
188    /**
189    * set the consensus result object for the viewport
190    *
191    * @param hconsensus
192    */
193    void setSequenceConsensusHash(ProfilesI hconsensus);
194   
195    void setSequenceSSConsensusHash(
196    Map<String, ProfilesI> hSSConsesnusProfileMap);
197   
198    /**
199    * Set the cDNA complement consensus for the viewport
200    *
201    * @param hconsensus
202    */
203    void setComplementConsensusHash(Hashtable<String, Object>[] hconsensus);
204   
205    /**
206    *
207    * @return the alignment annotation row for the structure consensus
208    * calculation
209    */
210    AlignmentAnnotation getAlignmentStrucConsensusAnnotation();
211   
212    /**
213    * set the Rna structure consensus result object for the viewport
214    *
215    * @param hStrucConsensus
216    */
217    void setRnaStructureConsensusHash(
218    Hashtable<String, Object>[] hStrucConsensus);
219   
220    /**
221    * Sets the colour scheme for the background alignment (as distinct from
222    * sub-groups, which may have their own colour schemes). A null value is used
223    * for no residue colour (white).
224    *
225    * @param cs
226    */
227    void setGlobalColourScheme(ColourSchemeI cs);
228   
229    Map<SequenceI, SequenceCollectionI> getHiddenRepSequences();
230   
231    void setHiddenRepSequences(
232    Map<SequenceI, SequenceCollectionI> hiddenRepSequences);
233   
234    /**
235    * hides or shows dynamic annotation rows based on groups and group and
236    * alignment associated auto-annotation state flags apply the current
237    * group/autoannotation settings to the alignment view. Usually you should
238    * call the AlignmentViewPanel.adjustAnnotationHeight() method afterwards to
239    * ensure the annotation panel bounds are set correctly.
240    *
241    * @param applyGlobalSettings
242    * - apply to all autoannotation rows or just the ones associated
243    * with the current visible region
244    * @param preserveNewGroupSettings
245    * - don't apply global settings to groups which don't already have
246    * group associated annotation
247    */
248    void updateGroupAnnotationSettings(boolean applyGlobalSettings,
249    boolean preserveNewGroupSettings);
250   
251    void setSequenceColour(SequenceI seq, Color col);
252   
253    Color getSequenceColour(SequenceI seq);
254   
255    void updateSequenceIdColours();
256   
257    SequenceGroup getSelectionGroup();
258   
259    /**
260    * get the currently selected sequence objects or all the sequences in the
261    * alignment. TODO: change to List<>
262    *
263    * @return array of references to sequence objects
264    */
265    SequenceI[] getSequenceSelection();
266   
267    void clearSequenceColours();
268   
269    /**
270    * return a compact representation of the current alignment selection to pass
271    * to an analysis function
272    *
273    * @param selectedOnly
274    * boolean true to just return the selected view
275    * @return AlignmentView
276    */
277    AlignmentView getAlignmentView(boolean selectedOnly);
278   
279    /**
280    * return a compact representation of the current alignment selection to pass
281    * to an analysis function
282    *
283    * @param selectedOnly
284    * boolean true to just return the selected view
285    * @param markGroups
286    * boolean true to annotate the alignment view with groups on the
287    * alignment (and intersecting with selected region if selectedOnly
288    * is true)
289    * @return AlignmentView
290    */
291    AlignmentView getAlignmentView(boolean selectedOnly, boolean markGroups);
292   
293    /**
294    * This method returns the visible alignment as text, as seen on the GUI, ie
295    * if columns are hidden they will not be returned in the result. Use this for
296    * calculating trees, PCA, redundancy etc on views which contain hidden
297    * columns. This method doesn't exclude hidden sequences from the output.
298    *
299    * @param selectedRegionOnly
300    * - determines if only the selected region or entire alignment is
301    * exported
302    * @return String[]
303    */
304    String[] getViewAsString(boolean selectedRegionOnly);
305   
306    /**
307    * This method returns the visible alignment as text, as seen on the GUI, ie
308    * if columns are hidden they will not be returned in the result. Use this for
309    * calculating trees, PCA, redundancy etc on views which contain hidden
310    * columns.
311    *
312    * @param selectedRegionOnly
313    * - determines if only the selected region or entire alignment is
314    * exported
315    * @param isExportHiddenSeqs
316    * - determines if hidden sequences would be exported or not.
317    *
318    * @return String[]
319    */
320    String[] getViewAsString(boolean selectedRegionOnly,
321    boolean isExportHiddenSeqs);
322   
323    void setSelectionGroup(SequenceGroup sg);
324   
325    char getGapCharacter();
326   
327    void setColumnSelection(ColumnSelection cs);
328   
329    void setConservation(Conservation cons);
330   
331    /**
332    * get a copy of the currently visible alignment annotation
333    *
334    * @param selectedOnly
335    * if true - trim to selected regions on the alignment
336    * @return an empty list or new alignment annotation objects shown only
337    * visible columns trimmed to selected region only
338    */
339    List<AlignmentAnnotation> getVisibleAlignmentAnnotation(
340    boolean selectedOnly);
341   
342    FeaturesDisplayedI getFeaturesDisplayed();
343   
344    String getSequenceSetId();
345   
346    boolean areFeaturesDisplayed();
347   
348    void setFeaturesDisplayed(FeaturesDisplayedI featuresDisplayedI);
349   
350    void alignmentChanged(AlignmentViewPanel ap);
351   
352    /**
353    * @return the padGaps
354    */
355    boolean isPadGaps();
356   
357    /**
358    * @param padGaps
359    * the padGaps to set
360    */
361    void setPadGaps(boolean padGaps);
362   
363    /**
364    * return visible region boundaries within given column range
365    *
366    * @param min
367    * first column (inclusive, from 0)
368    * @param max
369    * last column (exclusive)
370    * @return int[][] range of {start,end} visible positions
371    */
372    List<int[]> getVisibleRegionBoundaries(int min, int max);
373   
374    /**
375    * This method returns an array of new SequenceI objects derived from the
376    * whole alignment or just the current selection with start and end points
377    * adjusted
378    *
379    * @note if you need references to the actual SequenceI objects in the
380    * alignment or currently selected then use getSequenceSelection()
381    * @return selection as new sequenceI objects
382    */
383    SequenceI[] getSelectionAsNewSequence();
384   
385    void invertColumnSelection();
386   
387    /**
388    * broadcast selection to any interested parties
389    */
390    void sendSelection();
391   
392    /**
393    * calculate the row position for alignmentIndex if all hidden sequences were
394    * shown
395    *
396    * @param alignmentIndex
397    * @return adjusted row position
398    */
399    int adjustForHiddenSeqs(int alignmentIndex);
400   
401    boolean hasHiddenRows();
402   
403    /**
404    *
405    * @return a copy of this view's current display settings
406    */
407    public ViewStyleI getViewStyle();
408   
409    /**
410    * update the view's display settings with the given style set
411    *
412    * @param settingsForView
413    */
414    public void setViewStyle(ViewStyleI settingsForView);
415   
416    /**
417    * Returns a viewport which holds the cDna for this (protein), or vice versa,
418    * or null if none is set.
419    *
420    * @return
421    */
422    AlignViewportI getCodingComplement();
423   
424    /**
425    * Sets the viewport which holds the cDna for this (protein), or vice versa.
426    * Implementation should guarantee that the reciprocal relationship is always
427    * set, i.e. each viewport is the complement of the other.
428    */
429    void setCodingComplement(AlignViewportI sl);
430   
431    /**
432    * Answers true if viewport hosts DNA/RNA, else false.
433    *
434    * @return
435    */
436    boolean isNucleotide();
437   
438    /**
439    * Returns an id guaranteed to be unique for this viewport.
440    *
441    * @return
442    */
443    String getViewId();
444   
445    /**
446    * Return true if view should scroll to show the highlighted region of a
447    * sequence
448    *
449    * @return
450    */
451    boolean isFollowHighlight();
452   
453    /**
454    * Set whether view should scroll to show the highlighted region of a sequence
455    */
456    void setFollowHighlight(boolean b);
457   
458    /**
459    * configure the feature renderer with predefined feature settings
460    *
461    * @param featureSettings
462    */
463    public void applyFeaturesStyle(FeatureSettingsModelI featureSettings);
464   
465    /**
466    * Apply the given feature settings on top of existing feature settings.
467    */
468    public void mergeFeaturesStyle(FeatureSettingsModelI featureSettings);
469   
470    /**
471    * check if current selection group is defined on the view, or is simply a
472    * temporary group.
473    *
474    * @return true if group is defined on the alignment
475    */
476    boolean isSelectionDefinedGroup();
477   
478    /**
479    *
480    * @return true if there are search results on the view
481    */
482    boolean hasSearchResults();
483   
484    /**
485    * set the search results for the view
486    *
487    * @param results
488    * - or null to clear current results
489    */
490    void setSearchResults(SearchResultsI results);
491   
492    /**
493    * get search results for this view (if any)
494    *
495    * @return search results or null
496    */
497    SearchResultsI getSearchResults();
498   
499    /**
500    * Retrieve a ContactListI corresponding to column in an annotation row in an
501    * alignment.
502    *
503    * @param _aa
504    * - annotation with associated matrix data
505    * @param column
506    * - column in alignment where _aa is associated
507    */
508    ContactListI getContactList(AlignmentAnnotation _aa, int column);
509   
510    /**
511    * Updates view settings with the given font. You may need to call
512    * AlignmentPanel.fontChanged to update the layout geometry.
513    *
514    * @param setGrid
515    * when true, charWidth/height is set according to font metrics
516    */
517    void setFont(Font newFont, boolean b);
518   
519    /**
520    * Answers true if split screen protein and cDNA use the same font
521    *
522    * @return
523    */
524    @Override
525    boolean isProteinFontAsCdna();
526   
527    /**
528    * Set the flag for whether split screen protein and cDNA use the same font
529    *
530    * @return
531    */
532    @Override
533    void setProteinFontAsCdna(boolean b);
534   
535    void setHmmProfiles(ProfilesI info);
536   
537    ProfilesI getHmmProfiles();
538   
539    /**
540    * Registers and starts a worker thread to calculate Information Content
541    * annotation, if it is not already registered
542    *
543    * @param ap
544    */
545    void initInformationWorker(AlignmentViewPanel ap);
546   
547    boolean isInfoLetterHeight();
548   
549    public abstract TreeModel getCurrentTree();
550   
551    /**
552    * Answers a data bean containing data for export as configured by the
553    * supplied options
554    *
555    * @param options
556    * @return
557    */
558    AlignmentExportData getAlignExportData(AlignExportSettingsI options);
559   
560    public abstract void setCurrentTree(TreeModel tree);
561   
562    /**
563    * @param update
564    * - set the flag for updating structures on next repaint
565    */
566    void setUpdateStructures(boolean update);
567   
568    /**
569    *
570    * @return true if structure views will be updated on next refresh
571    */
572    boolean isUpdateStructures();
573   
574    /**
575    * check if structure views need to be updated, and clear the flag afterwards.
576    *
577    * @return if an update is needed
578    */
579    boolean needToUpdateStructureViews();
580   
581    /**
582    * Adds sequencegroup to the alignment in the view. Also adds a group to the
583    * complement view if one is defined.
584    *
585    * @param sequenceGroup
586    * - a group defined on sequences in the alignment held by the view
587    */
588    void addSequenceGroup(SequenceGroup sequenceGroup);
589   
590    /**
591    * Returns an interator over the [start, end] column positions of the visible
592    * regions of the alignment
593    *
594    * @param selectedRegionOnly
595    * if true, and the view has a selection region, then only the
596    * intersection of visible columns with the selection region is
597    * returned
598    * @return
599    */
600    Iterator<int[]> getViewAsVisibleContigs(boolean selectedRegionOnly);
601   
602    /**
603    * notify all concerned that the alignment data has changed and derived data
604    * needs to be recalculated
605    */
606    public void notifyAlignmentChanged();
607   
608    /**
609    * retrieve a matrix associated with the view's alignment's annotation
610    *
611    * @param alignmentAnnotation
612    * @return contact matrix or NULL
613    */
614    ContactMatrixI getContactMatrix(AlignmentAnnotation alignmentAnnotation);
615   
616    Map<String, ProfilesI> getSequenceSSConsensusHash();
617   
618    List<String> getSecondaryStructureSources();
619   
620    void setSecondaryStructureSources(List<String> secondaryStructureSources);
621   
622    boolean is3di();
623   
624    public AlignmentAnnotation getComparisonAnnotation();
625   
626    Color getAnnotationColour(AlignmentAnnotation annot);
627   
628    void setAnnotationColour(AlignmentAnnotation annot, Color col);
629   
630    void updateAnnotationColours();
631   
632    void clearAnnotationColours();
633   
634    Map<AlignmentAnnotation, Color> getAnnotationColours();
635   
636    void setAnnotationColours(
637    Map<AlignmentAnnotation, Color> annotationColours);
638   
639    /**
640    * Get the Consensus annotation for the alignment
641    *
642    * @return
643    */
644    public void setSecondaryStructureSources();
645    }