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.
22 * Jalview - A Sequence Alignment Editor and Viewer
23 * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
25 * This program is free software; you can redistribute it and/or
26 * modify it under the terms of the GNU General Public License
27 * as published by the Free Software Foundation; either version 2
28 * of the License, or (at your option) any later version.
30 * This program is distributed in the hope that it will be useful,
31 * but WITHOUT ANY WARRANTY; without even the implied warranty of
32 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 * GNU General Public License for more details.
35 * You should have received a copy of the GNU General Public License
36 * along with this program; if not, write to the Free Software
37 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
41 import jalview.analysis.AlignmentUtils;
42 import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
43 import jalview.analysis.NJTree;
44 import jalview.api.AlignViewportI;
45 import jalview.api.ViewStyleI;
46 import jalview.bin.Cache;
47 import jalview.commands.CommandI;
48 import jalview.datamodel.AlignedCodonFrame;
49 import jalview.datamodel.Alignment;
50 import jalview.datamodel.AlignmentI;
51 import jalview.datamodel.ColumnSelection;
52 import jalview.datamodel.PDBEntry;
53 import jalview.datamodel.SearchResults;
54 import jalview.datamodel.Sequence;
55 import jalview.datamodel.SequenceGroup;
56 import jalview.datamodel.SequenceI;
57 import jalview.schemes.ColourSchemeProperty;
58 import jalview.schemes.UserColourScheme;
59 import jalview.structure.CommandListener;
60 import jalview.structure.SelectionSource;
61 import jalview.structure.StructureSelectionManager;
62 import jalview.structure.VamsasSource;
63 import jalview.util.MessageManager;
64 import jalview.viewmodel.AlignmentViewport;
65 import jalview.ws.params.AutoCalcSetting;
67 import java.awt.Container;
68 import java.awt.Dimension;
70 import java.awt.Rectangle;
71 import java.util.ArrayList;
72 import java.util.Hashtable;
73 import java.util.List;
75 import java.util.Vector;
77 import javax.swing.JInternalFrame;
78 import javax.swing.JOptionPane;
84 * @version $Revision: 1.141 $
86 public class AlignViewport extends AlignmentViewport implements
87 SelectionSource, CommandListener
91 NJTree currentTree = null;
93 boolean cursorMode = false;
95 boolean antiAlias = false;
97 private Rectangle explodedGeometry;
102 * Flag set true on the view that should 'gather' multiple views of the same
103 * sequence set id when a project is reloaded. Set false on all views when
104 * they are 'exploded' into separate windows. Set true on the current view
105 * when 'Gather' is performed, and also on the first tab when the first new
108 private boolean gatherViewsHere = false;
110 private AnnotationColumnChooser annotationColumnSelectionState;
112 * Creates a new AlignViewport object.
117 public AlignViewport(AlignmentI al)
124 * Create a new AlignViewport object with a specific sequence set ID
128 * (may be null - but potential for ambiguous constructor exception)
130 public AlignViewport(AlignmentI al, String seqsetid)
132 this(al, seqsetid, null);
135 public AlignViewport(AlignmentI al, String seqsetid, String viewid)
137 sequenceSetID = seqsetid;
139 // TODO remove these once 2.4.VAMSAS release finished
140 if (Cache.log != null && Cache.log.isDebugEnabled() && seqsetid != null)
142 Cache.log.debug("Setting viewport's sequence set id : "
145 if (Cache.log != null && Cache.log.isDebugEnabled() && viewId != null)
147 Cache.log.debug("Setting viewport's view id : " + viewId);
154 * Create a new AlignViewport with hidden regions
158 * @param hiddenColumns
161 public AlignViewport(AlignmentI al, ColumnSelection hiddenColumns)
164 if (hiddenColumns != null)
166 colSel = hiddenColumns;
172 * New viewport with hidden columns and an existing sequence set id
175 * @param hiddenColumns
179 public AlignViewport(AlignmentI al, ColumnSelection hiddenColumns,
182 this(al, hiddenColumns, seqsetid, null);
186 * New viewport with hidden columns and an existing sequence set id and viewid
189 * @param hiddenColumns
195 public AlignViewport(AlignmentI al, ColumnSelection hiddenColumns,
196 String seqsetid, String viewid)
198 sequenceSetID = seqsetid;
200 // TODO remove these once 2.4.VAMSAS release finished
201 if (Cache.log != null && Cache.log.isDebugEnabled() && seqsetid != null)
203 Cache.log.debug("Setting viewport's sequence set id : "
206 if (Cache.log != null && Cache.log.isDebugEnabled() && viewId != null)
208 Cache.log.debug("Setting viewport's view id : " + viewId);
211 if (hiddenColumns != null)
213 colSel = hiddenColumns;
219 * Apply any settings saved in user preferences
221 private void applyViewProperties()
223 antiAlias = Cache.getDefault("ANTI_ALIAS", false);
225 viewStyle.setShowJVSuffix(Cache.getDefault("SHOW_JVSUFFIX", true));
226 setShowAnnotation(Cache.getDefault("SHOW_ANNOTATIONS", true));
228 setRightAlignIds(Cache.getDefault("RIGHT_ALIGN_IDS", false));
229 setCentreColumnLabels(Cache.getDefault("CENTRE_COLUMN_LABELS", false));
230 autoCalculateConsensus = Cache.getDefault("AUTO_CALC_CONSENSUS", true);
232 setPadGaps(Cache.getDefault("PAD_GAPS", true));
233 setShowNPFeats(Cache.getDefault("SHOW_NPFEATS_TOOLTIP", true));
234 setShowDBRefs(Cache.getDefault("SHOW_DBREFS_TOOLTIP", true));
235 viewStyle.setSeqNameItalics(Cache.getDefault("ID_ITALICS", true));
236 viewStyle.setWrapAlignment(Cache.getDefault("WRAP_ALIGNMENT", false));
237 viewStyle.setShowUnconserved(Cache
238 .getDefault("SHOW_UNCONSERVED", false));
239 sortByTree = Cache.getDefault("SORT_BY_TREE", false);
240 followSelection = Cache.getDefault("FOLLOW_SELECTIONS", true);
241 sortAnnotationsBy = SequenceAnnotationOrder.valueOf(Cache.getDefault(
242 Preferences.SORT_ANNOTATIONS,
243 SequenceAnnotationOrder.NONE.name()));
244 showAutocalculatedAbove = Cache.getDefault(
245 Preferences.SHOW_AUTOCALC_ABOVE, false);
246 viewStyle.setScaleProteinAsCdna(Cache.getDefault(
247 Preferences.SCALE_PROTEIN_TO_CDNA, true));
253 this.endRes = alignment.getWidth() - 1;
255 this.endSeq = alignment.getHeight() - 1;
256 applyViewProperties();
258 String fontName = Cache.getDefault("FONT_NAME", "SansSerif");
259 String fontStyle = Cache.getDefault("FONT_STYLE", Font.PLAIN + "");
260 String fontSize = Cache.getDefault("FONT_SIZE", "10");
264 if (fontStyle.equals("bold"))
268 else if (fontStyle.equals("italic"))
273 setFont(new Font(fontName, style, Integer.parseInt(fontSize)), true);
276 .setGapCharacter(Cache.getDefault("GAP_SYMBOL", "-").charAt(0));
278 // We must set conservation and consensus before setting colour,
279 // as Blosum and Clustal require this to be done
280 if (hconsensus == null && !isDataset)
282 if (!alignment.isNucleotide())
284 showConservation = Cache.getDefault("SHOW_CONSERVATION", true);
285 showQuality = Cache.getDefault("SHOW_QUALITY", true);
286 showGroupConservation = Cache.getDefault("SHOW_GROUP_CONSERVATION",
289 showConsensusHistogram = Cache.getDefault("SHOW_CONSENSUS_HISTOGRAM",
291 showSequenceLogo = Cache.getDefault("SHOW_CONSENSUS_LOGO", false);
292 normaliseSequenceLogo = Cache.getDefault("NORMALISE_CONSENSUS_LOGO",
294 showGroupConsensus = Cache.getDefault("SHOW_GROUP_CONSENSUS", false);
295 showConsensus = Cache.getDefault("SHOW_IDENTITY", true);
297 initAutoAnnotation();
298 String colourProperty = alignment.isNucleotide() ? Preferences.DEFAULT_COLOUR_NUC
299 : Preferences.DEFAULT_COLOUR_PROT;
300 String propertyValue = Cache.getProperty(colourProperty);
301 if (propertyValue == null)
303 // fall back on this property for backwards compatibility
304 propertyValue = Cache.getProperty(Preferences.DEFAULT_COLOUR);
306 if (propertyValue != null)
308 globalColourScheme = ColourSchemeProperty.getColour(alignment,
311 if (globalColourScheme instanceof UserColourScheme)
313 globalColourScheme = UserDefinedColours.loadDefaultColours();
314 ((UserColourScheme) globalColourScheme).setThreshold(0,
315 isIgnoreGapsConsensus());
318 if (globalColourScheme != null)
320 globalColourScheme.setConsensus(hconsensus);
326 * get the consensus sequence as displayed under the PID consensus annotation
329 * @return consensus sequence as a new sequence object
331 public SequenceI getConsensusSeq()
333 if (consensus == null)
335 updateConsensus(null);
337 if (consensus == null)
341 StringBuffer seqs = new StringBuffer();
342 for (int i = 0; i < consensus.annotations.length; i++)
344 if (consensus.annotations[i] != null)
346 if (consensus.annotations[i].description.charAt(0) == '[')
348 seqs.append(consensus.annotations[i].description.charAt(1));
352 seqs.append(consensus.annotations[i].displayCharacter);
357 SequenceI sq = new Sequence("Consensus", seqs.toString());
358 sq.setDescription("Percentage Identity Consensus "
359 + ((ignoreGapsInConsensusCalculation) ? " without gaps" : ""));
363 boolean validCharWidth;
366 * update view settings with the given font. You may need to call
367 * alignPanel.fontChanged to update the layout geometry
370 * when true, charWidth/height is set according to font mentrics
372 public void setFont(Font f, boolean setGrid)
376 Container c = new Container();
378 java.awt.FontMetrics fm = c.getFontMetrics(font);
379 int w = viewStyle.getCharWidth(), ww = fm.charWidth('M'), h = viewStyle
383 setCharHeight(fm.getHeight());
386 viewStyle.setFontName(font.getName());
387 viewStyle.setFontStyle(font.getStyle());
388 viewStyle.setFontSize(font.getSize());
390 validCharWidth = true;
394 public void setViewStyle(ViewStyleI settingsForView)
396 super.setViewStyle(settingsForView);
397 setFont(new Font(viewStyle.getFontName(), viewStyle.getFontStyle(),
398 viewStyle.getFontSize()), false);
404 * @return DOCUMENT ME!
406 public Font getFont()
417 public void setAlignment(AlignmentI align)
419 if (alignment != null && alignment.getCodonFrames() != null)
421 StructureSelectionManager.getStructureSelectionManager(
422 Desktop.instance).removeMappings(alignment.getCodonFrames());
424 this.alignment = align;
425 if (alignment != null && alignment.getCodonFrames() != null)
427 StructureSelectionManager.getStructureSelectionManager(
428 Desktop.instance).addMappings(alignment.getCodonFrames());
435 * @return DOCUMENT ME!
437 public char getGapCharacter()
439 return getAlignment().getGapCharacter();
448 public void setGapCharacter(char gap)
450 if (getAlignment() != null)
452 getAlignment().setGapCharacter(gap);
459 * @return DOCUMENT ME!
461 public ColumnSelection getColumnSelection()
472 public void setCurrentTree(NJTree tree)
480 * @return DOCUMENT ME!
482 public NJTree getCurrentTree()
488 * returns the visible column regions of the alignment
490 * @param selectedRegionOnly
491 * true to just return the contigs intersecting with the selected
495 public int[] getViewAsVisibleContigs(boolean selectedRegionOnly)
497 int[] viscontigs = null;
498 int start = 0, end = 0;
499 if (selectedRegionOnly && selectionGroup != null)
501 start = selectionGroup.getStartRes();
502 end = selectionGroup.getEndRes() + 1;
506 end = alignment.getWidth();
508 viscontigs = colSel.getVisibleContigs(start, end);
513 * get hash of undo and redo list for the alignment
515 * @return long[] { historyList.hashCode, redoList.hashCode };
517 public long[] getUndoRedoHash()
520 if (historyList == null || redoList == null)
526 { historyList.hashCode(), this.redoList.hashCode() };
530 * test if a particular set of hashcodes are different to the hashcodes for
531 * the undo and redo list.
534 * the stored set of hashcodes as returned by getUndoRedoHash
535 * @return true if the hashcodes differ (ie the alignment has been edited) or
536 * the stored hashcode array differs in size
538 public boolean isUndoRedoHashModified(long[] undoredo)
540 if (undoredo == null)
544 long[] cstate = getUndoRedoHash();
545 if (cstate.length != undoredo.length)
550 for (int i = 0; i < cstate.length; i++)
552 if (cstate[i] != undoredo[i])
560 public boolean followSelection = true;
563 * @return true if view selection should always follow the selections
564 * broadcast by other selection sources
566 public boolean getFollowSelection()
568 return followSelection;
572 * Send the current selection to be broadcast to any selection listeners.
574 public void sendSelection()
576 jalview.structure.StructureSelectionManager
577 .getStructureSelectionManager(Desktop.instance).sendSelection(
578 new SequenceGroup(getSelectionGroup()),
579 new ColumnSelection(getColumnSelection()), this);
583 * return the alignPanel containing the given viewport. Use this to get the
584 * components currently handling the given viewport.
587 * @return null or an alignPanel guaranteed to have non-null alignFrame
590 public AlignmentPanel getAlignPanel()
592 AlignmentPanel[] aps = PaintRefresher.getAssociatedPanels(this
593 .getSequenceSetId());
594 for (int p = 0; aps != null && p < aps.length; p++)
596 if (aps[p].av == this)
604 public boolean getSortByTree()
609 public void setSortByTree(boolean sort)
615 * synthesize a column selection if none exists so it covers the given
616 * selection group. if wholewidth is false, no column selection is made if the
617 * selection group covers the whole alignment width.
622 public void expandColSelection(SequenceGroup sg, boolean wholewidth)
626 && (sgs = sg.getStartRes()) >= 0
627 && sg.getStartRes() <= (sge = sg.getEndRes())
628 && (colSel == null || colSel.getSelected() == null || colSel
629 .getSelected().size() == 0))
631 if (!wholewidth && alignment.getWidth() == (1 + sge - sgs))
638 colSel = new ColumnSelection();
640 for (int cspos = sg.getStartRes(); cspos <= sg.getEndRes(); cspos++)
642 colSel.addElement(cspos);
648 * Returns the (Desktop) instance of the StructureSelectionManager
651 public StructureSelectionManager getStructureSelectionManager()
653 return StructureSelectionManager
654 .getStructureSelectionManager(Desktop.instance);
660 * @return an array of SequenceI arrays, one for each PDBEntry, listing which
661 * sequences in the alignment hold a reference to it
663 public SequenceI[][] collateForPDB(PDBEntry[] pdbEntries)
665 List<SequenceI[]> seqvectors = new ArrayList<SequenceI[]>();
666 for (PDBEntry pdb : pdbEntries)
668 List<SequenceI> seqs = new ArrayList<SequenceI>();
669 for (SequenceI sq : alignment.getSequences())
671 Vector<PDBEntry> pdbs = sq
672 .getDatasetSequence().getPDBId();
677 for (PDBEntry p1 : pdbs)
679 if (p1.getId().equals(pdb.getId()))
681 if (!seqs.contains(sq))
689 seqvectors.add(seqs.toArray(new SequenceI[seqs.size()]));
691 return seqvectors.toArray(new SequenceI[seqvectors.size()][]);
694 public boolean isNormaliseSequenceLogo()
696 return normaliseSequenceLogo;
699 public void setNormaliseSequenceLogo(boolean state)
701 normaliseSequenceLogo = state;
706 * @return true if alignment characters should be displayed
708 public boolean isValidCharWidth()
710 return validCharWidth;
713 private Hashtable<String, AutoCalcSetting> calcIdParams = new Hashtable<String, AutoCalcSetting>();
715 public AutoCalcSetting getCalcIdSettingsFor(String calcId)
717 return calcIdParams.get(calcId);
720 public void setCalcIdSettingsFor(String calcId, AutoCalcSetting settings,
723 calcIdParams.put(calcId, settings);
724 // TODO: create a restart list to trigger any calculations that need to be
725 // restarted after load
726 // calculator.getRegisteredWorkersOfClass(settings.getWorkerClass())
729 Cache.log.debug("trigger update for " + calcId);
734 * Method called when another alignment's edit (or possibly other) command is
737 * To allow for sequence mappings (e.g. protein to cDNA), we have to first
738 * 'unwind' the command on the source sequences (in simulation, not in fact),
739 * and then for each edit in turn:
741 * <li>compute the equivalent edit on the mapped sequences</li>
742 * <li>apply the mapped edit</li>
743 * <li>'apply' the source edit to the working copy of the source sequences</li>
751 public void mirrorCommand(CommandI command, boolean undo,
752 StructureSelectionManager ssm, VamsasSource source)
755 * Do nothing unless we are a 'complement' of the source. May replace this
756 * with direct calls not via SSM.
758 if (source instanceof AlignViewportI
759 && ((AlignViewportI) source).getCodingComplement() == this)
768 CommandI mappedCommand = ssm.mapCommand(command, undo, getAlignment(),
770 if (mappedCommand != null)
772 AlignmentI[] views = getAlignPanel().alignFrame.getViewAlignments();
773 mappedCommand.doCommand(views);
774 getAlignPanel().alignmentChanged();
779 * Add the sequences from the given alignment to this viewport. Optionally,
780 * may give the user the option to open a new frame, or split panel, with cDNA
781 * and protein linked.
786 public void addAlignment(AlignmentI al, String title)
788 // TODO: promote to AlignViewportI? applet CutAndPasteTransfer is different
790 // JBPComment: title is a largely redundant parameter at the moment
791 // JBPComment: this really should be an 'insert/pre/append' controller
792 // JBPComment: but the DNA/Protein check makes it a bit more complex
794 // refactored from FileLoader / CutAndPasteTransfer / SequenceFetcher with
796 // TODO: create undo object for this JAL-1101
799 * If any cDNA/protein mappings can be made between the alignments, offer to
800 * open a linked alignment with split frame option.
802 if (Cache.getDefault(Preferences.ENABLE_SPLIT_FRAME, true))
804 if (AlignmentUtils.isMappable(al, getAlignment()))
806 if (openLinkedAlignment(al, title))
814 * No mappings, or offer declined - add sequences to this alignment
816 // TODO: JAL-407 regardless of above - identical sequences (based on ID and
817 // provenance) should share the same dataset sequence
819 for (int i = 0; i < al.getHeight(); i++)
821 getAlignment().addSequence(al.getSequenceAt(i));
824 setEndSeq(getAlignment().getHeight());
825 firePropertyChange("alignment", null, getAlignment().getSequences());
829 * Show a dialog with the option to open and link (cDNA <-> protein) as a new
830 * alignment, either as a standalone alignment or in a split frame. Returns
831 * true if the new alignment was opened, false if not, because the user
832 * declined the offer.
837 protected boolean openLinkedAlignment(AlignmentI al, String title)
839 String[] options = new String[]
840 { MessageManager.getString("action.no"),
841 MessageManager.getString("label.split_window"),
842 MessageManager.getString("label.new_window"), };
843 final String question = JvSwingUtils.wrapTooltip(true,
844 MessageManager.getString("label.open_split_window?"));
845 int response = JOptionPane.showOptionDialog(Desktop.desktop, question,
846 MessageManager.getString("label.open_split_window"),
847 JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null,
848 options, options[0]);
850 if (response != 1 && response != 2)
854 final boolean openSplitPane = (response == 1);
855 final boolean openInNewWindow = (response == 2);
858 * Identify protein and dna alignments. Make a copy of this one if opening
859 * in a new split pane.
861 AlignmentI thisAlignment = openSplitPane ? new Alignment(getAlignment())
863 AlignmentI protein = al.isNucleotide() ? thisAlignment : al;
864 final AlignmentI cdna = al.isNucleotide() ? al : thisAlignment;
867 * Map sequences. At least one should get mapped as we have already passed
868 * the test for 'mappability'. Any mappings made will be added to the
869 * protein alignment. Note creating dataset sequences on the new alignment
870 * is a pre-requisite for building mappings.
873 AlignmentUtils.mapProteinToCdna(protein, cdna);
876 * Create the AlignFrame for the added alignment. Note this will include the
877 * cDNA consensus annotation if it is protein (because the alignment holds
878 * mappings to nucleotide)
880 AlignFrame newAlignFrame = new AlignFrame(al, AlignFrame.DEFAULT_WIDTH,
881 AlignFrame.DEFAULT_HEIGHT);
882 newAlignFrame.setTitle(title);
883 newAlignFrame.statusBar.setText(MessageManager.formatMessage(
884 "label.successfully_loaded_file", new Object[]
887 // TODO if we want this (e.g. to enable reload of the alignment from file),
888 // we will need to add parameters to the stack.
889 // if (!protocol.equals(AppletFormatAdapter.PASTE))
891 // alignFrame.setFileName(file, format);
896 Desktop.addInternalFrame(newAlignFrame, title,
897 AlignFrame.DEFAULT_WIDTH,
898 AlignFrame.DEFAULT_HEIGHT);
903 newAlignFrame.setMaximum(jalview.bin.Cache.getDefault(
906 } catch (java.beans.PropertyVetoException ex)
912 protein = openSplitFrame(newAlignFrame, thisAlignment,
913 protein.getCodonFrames());
917 * Register the mappings (held on the protein alignment) with the
918 * StructureSelectionManager (for mouseover linking).
920 final StructureSelectionManager ssm = StructureSelectionManager
921 .getStructureSelectionManager(Desktop.instance);
922 ssm.addMappings(protein.getCodonFrames());
928 * Helper method to open a new SplitFrame holding linked dna and protein
931 * @param newAlignFrame
932 * containing a new alignment to be shown
934 * cdna/protein complement alignment to show in the other split half
936 * @return the protein alignment in the split frame
938 protected AlignmentI openSplitFrame(AlignFrame newAlignFrame,
939 AlignmentI complement, Set<AlignedCodonFrame> mappings)
942 * Make a new frame with a copy of the alignment we are adding to. If this
943 * is protein, the new frame will have a cDNA consensus annotation row
946 AlignFrame copyMe = new AlignFrame(complement,
947 AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
948 copyMe.setTitle(getAlignPanel().alignFrame.getTitle());
950 AlignmentI al = newAlignFrame.viewport.getAlignment();
951 final AlignFrame proteinFrame = al.isNucleotide() ? copyMe
953 final AlignFrame cdnaFrame = al.isNucleotide() ? newAlignFrame
955 AlignmentI protein = proteinFrame.viewport.getAlignment();
956 protein.setCodonFrames(mappings);
958 cdnaFrame.setVisible(true);
959 proteinFrame.setVisible(true);
960 String linkedTitle = MessageManager
961 .getString("label.linked_view_title");
964 * Open in split pane. DNA sequence above, protein below.
966 JInternalFrame splitFrame = new SplitFrame(cdnaFrame, proteinFrame);
967 Desktop.addInternalFrame(splitFrame, linkedTitle, -1, -1);
972 public AnnotationColumnChooser getAnnotationColumnSelectionState()
974 return annotationColumnSelectionState;
977 public void setAnnotationColumnSelectionState(
978 AnnotationColumnChooser currentAnnotationColumnSelectionState)
980 this.annotationColumnSelectionState = currentAnnotationColumnSelectionState;
984 public void setIdWidth(int i)
987 AlignmentPanel ap = getAlignPanel();
990 // modify GUI elements to reflect geometry change
991 Dimension idw = getAlignPanel().getIdPanel().getIdCanvas()
994 getAlignPanel().getIdPanel().getIdCanvas().setPreferredSize(idw);
998 public Rectangle getExplodedGeometry()
1000 return explodedGeometry;
1003 public void setExplodedGeometry(Rectangle explodedPosition)
1005 this.explodedGeometry = explodedPosition;
1008 public boolean isGatherViewsHere()
1010 return gatherViewsHere;
1013 public void setGatherViewsHere(boolean gatherViewsHere)
1015 this.gatherViewsHere = gatherViewsHere;
1019 * If this viewport has a (Protein/cDNA) complement, then scroll the
1020 * complementary alignment to match this one.
1022 public void scrollComplementaryAlignment()
1025 * Populate a SearchResults object with the mapped location to scroll to. If
1026 * there is no complement, or it is not following highlights, or no mapping
1027 * is found, the result will be empty.
1029 SearchResults sr = new SearchResults();
1030 int seqOffset = findComplementScrollTarget(sr);
1033 // TODO would like next line without cast but needs more refactoring...
1034 final AlignmentPanel complementPanel = ((AlignViewport) getCodingComplement()).getAlignPanel();
1035 complementPanel.setFollowingComplementScroll(true);
1036 complementPanel.scrollToCentre(sr, seqOffset);