Clover icon

jalviewX

  1. Project Clover database Wed Oct 31 2018 15:13:58 GMT
  2. Package jalview.api

File AlignViewportI.java

 

Code metrics

0
0
0
1
503
111
0
-
-
0
-

Classes

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