Clover icon

Coverage Report

  1. Project Clover database Fri Dec 6 2024 13:47:14 GMT
  2. Package jalview.api

File AlignViewportI.java

 

Code metrics

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