Clover icon

Coverage Report

  1. Project Clover database Thu Nov 7 2024 17:01:39 GMT
  2. Package jalview.api

File AlignViewportI.java

 

Code metrics

0
0
0
1
593
129
0
-
-
0
-

Classes

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