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.AlignmentUtils;
24 import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
25 import jalview.api.AlignViewportI;
26 import jalview.api.AlignmentViewPanel;
27 import jalview.api.FeatureColourI;
28 import jalview.api.FeatureSettingsModelI;
29 import jalview.api.FeaturesDisplayedI;
30 import jalview.api.ViewStyleI;
31 import jalview.bin.Cache;
32 import jalview.commands.CommandI;
33 import jalview.datamodel.AlignedCodonFrame;
34 import jalview.datamodel.Alignment;
35 import jalview.datamodel.AlignmentI;
36 import jalview.datamodel.ColumnSelection;
37 import jalview.datamodel.HiddenColumns;
38 import jalview.datamodel.SearchResults;
39 import jalview.datamodel.SearchResultsI;
40 import jalview.datamodel.SequenceGroup;
41 import jalview.datamodel.SequenceI;
42 import jalview.renderer.ResidueShader;
43 import jalview.schemes.ColourSchemeI;
44 import jalview.schemes.ColourSchemeProperty;
45 import jalview.schemes.ResidueColourScheme;
46 import jalview.schemes.UserColourScheme;
47 import jalview.structure.SelectionSource;
48 import jalview.structure.StructureSelectionManager;
49 import jalview.structure.VamsasSource;
50 import jalview.util.MessageManager;
51 import jalview.viewmodel.AlignmentViewport;
52 import jalview.ws.params.AutoCalcSetting;
54 import java.awt.Container;
55 import java.awt.Dimension;
57 import java.awt.FontMetrics;
58 import java.awt.Rectangle;
59 import java.util.Hashtable;
60 import java.util.Iterator;
61 import java.util.List;
63 import javax.swing.JInternalFrame;
69 * @version $Revision: 1.141 $
71 public class AlignViewport extends AlignmentViewport
72 implements SelectionSource
76 boolean cursorMode = false;
78 boolean antiAlias = false;
80 private Rectangle explodedGeometry;
85 * Flag set true on the view that should 'gather' multiple views of the same
86 * sequence set id when a project is reloaded. Set false on all views when
87 * they are 'exploded' into separate windows. Set true on the current view
88 * when 'Gather' is performed, and also on the first tab when the first new
91 private boolean gatherViewsHere = false;
93 private AnnotationColumnChooser annotationColumnSelectionState;
95 boolean validCharWidth;
97 public boolean followSelection = true;
99 private Hashtable<String, AutoCalcSetting> calcIdParams = new Hashtable<>();
102 * Creates a new AlignViewport object.
107 public AlignViewport(AlignmentI al)
114 * Create a new AlignViewport object with a specific sequence set ID
118 * (may be null - but potential for ambiguous constructor exception)
120 public AlignViewport(AlignmentI al, String seqsetid)
122 this(al, seqsetid, null);
125 public AlignViewport(AlignmentI al, String seqsetid, String viewid)
128 sequenceSetID = seqsetid;
130 // TODO remove these once 2.4.VAMSAS release finished
131 if (Cache.log != null && Cache.log.isDebugEnabled() && seqsetid != null)
134 "Setting viewport's sequence set id : " + sequenceSetID);
136 if (Cache.log != null && Cache.log.isDebugEnabled() && viewId != null)
138 Cache.log.debug("Setting viewport's view id : " + viewId);
145 * Create a new AlignViewport with hidden regions
149 * @param hiddenColumns
152 public AlignViewport(AlignmentI al, HiddenColumns hiddenColumns)
155 if (hiddenColumns != null)
157 al.setHiddenColumns(hiddenColumns);
163 * New viewport with hidden columns and an existing sequence set id
166 * @param hiddenColumns
170 public AlignViewport(AlignmentI al, HiddenColumns hiddenColumns,
173 this(al, hiddenColumns, seqsetid, null);
177 * New viewport with hidden columns and an existing sequence set id and viewid
180 * @param hiddenColumns
186 public AlignViewport(AlignmentI al, HiddenColumns hiddenColumns,
187 String seqsetid, String viewid)
190 sequenceSetID = seqsetid;
192 // TODO remove these once 2.4.VAMSAS release finished
193 if (Cache.log != null && Cache.log.isDebugEnabled() && seqsetid != null)
196 "Setting viewport's sequence set id : " + sequenceSetID);
198 if (Cache.log != null && Cache.log.isDebugEnabled() && viewId != null)
200 Cache.log.debug("Setting viewport's view id : " + viewId);
203 if (hiddenColumns != null)
205 al.setHiddenColumns(hiddenColumns);
211 * Apply any settings saved in user preferences
213 private void applyViewProperties()
215 antiAlias = Cache.getDefault("ANTI_ALIAS", false);
217 viewStyle.setShowJVSuffix(Cache.getDefault("SHOW_JVSUFFIX", true));
218 setShowAnnotation(Cache.getDefault("SHOW_ANNOTATIONS", true));
220 setRightAlignIds(Cache.getDefault("RIGHT_ALIGN_IDS", false));
221 setCentreColumnLabels(Cache.getDefault("CENTRE_COLUMN_LABELS", false));
222 autoCalculateConsensus = Cache.getDefault("AUTO_CALC_CONSENSUS", true);
224 setPadGaps(Cache.getDefault("PAD_GAPS", true));
225 setShowNPFeats(Cache.getDefault("SHOW_NPFEATS_TOOLTIP", true));
226 setShowDBRefs(Cache.getDefault("SHOW_DBREFS_TOOLTIP", true));
227 viewStyle.setSeqNameItalics(Cache.getDefault("ID_ITALICS", true));
228 viewStyle.setWrapAlignment(Cache.getDefault("WRAP_ALIGNMENT", false));
229 viewStyle.setShowUnconserved(
230 Cache.getDefault("SHOW_UNCONSERVED", false));
231 sortByTree = Cache.getDefault("SORT_BY_TREE", false);
232 followSelection = Cache.getDefault("FOLLOW_SELECTIONS", true);
233 sortAnnotationsBy = SequenceAnnotationOrder
234 .valueOf(Cache.getDefault(Preferences.SORT_ANNOTATIONS,
235 SequenceAnnotationOrder.NONE.name()));
236 showAutocalculatedAbove = Cache
237 .getDefault(Preferences.SHOW_AUTOCALC_ABOVE, false);
238 viewStyle.setScaleProteinAsCdna(
239 Cache.getDefault(Preferences.SCALE_PROTEIN_TO_CDNA, true));
244 applyViewProperties();
246 String fontName = Cache.getDefault("FONT_NAME", "SansSerif");
247 String fontStyle = Cache.getDefault("FONT_STYLE", Font.PLAIN + "");
248 String fontSize = Cache.getDefault("FONT_SIZE", "10");
252 if (fontStyle.equals("bold"))
256 else if (fontStyle.equals("italic"))
261 setFont(new Font(fontName, style, Integer.parseInt(fontSize)), true);
263 AlignmentI al = getAlignment();
264 al.setGapCharacter(Cache.getDefault("GAP_SYMBOL", "-").charAt(0));
266 // We must set conservation and consensus before setting colour,
267 // as Blosum and Clustal require this to be done
268 if (consensusProfiles == null && !isDataset)
270 if (!al.isNucleotide())
272 showConservation = Cache.getDefault("SHOW_CONSERVATION", true);
273 showQuality = Cache.getDefault("SHOW_QUALITY", true);
274 showGroupConservation = Cache.getDefault("SHOW_GROUP_CONSERVATION",
277 showConsensusHistogram = Cache.getDefault("SHOW_CONSENSUS_HISTOGRAM",
279 showSequenceLogo = Cache.getDefault("SHOW_CONSENSUS_LOGO", false);
280 normaliseSequenceLogo = Cache.getDefault("NORMALISE_CONSENSUS_LOGO",
282 showGroupConsensus = Cache.getDefault("SHOW_GROUP_CONSENSUS", false);
283 showConsensus = Cache.getDefault("SHOW_IDENTITY", true);
285 showOccupancy = Cache.getDefault(Preferences.SHOW_OCCUPANCY, true);
287 initAutoAnnotation();
288 // initInformation();
290 String colourProperty = al.isNucleotide()
291 ? Preferences.DEFAULT_COLOUR_NUC
292 : Preferences.DEFAULT_COLOUR_PROT;
293 String schemeName = Cache.getProperty(colourProperty);
294 if (schemeName == null)
296 // only DEFAULT_COLOUR available in Jalview before 2.9
297 schemeName = Cache.getDefault(Preferences.DEFAULT_COLOUR,
298 ResidueColourScheme.NONE);
300 ColourSchemeI colourScheme = ColourSchemeProperty
301 .getColourScheme(al, schemeName);
302 residueShading = new ResidueShader(colourScheme);
304 if (colourScheme instanceof UserColourScheme)
306 residueShading = new ResidueShader(
307 UserDefinedColours.loadDefaultColours());
308 residueShading.setThreshold(0, isIgnoreGapsConsensus());
311 if (residueShading != null)
313 residueShading.setConsensus(consensusProfiles);
321 public void setFont(Font f, boolean setGrid)
325 Container c = new Container();
329 FontMetrics fm = c.getFontMetrics(font);
330 int ww = fm.charWidth('M');
331 setCharHeight(fm.getHeight());
334 viewStyle.setFontName(font.getName());
335 viewStyle.setFontStyle(font.getStyle());
336 viewStyle.setFontSize(font.getSize());
338 validCharWidth = true;
342 public void setViewStyle(ViewStyleI settingsForView)
344 super.setViewStyle(settingsForView);
345 setFont(new Font(viewStyle.getFontName(), viewStyle.getFontStyle(),
346 viewStyle.getFontSize()), false);
352 * @return DOCUMENT ME!
354 public Font getFont()
366 public void setAlignment(AlignmentI align)
368 replaceMappings(align);
369 super.setAlignment(align);
373 * Replace any codon mappings for this viewport with those for the given
378 public void replaceMappings(AlignmentI align)
382 * Deregister current mappings (if any)
384 deregisterMappings();
387 * Register new mappings (if any)
391 StructureSelectionManager ssm = StructureSelectionManager
392 .getStructureSelectionManager(Desktop.instance);
393 ssm.registerMappings(align.getCodonFrames());
397 * replace mappings on our alignment
399 if (getAlignment() != null && align != null)
401 getAlignment().setCodonFrames(align.getCodonFrames());
405 protected void deregisterMappings()
407 AlignmentI al = getAlignment();
410 List<AlignedCodonFrame> mappings = al.getCodonFrames();
411 if (mappings != null)
413 StructureSelectionManager ssm = StructureSelectionManager
414 .getStructureSelectionManager(Desktop.instance);
415 for (AlignedCodonFrame acf : mappings)
417 if (noReferencesTo(acf))
419 ssm.deregisterMapping(acf);
429 * @return DOCUMENT ME!
432 public char getGapCharacter()
434 return getAlignment().getGapCharacter();
443 public void setGapCharacter(char gap)
445 if (getAlignment() != null)
447 getAlignment().setGapCharacter(gap);
452 * Returns an iterator over the visible column regions of the alignment
454 * @param selectedRegionOnly
455 * true to just return the contigs intersecting with the selected
459 public Iterator<int[]> getViewAsVisibleContigs(boolean selectedRegionOnly)
463 if (selectedRegionOnly && selectionGroup != null)
465 start = selectionGroup.getStartRes();
466 end = selectionGroup.getEndRes() + 1;
470 end = getAlignment().getWidth();
473 return getAlignment().getHiddenColumns().getVisContigsIterator(start,
478 * get hash of undo and redo list for the alignment
480 * @return long[] { historyList.hashCode, redoList.hashCode };
482 public long[] getUndoRedoHash()
485 if (historyList == null || redoList == null)
487 return new long[] { -1, -1 };
489 return new long[] { historyList.hashCode(), this.redoList.hashCode() };
493 * test if a particular set of hashcodes are different to the hashcodes for
494 * the undo and redo list.
497 * the stored set of hashcodes as returned by getUndoRedoHash
498 * @return true if the hashcodes differ (ie the alignment has been edited) or
499 * the stored hashcode array differs in size
501 public boolean isUndoRedoHashModified(long[] undoredo)
503 if (undoredo == null)
507 long[] cstate = getUndoRedoHash();
508 if (cstate.length != undoredo.length)
513 for (int i = 0; i < cstate.length; i++)
515 if (cstate[i] != undoredo[i])
524 * @return true if view selection should always follow the selections
525 * broadcast by other selection sources
527 public boolean getFollowSelection()
529 return followSelection;
533 * Send the current selection to be broadcast to any selection listeners.
536 public void sendSelection()
538 jalview.structure.StructureSelectionManager
539 .getStructureSelectionManager(Desktop.instance)
540 .sendSelection(new SequenceGroup(getSelectionGroup()),
541 new ColumnSelection(getColumnSelection()),
542 new HiddenColumns(getAlignment().getHiddenColumns()),
547 * return the alignPanel containing the given viewport. Use this to get the
548 * components currently handling the given viewport.
551 * @return null or an alignPanel guaranteed to have non-null alignFrame
554 public AlignmentPanel getAlignPanel()
556 AlignmentPanel[] aps = PaintRefresher
557 .getAssociatedPanels(this.getSequenceSetId());
558 for (int p = 0; aps != null && p < aps.length; p++)
560 if (aps[p].av == this)
568 public boolean getSortByTree()
573 public void setSortByTree(boolean sort)
579 * Returns the (Desktop) instance of the StructureSelectionManager
582 public StructureSelectionManager getStructureSelectionManager()
584 return StructureSelectionManager
585 .getStructureSelectionManager(Desktop.instance);
590 * @return true if alignment characters should be displayed
593 public boolean isValidCharWidth()
595 return validCharWidth;
598 public AutoCalcSetting getCalcIdSettingsFor(String calcId)
600 return calcIdParams.get(calcId);
603 public void setCalcIdSettingsFor(String calcId, AutoCalcSetting settings,
606 calcIdParams.put(calcId, settings);
607 // TODO: create a restart list to trigger any calculations that need to be
608 // restarted after load
609 // calculator.getRegisteredWorkersOfClass(settings.getWorkerClass())
612 Cache.log.debug("trigger update for " + calcId);
617 * Method called when another alignment's edit (or possibly other) command is
620 * To allow for sequence mappings (e.g. protein to cDNA), we have to first
621 * 'unwind' the command on the source sequences (in simulation, not in fact),
622 * and then for each edit in turn:
624 * <li>compute the equivalent edit on the mapped sequences</li>
625 * <li>apply the mapped edit</li>
626 * <li>'apply' the source edit to the working copy of the source
635 public void mirrorCommand(CommandI command, boolean undo,
636 StructureSelectionManager ssm, VamsasSource source)
639 * Do nothing unless we are a 'complement' of the source. May replace this
640 * with direct calls not via SSM.
642 if (source instanceof AlignViewportI
643 && ((AlignViewportI) source).getCodingComplement() == this)
652 CommandI mappedCommand = ssm.mapCommand(command, undo, getAlignment(),
654 if (mappedCommand != null)
656 AlignmentI[] views = getAlignPanel().alignFrame.getViewAlignments();
657 mappedCommand.doCommand(views);
658 getAlignPanel().alignmentChanged();
663 * Add the sequences from the given alignment to this viewport. Optionally,
664 * may give the user the option to open a new frame, or split panel, with cDNA
665 * and protein linked.
670 public void addAlignment(AlignmentI toAdd, String title)
672 // TODO: promote to AlignViewportI? applet CutAndPasteTransfer is different
674 // JBPComment: title is a largely redundant parameter at the moment
675 // JBPComment: this really should be an 'insert/pre/append' controller
676 // JBPComment: but the DNA/Protein check makes it a bit more complex
678 // refactored from FileLoader / CutAndPasteTransfer / SequenceFetcher with
680 // TODO: create undo object for this JAL-1101
683 * Ensure datasets are created for the new alignment as
684 * mappings operate on dataset sequences
686 toAdd.setDataset(null);
689 * Check if any added sequence could be the object of a mapping or
690 * cross-reference; if so, make the mapping explicit
692 getAlignment().realiseMappings(toAdd.getSequences());
695 * If any cDNA/protein mappings exist or can be made between the alignments,
696 * offer to open a split frame with linked alignments
698 if (Cache.getDefault(Preferences.ENABLE_SPLIT_FRAME, true))
700 if (AlignmentUtils.isMappable(toAdd, getAlignment()))
702 if (openLinkedAlignment(toAdd, title))
710 * No mappings, or offer declined - add sequences to this alignment
712 // TODO: JAL-407 regardless of above - identical sequences (based on ID and
713 // provenance) should share the same dataset sequence
715 AlignmentI al = getAlignment();
716 String gap = String.valueOf(al.getGapCharacter());
717 for (int i = 0; i < toAdd.getHeight(); i++)
719 SequenceI seq = toAdd.getSequenceAt(i);
722 * - 'align' any mapped sequences as per existing
723 * e.g. cdna to genome, domain hit to protein sequence
724 * very experimental! (need a separate menu option for this)
725 * - only add mapped sequences ('select targets from a dataset')
727 if (true /*AlignmentUtils.alignSequenceAs(seq, al, gap, true, true)*/)
733 ranges.setEndSeq(getAlignment().getHeight());
734 firePropertyChange("alignment", null, getAlignment().getSequences());
738 * Show a dialog with the option to open and link (cDNA <-> protein) as a new
739 * alignment, either as a standalone alignment or in a split frame. Returns
740 * true if the new alignment was opened, false if not, because the user
741 * declined the offer.
746 protected boolean openLinkedAlignment(AlignmentI al, String title)
748 String[] options = new String[] { MessageManager.getString("action.no"),
749 MessageManager.getString("label.split_window"),
750 MessageManager.getString("label.new_window"), };
751 final String question = JvSwingUtils.wrapTooltip(true,
752 MessageManager.getString("label.open_split_window?"));
753 int response = JvOptionPane.showOptionDialog(Desktop.desktop, question,
754 MessageManager.getString("label.open_split_window"),
755 JvOptionPane.DEFAULT_OPTION, JvOptionPane.PLAIN_MESSAGE, null,
756 options, options[0]);
758 if (response != 1 && response != 2)
762 final boolean openSplitPane = (response == 1);
763 final boolean openInNewWindow = (response == 2);
766 * Identify protein and dna alignments. Make a copy of this one if opening
767 * in a new split pane.
769 AlignmentI thisAlignment = openSplitPane ? new Alignment(getAlignment())
771 AlignmentI protein = al.isNucleotide() ? thisAlignment : al;
772 final AlignmentI cdna = al.isNucleotide() ? al : thisAlignment;
775 * Map sequences. At least one should get mapped as we have already passed
776 * the test for 'mappability'. Any mappings made will be added to the
777 * protein alignment. Note creating dataset sequences on the new alignment
778 * is a pre-requisite for building mappings.
781 AlignmentUtils.mapProteinAlignmentToCdna(protein, cdna);
784 * Create the AlignFrame for the added alignment. If it is protein, mappings
785 * are registered with StructureSelectionManager as a side-effect.
787 AlignFrame newAlignFrame = new AlignFrame(al, AlignFrame.DEFAULT_WIDTH,
788 AlignFrame.DEFAULT_HEIGHT);
789 newAlignFrame.setTitle(title);
790 newAlignFrame.statusBar.setText(MessageManager
791 .formatMessage("label.successfully_loaded_file", new Object[]
794 // TODO if we want this (e.g. to enable reload of the alignment from file),
795 // we will need to add parameters to the stack.
796 // if (!protocol.equals(DataSourceType.PASTE))
798 // alignFrame.setFileName(file, format);
803 Desktop.addInternalFrame(newAlignFrame, title,
804 AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
809 newAlignFrame.setMaximum(
810 jalview.bin.Cache.getDefault("SHOW_FULLSCREEN", false));
811 } catch (java.beans.PropertyVetoException ex)
817 al.alignAs(thisAlignment);
818 protein = openSplitFrame(newAlignFrame, thisAlignment);
825 * Helper method to open a new SplitFrame holding linked dna and protein
828 * @param newAlignFrame
829 * containing a new alignment to be shown
831 * cdna/protein complement alignment to show in the other split half
832 * @return the protein alignment in the split frame
834 protected AlignmentI openSplitFrame(AlignFrame newAlignFrame,
835 AlignmentI complement)
838 * Make a new frame with a copy of the alignment we are adding to. If this
839 * is protein, the mappings to cDNA will be registered with
840 * StructureSelectionManager as a side-effect.
842 AlignFrame copyMe = new AlignFrame(complement, AlignFrame.DEFAULT_WIDTH,
843 AlignFrame.DEFAULT_HEIGHT);
844 copyMe.setTitle(getAlignPanel().alignFrame.getTitle());
846 AlignmentI al = newAlignFrame.viewport.getAlignment();
847 final AlignFrame proteinFrame = al.isNucleotide() ? copyMe
849 final AlignFrame cdnaFrame = al.isNucleotide() ? newAlignFrame : copyMe;
850 cdnaFrame.setVisible(true);
851 proteinFrame.setVisible(true);
852 String linkedTitle = MessageManager
853 .getString("label.linked_view_title");
856 * Open in split pane. DNA sequence above, protein below.
858 JInternalFrame splitFrame = new SplitFrame(cdnaFrame, proteinFrame);
859 Desktop.addInternalFrame(splitFrame, linkedTitle, -1, -1);
861 return proteinFrame.viewport.getAlignment();
864 public AnnotationColumnChooser getAnnotationColumnSelectionState()
866 return annotationColumnSelectionState;
869 public void setAnnotationColumnSelectionState(
870 AnnotationColumnChooser currentAnnotationColumnSelectionState)
872 this.annotationColumnSelectionState = currentAnnotationColumnSelectionState;
876 public void setIdWidth(int i)
879 AlignmentPanel ap = getAlignPanel();
882 // modify GUI elements to reflect geometry change
883 Dimension idw = getAlignPanel().getIdPanel().getIdCanvas()
886 getAlignPanel().getIdPanel().getIdCanvas().setPreferredSize(idw);
890 public Rectangle getExplodedGeometry()
892 return explodedGeometry;
895 public void setExplodedGeometry(Rectangle explodedPosition)
897 this.explodedGeometry = explodedPosition;
900 public boolean isGatherViewsHere()
902 return gatherViewsHere;
905 public void setGatherViewsHere(boolean gatherViewsHere)
907 this.gatherViewsHere = gatherViewsHere;
911 * If this viewport has a (Protein/cDNA) complement, then scroll the
912 * complementary alignment to match this one.
914 public void scrollComplementaryAlignment()
917 * Populate a SearchResults object with the mapped location to scroll to. If
918 * there is no complement, or it is not following highlights, or no mapping
919 * is found, the result will be empty.
921 SearchResultsI sr = new SearchResults();
922 int verticalOffset = findComplementScrollTarget(sr);
925 // TODO would like next line without cast but needs more refactoring...
926 final AlignmentPanel complementPanel = ((AlignViewport) getCodingComplement())
928 complementPanel.setToScrollComplementPanel(false);
929 complementPanel.scrollToCentre(sr, verticalOffset);
930 complementPanel.setToScrollComplementPanel(true);
935 * Answers true if no alignment holds a reference to the given mapping
940 protected boolean noReferencesTo(AlignedCodonFrame acf)
942 AlignFrame[] frames = Desktop.getAlignFrames();
947 for (AlignFrame af : frames)
951 for (AlignmentViewPanel ap : af.getAlignPanels())
953 AlignmentI al = ap.getAlignment();
954 if (al != null && al.getCodonFrames().contains(acf))
965 * Applies the supplied feature settings descriptor to currently known
966 * features. This supports an 'initial configuration' of feature colouring
967 * based on a preset or user favourite. This may then be modified in the usual
968 * way using the Feature Settings dialogue.
970 * @param featureSettings
973 public void applyFeaturesStyle(FeatureSettingsModelI featureSettings)
975 if (featureSettings == null)
980 FeatureRenderer fr = getAlignPanel().getSeqPanel().seqCanvas
981 .getFeatureRenderer();
982 fr.findAllFeatures(true);
983 List<String> renderOrder = fr.getRenderOrder();
984 FeaturesDisplayedI displayed = fr.getFeaturesDisplayed();
986 // TODO this clears displayed.featuresRegistered - do we care?
989 * set feature colour if specified by feature settings
990 * set visibility of all features
992 for (String type : renderOrder)
994 FeatureColourI preferredColour = featureSettings
995 .getFeatureColour(type);
996 if (preferredColour != null)
998 fr.setColour(type, preferredColour);
1000 if (featureSettings.isFeatureDisplayed(type))
1002 displayed.setVisible(type);
1007 * set visibility of feature groups
1009 for (String group : fr.getFeatureGroups())
1011 fr.setGroupVisibility(group, featureSettings.isGroupDisplayed(group));
1015 * order the features
1017 if (featureSettings.optimiseOrder())
1019 // TODO not supported (yet?)
1023 fr.orderFeatures(featureSettings);
1025 fr.setTransparency(featureSettings.getTransparency());