/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
* Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
+ *\r
* This file is part of Jalview.\r
- * \r
+ *\r
* Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
+ * modify it under the terms of the GNU General Public License\r
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
+ *\r
+ * Jalview is distributed in the hope that it will be useful, but\r
+ * WITHOUT ANY WARRANTY; without even the implied warranty\r
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
* PURPOSE. See the GNU General Public License for more details.\r
- * \r
+ *\r
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
package jalview.appletgui;\r
\r
-import java.net.*;\r
-import java.util.*;\r
-\r
-import java.awt.*;\r
-import java.awt.event.*;\r
-\r
-import jalview.analysis.*;\r
+import jalview.analysis.AAFrequency;\r
+import jalview.analysis.AlignmentSorter;\r
+import jalview.analysis.Conservation;\r
import jalview.api.SequenceStructureBinding;\r
import jalview.bin.JalviewLite;\r
-import jalview.commands.*;\r
-import jalview.datamodel.*;\r
-import jalview.io.*;\r
-import jalview.schemes.*;\r
+import jalview.commands.CommandI;\r
+import jalview.commands.EditCommand;\r
+import jalview.commands.OrderCommand;\r
+import jalview.commands.RemoveGapColCommand;\r
+import jalview.commands.RemoveGapsCommand;\r
+import jalview.commands.SlideSequencesCommand;\r
+import jalview.commands.TrimRegionCommand;\r
+import jalview.datamodel.Alignment;\r
+import jalview.datamodel.AlignmentI;\r
+import jalview.datamodel.AlignmentOrder;\r
+import jalview.datamodel.ColumnSelection;\r
+import jalview.datamodel.PDBEntry;\r
+import jalview.datamodel.Sequence;\r
+import jalview.datamodel.SequenceCollectionI;\r
+import jalview.datamodel.SequenceGroup;\r
+import jalview.datamodel.SequenceI;\r
+import jalview.io.AnnotationFile;\r
+import jalview.io.AppletFormatAdapter;\r
+import jalview.io.FeaturesFile;\r
+import jalview.io.TCoffeeScoreFile;\r
+import jalview.schemes.Blosum62ColourScheme;\r
+import jalview.schemes.BuriedColourScheme;\r
+import jalview.schemes.ClustalxColourScheme;\r
+import jalview.schemes.ColourSchemeI;\r
+import jalview.schemes.HelixColourScheme;\r
+import jalview.schemes.HydrophobicColourScheme;\r
+import jalview.schemes.NucleotideColourScheme;\r
+import jalview.schemes.PIDColourScheme;\r
+import jalview.schemes.PurinePyrimidineColourScheme;\r
+import jalview.schemes.RNAHelicesColourChooser;\r
+import jalview.schemes.ResidueProperties;\r
+import jalview.schemes.StrandColourScheme;\r
+import jalview.schemes.TCoffeeColourScheme;\r
+import jalview.schemes.TaylorColourScheme;\r
+import jalview.schemes.TurnColourScheme;\r
+import jalview.schemes.ZappoColourScheme;\r
import jalview.structure.StructureSelectionManager;\r
\r
+import java.awt.BorderLayout;\r
+import java.awt.Canvas;\r
+import java.awt.CheckboxMenuItem;\r
+import java.awt.Color;\r
+import java.awt.Font;\r
+import java.awt.FontMetrics;\r
+import java.awt.Frame;\r
+import java.awt.Graphics;\r
+import java.awt.Label;\r
+import java.awt.Menu;\r
+import java.awt.MenuBar;\r
+import java.awt.MenuItem;\r
+import java.awt.event.ActionEvent;\r
+import java.awt.event.ActionListener;\r
+import java.awt.event.FocusEvent;\r
+import java.awt.event.FocusListener;\r
+import java.awt.event.ItemEvent;\r
+import java.awt.event.ItemListener;\r
+import java.awt.event.KeyEvent;\r
+import java.awt.event.KeyListener;\r
+import java.awt.event.WindowAdapter;\r
+import java.awt.event.WindowEvent;\r
+import java.io.IOException;\r
+import java.io.InputStreamReader;\r
+import java.net.URL;\r
+import java.net.URLEncoder;\r
+import java.util.Enumeration;\r
+import java.util.Hashtable;\r
+import java.util.List;\r
+import java.util.StringTokenizer;\r
+import java.util.Vector;\r
+\r
public class AlignFrame extends EmbmenuFrame implements ActionListener,\r
ItemListener, KeyListener\r
{\r
public AlignFrame(AlignmentI al, jalview.bin.JalviewLite applet,\r
String title, boolean embedded)\r
{\r
-\r
if (applet != null)\r
{\r
jalviewServletURL = applet.getParameter("APPLICATION_URL");\r
viewport.updateConsensus(alignPanel);\r
\r
annotationPanelMenuItem.setState(viewport.showAnnotation);\r
- displayNonconservedMenuItem.setState(viewport.getShowunconserved());\r
+ displayNonconservedMenuItem.setState(viewport.getShowUnconserved());\r
followMouseOverFlag.setState(viewport.getFollowHighlight());\r
- showGroupConsensus.setState(viewport.showGroupConsensus);\r
- showGroupConservation.setState(viewport.showGroupConservation);\r
- showConsensusHistogram.setState(viewport.showConsensusHistogram);\r
- showSequenceLogo.setState(viewport.showSequenceLogo);\r
+ showGroupConsensus.setState(viewport.isShowGroupConsensus());\r
+ showGroupConservation.setState(viewport.isShowGroupConservation());\r
+ showConsensusHistogram.setState(viewport.isShowConsensusHistogram());\r
+ showSequenceLogo.setState(viewport.isShowSequenceLogo());\r
+ normSequenceLogo.setState(viewport.isNormaliseSequenceLogo());\r
\r
seqLimits.setState(viewport.showJVSuffix);\r
\r
}\r
\r
}\r
-\r
+ if (viewport.getAlignment().isNucleotide())\r
+ {\r
+ viewport.updateStrucConsensus(alignPanel);\r
+ if (viewport.getAlignment().hasRNAStructure())\r
+ {\r
+ RNAHelixColour.setEnabled(true);\r
+ }\r
+ else\r
+ {\r
+ RNAHelixColour.setEnabled(false);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ RNAHelixColour.setEnabled(false);\r
+ purinePyrimidineColour.setEnabled(false);\r
+ }\r
// Some JVMS send keyevents to Top frame or lowest panel,\r
// Havent worked out why yet. So add to both this frame and seqCanvas for\r
// now\r
/**\r
* Load a features file onto the alignment\r
* \r
- * @param file file URL, content, or other resolvable path\r
- * @param type is protocol for accessing data referred to by file\r
+ * @param file\r
+ * file URL, content, or other resolvable path\r
+ * @param type\r
+ * is protocol for accessing data referred to by file\r
*/\r
\r
- public void parseFeaturesFile(String file, String type)\r
+ public boolean parseFeaturesFile(String file, String type)\r
{\r
- parseFeaturesFile(file, type, true);\r
+ return parseFeaturesFile(file, type, true);\r
}\r
- \r
+\r
/**\r
* Load a features file onto the alignment\r
* \r
- * @param file file URL, content, or other resolvable path\r
- * @param type is protocol for accessing data referred to by file\r
- * @param autoenabledisplay when true, display features flag will be automatically enabled if features are loaded\r
+ * @param file\r
+ * file URL, content, or other resolvable path\r
+ * @param type\r
+ * is protocol for accessing data referred to by file\r
+ * @param autoenabledisplay\r
+ * when true, display features flag will be automatically enabled if\r
+ * features are loaded\r
+ * @return true if data parsed as a features file\r
*/\r
- public void parseFeaturesFile(String file, String type, boolean autoenabledisplay)\r
- { \r
+ public boolean parseFeaturesFile(String file, String type,\r
+ boolean autoenabledisplay)\r
+ {\r
+ // TODO: test if importing a features file onto an alignment which already\r
+ // has features with links overwrites the original links.\r
+\r
Hashtable featureLinks = new Hashtable();\r
boolean featuresFile = false;\r
try\r
{\r
featuresFile = new jalview.io.FeaturesFile(file, type)\r
- .parse(viewport.alignment,\r
- alignPanel.seqPanel.seqCanvas.getFeatureRenderer().featureColours,\r
- featureLinks, true, viewport.applet.getDefaultParameter("relaxedidmatch", false));\r
+ .parse(viewport.getAlignment(), alignPanel.seqPanel.seqCanvas\r
+ .getFeatureRenderer().featureColours, featureLinks,\r
+ true, viewport.applet.getDefaultParameter(\r
+ "relaxedidmatch", false));\r
} catch (Exception ex)\r
{\r
ex.printStackTrace();\r
viewport.featureSettings.refreshTable();\r
}\r
alignPanel.paintAlignment(true);\r
+ statusBar.setText("Successfully added features to alignment.");\r
}\r
-\r
+ return featuresFile;\r
}\r
\r
+ @Override\r
public void keyPressed(KeyEvent evt)\r
{\r
if (viewport.cursorMode\r
{\r
case 27: // escape key\r
deselectAllSequenceMenuItem_actionPerformed();\r
- \r
- alignPanel.alabels.cancelDrag(); \r
+\r
+ alignPanel.alabels.cancelDrag();\r
break;\r
case KeyEvent.VK_X:\r
if (evt.isControlDown() || evt.isMetaDown())\r
// Hide everything by the current selection - this is a hack - we do the\r
// invert and then hide\r
// first check that there will be visible columns after the invert.\r
- if ((viewport.colSel != null && viewport.colSel.getSelected() != null && viewport.colSel\r
- .getSelected().size() > 0)\r
+ if ((viewport.getColumnSelection() != null\r
+ && viewport.getColumnSelection().getSelected() != null && viewport\r
+ .getColumnSelection().getSelected().size() > 0)\r
|| (sg != null && sg.getSize() > 0 && sg.getStartRes() <= sg\r
.getEndRes()))\r
{\r
\r
if (toggleSeqs)\r
{\r
- if (sg != null && sg.getSize() != viewport.alignment.getHeight())\r
+ if (sg != null && sg.getSize() != viewport.getAlignment().getHeight())\r
{\r
hide = true;\r
viewport.hideAllSelectedSeqs();\r
}\r
- else if (!(toggleCols && viewport.colSel.getSelected().size() > 0))\r
+ else if (!(toggleCols && viewport.getColumnSelection().getSelected()\r
+ .size() > 0))\r
{\r
viewport.showAllHiddenSeqs();\r
}\r
\r
if (toggleCols)\r
{\r
- if (viewport.colSel.getSelected().size() > 0)\r
+ if (viewport.getColumnSelection().getSelected().size() > 0)\r
{\r
viewport.hideSelectedColumns();\r
if (!toggleSeqs)\r
{\r
- viewport.selectionGroup = sg;\r
+ viewport.setSelectionGroup(sg);\r
}\r
}\r
else if (!hide)\r
}\r
}\r
\r
+ @Override\r
public void keyReleased(KeyEvent evt)\r
{\r
}\r
\r
+ @Override\r
public void keyTyped(KeyEvent evt)\r
{\r
}\r
\r
+ @Override\r
public void itemStateChanged(ItemEvent evt)\r
{\r
if (evt.getSource() == displayNonconservedMenuItem)\r
}\r
else if (evt.getSource() == autoCalculate)\r
{\r
- viewport.autocalculateConsensus = autoCalculate.getState();\r
+ viewport.autoCalculateConsensus = autoCalculate.getState();\r
}\r
else if (evt.getSource() == sortByTree)\r
{\r
{\r
showSequenceLogo_actionPerformed();\r
}\r
+ else if (evt.getSource() == normSequenceLogo)\r
+ {\r
+ normSequenceLogo_actionPerformed();\r
+ }\r
else if (evt.getSource() == showConsensusHistogram)\r
{\r
showConsensusHistogram_actionPerformed();\r
this.alignPanel.annotationPanel.repaint();\r
}\r
\r
+ @Override\r
public void actionPerformed(ActionEvent evt)\r
{\r
Object source = evt.getSource();\r
{\r
showSequenceLogo_actionPerformed();\r
}\r
+ else if (source == normSequenceLogo)\r
+ {\r
+ normSequenceLogo_actionPerformed();\r
+ }\r
else if (source == showConsensusHistogram)\r
{\r
showConsensusHistogram_actionPerformed();\r
else if (source == alProperties)\r
{\r
StringBuffer contents = new jalview.io.AlignmentProperties(\r
- viewport.alignment).formatAsString();\r
+ viewport.getAlignment()).formatAsString();\r
CutAndPasteTransfer cap = new CutAndPasteTransfer(false, this);\r
cap.setText(contents.toString());\r
Frame frame = new Frame();\r
else if (source == clustalColour)\r
{\r
abovePIDThreshold.setState(false);\r
- changeColour(new ClustalxColourScheme(\r
- viewport.alignment.getSequences(),\r
- viewport.alignment.getWidth()));\r
+ changeColour(new ClustalxColourScheme(viewport.getAlignment(), null));\r
}\r
else if (source == zappoColour)\r
{\r
{\r
changeColour(new NucleotideColourScheme());\r
}\r
+ else if (source == purinePyrimidineColour)\r
+ {\r
+ changeColour(new PurinePyrimidineColourScheme());\r
+ }\r
+ else if (source == RNAHelixColour)\r
+ {\r
+ new RNAHelicesColourChooser(viewport, alignPanel);\r
+ }\r
else if (source == modifyPID)\r
{\r
modifyPID_actionPerformed();\r
{\r
changeColour(new Blosum62ColourScheme());\r
}\r
+ else if (source == tcoffeeColour)\r
+ {\r
+ changeColour(new TCoffeeColourScheme(alignPanel.getAlignment()));\r
+ }\r
else if (source == annotationColour)\r
{\r
new AnnotationColourChooser(viewport, alignPanel);\r
public void loadAnnotations()\r
{\r
CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this);\r
- cap.setText("Paste your features / annotations file here.");\r
+ cap.setText("Paste your features / annotations / T-coffee score file here.");\r
cap.setAnnotationImport();\r
Frame frame = new Frame();\r
frame.add(cap);\r
public String outputAnnotations(boolean displayTextbox)\r
{\r
String annotation = new AnnotationFile().printAnnotations(\r
- viewport.showAnnotation ? viewport.alignment\r
- .getAlignmentAnnotation() : null, viewport.alignment\r
- .getGroups(),\r
- ((Alignment) viewport.alignment).alignmentProperties);\r
+ viewport.showAnnotation ? viewport.getAlignment()\r
+ .getAlignmentAnnotation() : null, viewport\r
+ .getAlignment().getGroups(), ((Alignment) viewport\r
+ .getAlignment()).alignmentProperties);\r
\r
if (displayTextbox)\r
{\r
\r
private Hashtable getDisplayedFeatureCols()\r
{\r
- if (alignPanel.getFeatureRenderer() != null && viewport.featuresDisplayed!=null)\r
+ if (alignPanel.getFeatureRenderer() != null\r
+ && viewport.featuresDisplayed != null)\r
{\r
FeatureRenderer fr = alignPanel.getFeatureRenderer();\r
Hashtable fcols = new Hashtable();\r
String features;\r
if (format.equalsIgnoreCase("Jalview"))\r
{\r
- features = new FeaturesFile().printJalviewFormat(\r
- viewport.alignment.getSequencesArray(),\r
+ features = new FeaturesFile().printJalviewFormat(viewport\r
+ .getAlignment().getSequencesArray(),\r
getDisplayedFeatureCols());\r
}\r
else\r
{\r
- features = new FeaturesFile().printGFFFormat(\r
- viewport.alignment.getSequencesArray(),\r
- getDisplayedFeatureCols());\r
+ features = new FeaturesFile().printGFFFormat(viewport.getAlignment()\r
+ .getSequencesArray(), getDisplayedFeatureCols());\r
}\r
\r
if (displayTextbox)\r
{\r
- boolean frimport=false;\r
- if (features==null || features.equals("No Features Visible"))\r
+ boolean frimport = false;\r
+ if (features == null || features.equals("No Features Visible"))\r
{\r
features = "# No features visible - paste some and import them here.";\r
- frimport=true;\r
+ frimport = true;\r
}\r
- \r
+\r
CutAndPasteTransfer cap = new CutAndPasteTransfer(frimport, this);\r
if (frimport)\r
{\r
frame.add(cap);\r
jalview.bin.JalviewLite.addFrame(frame, "Features", 600, 500);\r
cap.setText(features);\r
- } else {\r
- if (features==null)\r
+ }\r
+ else\r
+ {\r
+ if (features == null)\r
features = "";\r
}\r
\r
public void closeMenuItem_actionPerformed()\r
{\r
PaintRefresher.RemoveComponent(alignPanel);\r
- PaintRefresher.RemoveComponent(alignPanel.seqPanel.seqCanvas);\r
- PaintRefresher.RemoveComponent(alignPanel.idPanel.idCanvas);\r
+ if (alignPanel.seqPanel != null\r
+ && alignPanel.seqPanel.seqCanvas != null)\r
+ {\r
+ PaintRefresher.RemoveComponent(alignPanel.seqPanel.seqCanvas);\r
+ }\r
+ if (alignPanel.idPanel != null && alignPanel.idPanel.idCanvas != null)\r
+ {\r
+ PaintRefresher.RemoveComponent(alignPanel.idPanel.idCanvas);\r
+ }\r
\r
if (PaintRefresher.components.size() == 0 && viewport.applet == null)\r
{\r
System.exit(0);\r
- } else {\r
+ }\r
+ else\r
+ {\r
}\r
viewport = null;\r
alignPanel = null;\r
}\r
\r
/**\r
- * DOCUMENT ME!\r
+ * TODO: JAL-1104\r
*/\r
void updateEditMenuBar()\r
{\r
}\r
}\r
\r
+ /**\r
+ * TODO: JAL-1104\r
+ */\r
public void addHistoryItem(CommandI command)\r
{\r
if (command.getSize() > 0)\r
viewport.historyList.push(command);\r
viewport.redoList.removeAllElements();\r
updateEditMenuBar();\r
- viewport.hasHiddenColumns = viewport.colSel.getHiddenColumns() != null;\r
+ viewport.updateHiddenColumns();\r
}\r
}\r
\r
/**\r
- * DOCUMENT ME!\r
+ * TODO: JAL-1104 DOCUMENT ME!\r
* \r
* @param e\r
* DOCUMENT ME!\r
command.undoCommand(null);\r
\r
AlignViewport originalSource = getOriginatingSource(command);\r
-\r
- originalSource.hasHiddenColumns = viewport.colSel.getHiddenColumns() != null;\r
+ // JBPNote Test\r
+ if (originalSource != viewport)\r
+ {\r
+ System.err\r
+ .println("Warning: Viewport object mismatch whilst undoing");\r
+ }\r
+ originalSource.updateHiddenColumns(); // originalSource.hasHiddenColumns =\r
+ // viewport.getColumnSelection().getHiddenColumns()\r
+ // != null;\r
updateEditMenuBar();\r
- originalSource.firePropertyChange("alignment", null,\r
- originalSource.alignment.getSequences());\r
+ originalSource.firePropertyChange("alignment", null, originalSource\r
+ .getAlignment().getSequences());\r
}\r
\r
/**\r
- * DOCUMENT ME!\r
+ * TODO: JAL-1104 DOCUMENT ME!\r
* \r
* @param e\r
* DOCUMENT ME!\r
command.doCommand(null);\r
\r
AlignViewport originalSource = getOriginatingSource(command);\r
- originalSource.hasHiddenColumns = viewport.colSel.getHiddenColumns() != null;\r
+ // JBPNote Test\r
+ if (originalSource != viewport)\r
+ {\r
+ System.err\r
+ .println("Warning: Viewport object mismatch whilst re-doing");\r
+ }\r
+ originalSource.updateHiddenColumns(); // sethasHiddenColumns(); =\r
+ // viewport.getColumnSelection().getHiddenColumns()\r
+ // != null;\r
\r
updateEditMenuBar();\r
- originalSource.firePropertyChange("alignment", null,\r
- originalSource.alignment.getSequences());\r
+ originalSource.firePropertyChange("alignment", null, originalSource\r
+ .getAlignment().getSequences());\r
}\r
\r
AlignViewport getOriginatingSource(CommandI command)\r
{\r
if (comps.elementAt(i) instanceof AlignmentPanel)\r
{\r
- if (al == ((AlignmentPanel) comps.elementAt(i)).av.alignment)\r
+ if (al == ((AlignmentPanel) comps.elementAt(i)).av.getAlignment())\r
{\r
originalSource = ((AlignmentPanel) comps.elementAt(i)).av;\r
break;\r
// the current view against the closed view first\r
if (al != null)\r
{\r
- PaintRefresher.validateSequences(al, viewport.alignment);\r
+ PaintRefresher.validateSequences(al, viewport.getAlignment());\r
}\r
\r
originalSource = viewport;\r
{\r
return;\r
}\r
-\r
- if (up)\r
- {\r
- for (int i = 1; i < viewport.alignment.getHeight(); i++)\r
- {\r
- SequenceI seq = viewport.alignment.getSequenceAt(i);\r
- if (!sg.getSequences(null).contains(seq))\r
- {\r
- continue;\r
- }\r
-\r
- SequenceI temp = viewport.alignment.getSequenceAt(i - 1);\r
- if (sg.getSequences(null).contains(temp))\r
- {\r
- continue;\r
- }\r
-\r
- viewport.alignment.getSequences().setElementAt(temp, i);\r
- viewport.alignment.getSequences().setElementAt(seq, i - 1);\r
- }\r
- }\r
- else\r
- {\r
- for (int i = viewport.alignment.getHeight() - 2; i > -1; i--)\r
- {\r
- SequenceI seq = viewport.alignment.getSequenceAt(i);\r
- if (!sg.getSequences(viewport.hiddenRepSequences).contains(seq))\r
- {\r
- continue;\r
- }\r
-\r
- SequenceI temp = viewport.alignment.getSequenceAt(i + 1);\r
- if (sg.getSequences(viewport.hiddenRepSequences).contains(temp))\r
- {\r
- continue;\r
- }\r
-\r
- viewport.alignment.getSequences().setElementAt(temp, i);\r
- viewport.alignment.getSequences().setElementAt(seq, i + 1);\r
- }\r
- }\r
-\r
+ viewport.getAlignment().moveSelectedSequencesByOne(sg,\r
+ up ? null : viewport.getHiddenRepSequences(), up);\r
alignPanel.paintAlignment(true);\r
}\r
\r
synchronized void slideSequences(boolean right, int size)\r
{\r
- Vector sg = new Vector();\r
+ List<SequenceI> sg = new Vector<SequenceI>();\r
if (viewport.cursorMode)\r
{\r
- sg.addElement(viewport.alignment\r
- .getSequenceAt(alignPanel.seqPanel.seqCanvas.cursorY));\r
+ sg.add(viewport.getAlignment().getSequenceAt(\r
+ alignPanel.seqPanel.seqCanvas.cursorY));\r
}\r
else if (viewport.getSelectionGroup() != null\r
- && viewport.getSelectionGroup().getSize() != viewport.alignment\r
- .getHeight())\r
+ && viewport.getSelectionGroup().getSize() != viewport\r
+ .getAlignment().getHeight())\r
{\r
sg = viewport.getSelectionGroup().getSequences(\r
- viewport.hiddenRepSequences);\r
+ viewport.getHiddenRepSequences());\r
}\r
\r
if (sg.size() < 1)\r
return;\r
}\r
\r
- Vector invertGroup = new Vector();\r
+ Vector<SequenceI> invertGroup = new Vector();\r
\r
- for (int i = 0; i < viewport.alignment.getHeight(); i++)\r
+ for (int i = 0; i < viewport.getAlignment().getHeight(); i++)\r
{\r
- if (!sg.contains(viewport.alignment.getSequenceAt(i)))\r
- invertGroup.addElement(viewport.alignment.getSequenceAt(i));\r
+ if (!sg.contains(viewport.getAlignment().getSequenceAt(i)))\r
+ invertGroup.addElement(viewport.getAlignment().getSequenceAt(i));\r
}\r
\r
- SequenceI[] seqs1 = new SequenceI[sg.size()];\r
- for (int i = 0; i < sg.size(); i++)\r
- seqs1[i] = (SequenceI) sg.elementAt(i);\r
+ SequenceI[] seqs1 = sg.toArray(new SequenceI[sg.size()]);\r
\r
- SequenceI[] seqs2 = new SequenceI[invertGroup.size()];\r
+ SequenceI[] seqs2 = invertGroup.toArray(new SequenceI[invertGroup\r
+ .size()]);\r
for (int i = 0; i < invertGroup.size(); i++)\r
- seqs2[i] = (SequenceI) invertGroup.elementAt(i);\r
+ seqs2[i] = invertGroup.elementAt(i);\r
\r
SlideSequencesCommand ssc;\r
if (right)\r
for (int i = 0; i < sg.getSize(); i++)\r
{\r
SequenceI seq = sg.getSequenceAt(i);\r
- int index = viewport.alignment.findIndex(seq);\r
+ int index = viewport.getAlignment().findIndex(seq);\r
orderedSeqs.put(index + "", seq);\r
}\r
\r
int index = 0, startRes, endRes;\r
char ch;\r
\r
- if (viewport.hasHiddenColumns && viewport.getSelectionGroup() != null)\r
+ if (viewport.hasHiddenColumns() && viewport.getSelectionGroup() != null)\r
{\r
copiedHiddenColumns = new Vector();\r
int hiddenOffset = viewport.getSelectionGroup().getStartRes();\r
{\r
for (int i = 0; i < seqs.length; i++)\r
{\r
- viewport.alignment.addSequence(seqs[i]);\r
+ viewport.getAlignment().addSequence(seqs[i]);\r
}\r
\r
// !newAlignment\r
addHistoryItem(new EditCommand("Add sequences", EditCommand.PASTE,\r
- seqs, 0, viewport.alignment.getWidth(), viewport.alignment));\r
+ seqs, 0, viewport.getAlignment().getWidth(),\r
+ viewport.getAlignment()));\r
\r
- viewport.setEndSeq(viewport.alignment.getHeight());\r
- viewport.alignment.getWidth();\r
- viewport.firePropertyChange("alignment", null,\r
- viewport.alignment.getSequences());\r
+ viewport.setEndSeq(viewport.getAlignment().getHeight());\r
+ viewport.getAlignment().getWidth();\r
+ viewport.firePropertyChange("alignment", null, viewport.getAlignment()\r
+ .getSequences());\r
\r
}\r
\r
}\r
\r
// If the cut affects all sequences, remove highlighted columns\r
- if (sg.getSize() == viewport.alignment.getHeight())\r
+ if (sg.getSize() == viewport.getAlignment().getHeight())\r
{\r
viewport.getColumnSelection().removeElements(sg.getStartRes(),\r
sg.getEndRes() + 1);\r
*/\r
addHistoryItem(new EditCommand("Cut Sequences", EditCommand.CUT, cut,\r
sg.getStartRes(), sg.getEndRes() - sg.getStartRes() + 1,\r
- viewport.alignment));\r
+ viewport.getAlignment()));\r
\r
viewport.setSelectionGroup(null);\r
- viewport.alignment.deleteGroup(sg);\r
+ viewport.getAlignment().deleteGroup(sg);\r
\r
viewport.firePropertyChange("alignment", null, viewport.getAlignment()\r
.getSequences());\r
viewport.setShowConsensusHistogram(showConsensusHistogram.getState());\r
alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());\r
}\r
+\r
/*\r
* (non-Javadoc)\r
* \r
alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());\r
}\r
\r
+ protected void normSequenceLogo_actionPerformed()\r
+ {\r
+ showSequenceLogo.setState(true);\r
+ viewport.setShowSequenceLogo(true);\r
+ viewport.setNormaliseSequenceLogo(normSequenceLogo.getState());\r
+ alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());\r
+ }\r
+\r
protected void applyAutoAnnotationSettings_actionPerformed()\r
{\r
alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());\r
SequenceGroup[] gps = jalview.analysis.Grouping.makeGroupsFrom(\r
viewport.getSequenceSelection(),\r
viewport.getAlignmentView(true).getSequenceStrings(\r
- viewport.getGapCharacter()),\r
- viewport.alignment.getGroups());\r
- viewport.alignment.deleteAllGroups();\r
+ viewport.getGapCharacter()), viewport.getAlignment()\r
+ .getGroups());\r
+ viewport.getAlignment().deleteAllGroups();\r
viewport.sequenceColours = null;\r
viewport.setSelectionGroup(null);\r
// set view properties for each group\r
{\r
// gps[g].setShowunconserved(viewport.getShowUnconserved());\r
gps[g].setshowSequenceLogo(viewport.isShowSequenceLogo());\r
- viewport.alignment.addGroup(gps[g]);\r
+ viewport.getAlignment().addGroup(gps[g]);\r
Color col = new Color((int) (Math.random() * 255),\r
(int) (Math.random() * 255), (int) (Math.random() * 255));\r
col = col.brighter();\r
- for (Enumeration sq = gps[g].getSequences(null).elements(); sq\r
- .hasMoreElements(); viewport.setSequenceColour(\r
- (SequenceI) sq.nextElement(), col))\r
- ;\r
+ for (SequenceI sq : gps[g].getSequences(null))\r
+ viewport.setSequenceColour(sq, col);\r
}\r
PaintRefresher.Refresh(this, viewport.getSequenceSetId());\r
alignPanel.updateAnnotation();\r
\r
protected void deleteGroups_actionPerformed()\r
{\r
- viewport.alignment.deleteAllGroups();\r
+ viewport.getAlignment().deleteAllGroups();\r
viewport.sequenceColours = null;\r
viewport.setSelectionGroup(null);\r
\r
{\r
sg.addSequence(viewport.getAlignment().getSequenceAt(i), false);\r
}\r
- sg.setEndRes(viewport.alignment.getWidth() - 1);\r
+ sg.setEndRes(viewport.getAlignment().getWidth() - 1);\r
viewport.setSelectionGroup(sg);\r
alignPanel.paintAlignment(true);\r
PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId());\r
if (viewport.getSelectionGroup() != null)\r
{\r
seqs = viewport.getSelectionGroup().getSequencesAsArray(\r
- viewport.hiddenRepSequences);\r
+ viewport.getHiddenRepSequences());\r
}\r
else\r
{\r
- seqs = viewport.alignment.getSequencesArray();\r
+ seqs = viewport.getAlignment().getSequencesArray();\r
}\r
\r
TrimRegionCommand trimRegion;\r
{\r
trimRegion = new TrimRegionCommand("Remove Left",\r
TrimRegionCommand.TRIM_LEFT, seqs, column,\r
- viewport.alignment, viewport.colSel,\r
- viewport.selectionGroup);\r
+ viewport.getAlignment(), viewport.getColumnSelection(),\r
+ viewport.getSelectionGroup());\r
viewport.setStartRes(0);\r
}\r
else\r
{\r
trimRegion = new TrimRegionCommand("Remove Right",\r
TrimRegionCommand.TRIM_RIGHT, seqs, column,\r
- viewport.alignment, viewport.colSel,\r
- viewport.selectionGroup);\r
+ viewport.getAlignment(), viewport.getColumnSelection(),\r
+ viewport.getSelectionGroup());\r
}\r
\r
statusBar.setText("Removed " + trimRegion.getSize() + " columns.");\r
\r
addHistoryItem(trimRegion);\r
\r
- Vector groups = viewport.alignment.getGroups();\r
-\r
- for (int i = 0; i < groups.size(); i++)\r
+ for (SequenceGroup sg : viewport.getAlignment().getGroups())\r
{\r
- SequenceGroup sg = (SequenceGroup) groups.elementAt(i);\r
-\r
if ((trimLeft && !sg.adjustForRemoveLeft(column))\r
|| (!trimLeft && !sg.adjustForRemoveRight(column)))\r
{\r
- viewport.alignment.deleteGroup(sg);\r
+ viewport.getAlignment().deleteGroup(sg);\r
}\r
}\r
\r
\r
public void removeGappedColumnMenuItem_actionPerformed()\r
{\r
- int start = 0, end = viewport.alignment.getWidth() - 1;\r
+ int start = 0, end = viewport.getAlignment().getWidth() - 1;\r
\r
SequenceI[] seqs;\r
if (viewport.getSelectionGroup() != null)\r
{\r
seqs = viewport.getSelectionGroup().getSequencesAsArray(\r
- viewport.hiddenRepSequences);\r
+ viewport.getHiddenRepSequences());\r
start = viewport.getSelectionGroup().getStartRes();\r
end = viewport.getSelectionGroup().getEndRes();\r
}\r
else\r
{\r
- seqs = viewport.alignment.getSequencesArray();\r
+ seqs = viewport.getAlignment().getSequencesArray();\r
}\r
\r
RemoveGapColCommand removeGapCols = new RemoveGapColCommand(\r
- "Remove Gapped Columns", seqs, start, end, viewport.alignment);\r
+ "Remove Gapped Columns", seqs, start, end,\r
+ viewport.getAlignment());\r
\r
addHistoryItem(removeGapCols);\r
\r
\r
// This is to maintain viewport position on first residue\r
// of first sequence\r
- SequenceI seq = viewport.alignment.getSequenceAt(0);\r
+ SequenceI seq = viewport.getAlignment().getSequenceAt(0);\r
int startRes = seq.findPosition(viewport.startRes);\r
// ShiftList shifts;\r
// viewport.getAlignment().removeGaps(shifts=new ShiftList());\r
\r
public void removeAllGapsMenuItem_actionPerformed()\r
{\r
- int start = 0, end = viewport.alignment.getWidth() - 1;\r
+ int start = 0, end = viewport.getAlignment().getWidth() - 1;\r
\r
SequenceI[] seqs;\r
if (viewport.getSelectionGroup() != null)\r
{\r
seqs = viewport.getSelectionGroup().getSequencesAsArray(\r
- viewport.hiddenRepSequences);\r
+ viewport.getHiddenRepSequences());\r
start = viewport.getSelectionGroup().getStartRes();\r
end = viewport.getSelectionGroup().getEndRes();\r
}\r
else\r
{\r
- seqs = viewport.alignment.getSequencesArray();\r
+ seqs = viewport.getAlignment().getSequencesArray();\r
}\r
\r
// This is to maintain viewport position on first residue\r
// of first sequence\r
- SequenceI seq = viewport.alignment.getSequenceAt(0);\r
+ SequenceI seq = viewport.getAlignment().getSequenceAt(0);\r
int startRes = seq.findPosition(viewport.startRes);\r
\r
addHistoryItem(new RemoveGapsCommand("Remove Gaps", seqs, start, end,\r
- viewport.alignment));\r
+ viewport.getAlignment()));\r
\r
viewport.setStartRes(seq.findIndex(startRes) - 1);\r
\r
public AlignFrame newView(String viewtitle)\r
{\r
AlignmentI newal;\r
- if (viewport.hasHiddenRows)\r
+ if (viewport.hasHiddenRows())\r
{\r
newal = new Alignment(viewport.getAlignment().getHiddenSequences()\r
.getFullAlignment().getSequencesArray());\r
}\r
else\r
{\r
- newal = new Alignment(viewport.alignment.getSequencesArray());\r
+ newal = new Alignment(viewport.getAlignment().getSequencesArray());\r
}\r
\r
- if (viewport.alignment.getAlignmentAnnotation() != null)\r
+ if (viewport.getAlignment().getAlignmentAnnotation() != null)\r
{\r
- for (int i = 0; i < viewport.alignment.getAlignmentAnnotation().length; i++)\r
+ for (int i = 0; i < viewport.getAlignment().getAlignmentAnnotation().length; i++)\r
{\r
- if (!viewport.alignment.getAlignmentAnnotation()[i].autoCalculated)\r
+ if (!viewport.getAlignment().getAlignmentAnnotation()[i].autoCalculated)\r
{\r
- newal.addAnnotation(viewport.alignment.getAlignmentAnnotation()[i]);\r
+ newal.addAnnotation(viewport.getAlignment()\r
+ .getAlignmentAnnotation()[i]);\r
}\r
}\r
}\r
\r
AlignFrame newaf = new AlignFrame(newal, viewport.applet, "", false);\r
\r
- newaf.viewport.sequenceSetID = alignPanel.av.getSequenceSetId();\r
+ newaf.viewport.setSequenceSetId(alignPanel.av.getSequenceSetId());\r
PaintRefresher.Register(alignPanel, alignPanel.av.getSequenceSetId());\r
PaintRefresher.Register(newaf.alignPanel,\r
newaf.alignPanel.av.getSequenceSetId());\r
overview.getPreferredSize().height + 50);\r
\r
frame.pack();\r
+ final AlignmentPanel ap = alignPanel;\r
frame.addWindowListener(new WindowAdapter()\r
{\r
+ @Override\r
public void windowClosing(WindowEvent e)\r
{\r
- alignPanel.setOverviewPanel(null);\r
+ if (ap != null)\r
+ {\r
+ ap.setOverviewPanel(null);\r
+ }\r
};\r
});\r
\r
if (viewport.getConservationSelected())\r
{\r
\r
- Alignment al = (Alignment) viewport.alignment;\r
+ Alignment al = (Alignment) viewport.getAlignment();\r
Conservation c = new Conservation("All",\r
ResidueProperties.propHash, 3, al.getSequences(), 0,\r
al.getWidth() - 1);\r
cs.setConservation(null);\r
}\r
\r
- cs.setConsensus(viewport.hconsensus);\r
+ cs.setConsensus(viewport.getSequenceConsensusHash());\r
\r
}\r
viewport.setGlobalColourScheme(cs);\r
\r
- if (viewport.getColourAppliesToAllGroups())\r
- {\r
- Vector groups = viewport.alignment.getGroups();\r
- for (int i = 0; i < groups.size(); i++)\r
- {\r
- SequenceGroup sg = (SequenceGroup) groups.elementAt(i);\r
-\r
- if (cs == null)\r
- {\r
- sg.cs = null;\r
- continue;\r
- }\r
- if (cs instanceof ClustalxColourScheme)\r
- {\r
- sg.cs = new ClustalxColourScheme(\r
- sg.getSequences(viewport.hiddenRepSequences),\r
- sg.getWidth());\r
- }\r
- else\r
- {\r
- try\r
- {\r
- sg.cs = (ColourSchemeI) cs.getClass().newInstance();\r
- } catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- sg.cs = cs;\r
- }\r
- }\r
-\r
- if (viewport.getAbovePIDThreshold()\r
- || cs instanceof PIDColourScheme\r
- || cs instanceof Blosum62ColourScheme)\r
- {\r
- sg.cs.setThreshold(threshold, viewport.getIgnoreGapsConsensus());\r
- sg.cs.setConsensus(AAFrequency.calculate(\r
- sg.getSequences(viewport.hiddenRepSequences), 0,\r
- sg.getWidth()));\r
- }\r
- else\r
- {\r
- sg.cs.setThreshold(0, viewport.getIgnoreGapsConsensus());\r
- }\r
-\r
- if (viewport.getConservationSelected())\r
- {\r
- Conservation c = new Conservation("Group",\r
- ResidueProperties.propHash, 3,\r
- sg.getSequences(viewport.hiddenRepSequences), 0,\r
- viewport.alignment.getWidth() - 1);\r
- c.calculate();\r
- c.verdict(false, viewport.getConsPercGaps());\r
- sg.cs.setConservation(c);\r
- }\r
- else\r
- {\r
- sg.cs.setConservation(null);\r
- sg.cs.setThreshold(0, viewport.getIgnoreGapsConsensus());\r
- }\r
-\r
- }\r
- }\r
-\r
if (alignPanel.getOverviewPanel() != null)\r
{\r
alignPanel.getOverviewPanel().updateOverviewImage();\r
}\r
\r
jalview.structure.StructureSelectionManager\r
- .getStructureSelectionManager(viewport.applet).sequenceColoursChanged(\r
- alignPanel);\r
+ .getStructureSelectionManager(viewport.applet)\r
+ .sequenceColoursChanged(alignPanel);\r
\r
alignPanel.paintAlignment(true);\r
}\r
protected void modifyPID_actionPerformed()\r
{\r
if (viewport.getAbovePIDThreshold()\r
- && viewport.globalColourScheme != null)\r
+ && viewport.getGlobalColourScheme() != null)\r
{\r
SliderPanel.setPIDSliderSource(alignPanel,\r
viewport.getGlobalColourScheme(), "Background");\r
protected void modifyConservation_actionPerformed()\r
{\r
if (viewport.getConservationSelected()\r
- && viewport.globalColourScheme != null)\r
+ && viewport.getGlobalColourScheme() != null)\r
{\r
SliderPanel.setConservationSlider(alignPanel,\r
- viewport.globalColourScheme, "Background");\r
+ viewport.getGlobalColourScheme(), "Background");\r
SliderPanel.showConservationSlider();\r
}\r
}\r
.getAlignment().getSequenceAt(0), null);\r
\r
addHistoryItem(new OrderCommand("Pairwise Sort", oldOrder,\r
- viewport.alignment));\r
+ viewport.getAlignment()));\r
alignPanel.paintAlignment(true);\r
}\r
\r
{\r
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();\r
AlignmentSorter.sortByID(viewport.getAlignment());\r
- addHistoryItem(new OrderCommand("ID Sort", oldOrder, viewport.alignment));\r
+ addHistoryItem(new OrderCommand("ID Sort", oldOrder,\r
+ viewport.getAlignment()));\r
alignPanel.paintAlignment(true);\r
}\r
\r
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();\r
AlignmentSorter.sortByLength(viewport.getAlignment());\r
addHistoryItem(new OrderCommand("Length Sort", oldOrder,\r
- viewport.alignment));\r
+ viewport.getAlignment()));\r
alignPanel.paintAlignment(true);\r
}\r
\r
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();\r
AlignmentSorter.sortByGroup(viewport.getAlignment());\r
addHistoryItem(new OrderCommand("Group Sort", oldOrder,\r
- viewport.alignment));\r
+ viewport.getAlignment()));\r
alignPanel.paintAlignment(true);\r
\r
}\r
public void PCAMenuItem_actionPerformed()\r
{\r
// are the sequences aligned?\r
- if (!viewport.alignment.isAligned(false))\r
+ if (!viewport.getAlignment().isAligned(false))\r
{\r
SequenceI current;\r
int Width = viewport.getAlignment().getWidth();\r
void NewTreePanel(String type, String pwType, String title)\r
{\r
// are the sequences aligned?\r
- if (!viewport.alignment.isAligned(false))\r
+ if (!viewport.getAlignment().isAligned(false))\r
{\r
SequenceI current;\r
int Width = viewport.getAlignment().getWidth();\r
\r
if ((viewport.getSelectionGroup() != null && viewport\r
.getSelectionGroup().getSize() > 1)\r
- || (viewport.getSelectionGroup() == null && viewport.alignment\r
- .getHeight() > 1))\r
+ || (viewport.getAlignment().getHeight() > 1))\r
{\r
final TreePanel tp = new TreePanel(alignPanel, type, pwType);\r
\r
// addHistoryItem(new HistoryItem("Sort", viewport.alignment,\r
// HistoryItem.SORT));\r
addHistoryItem(new OrderCommand("Order by " + title, oldOrder,\r
- viewport.alignment));\r
+ viewport.getAlignment()));\r
alignPanel.paintAlignment(true);\r
}\r
\r
sortByTreeMenu.add(item);\r
item.addActionListener(new java.awt.event.ActionListener()\r
{\r
+ @Override\r
public void actionPerformed(ActionEvent evt)\r
{\r
sortByTree(treePanel, title); // treePanel.getTitle());\r
}\r
});\r
- \r
+\r
treePanel.addWindowListener(new WindowAdapter()\r
{\r
+ @Override\r
public void windowOpened(WindowEvent e)\r
{\r
if (viewport.sortByTree)\r
super.windowOpened(e);\r
}\r
\r
+ @Override\r
public void windowClosing(WindowEvent e)\r
{\r
sortByTreeMenu.remove(item);\r
};\r
});\r
}\r
+\r
public boolean sortBy(AlignmentOrder alorder, String undoname)\r
{\r
- SequenceI[] oldOrder = viewport.getAlignment()\r
- .getSequencesArray();\r
+ SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();\r
if (viewport.applet.debug)\r
{\r
- System.err.println("Sorting "+alorder.getOrder().size()+" in alignment '"+getTitle()+"'");\r
+ System.err.println("Sorting " + alorder.getOrder().size()\r
+ + " in alignment '" + getTitle() + "'");\r
}\r
AlignmentSorter.sortBy(viewport.getAlignment(), alorder);\r
- if (undoname!=null)\r
+ if (undoname != null)\r
{\r
- addHistoryItem(new OrderCommand(undoname, oldOrder, viewport.alignment));\r
+ addHistoryItem(new OrderCommand(undoname, oldOrder,\r
+ viewport.getAlignment()));\r
}\r
alignPanel.paintAlignment(true);\r
return true;\r
this.builddate = builddate;\r
}\r
\r
+ @Override\r
public void paint(Graphics g)\r
{\r
g.setColor(Color.white);\r
\r
MenuItem buriedColour = new MenuItem();\r
\r
+ MenuItem purinePyrimidineColour = new MenuItem();\r
+\r
+ MenuItem RNAHelixColour = new MenuItem();\r
+\r
MenuItem userDefinedColour = new MenuItem();\r
\r
MenuItem PIDColour = new MenuItem();\r
\r
MenuItem BLOSUM62Colour = new MenuItem();\r
\r
+ MenuItem tcoffeeColour = new MenuItem();\r
+\r
MenuItem njTreeBlosumMenuItem = new MenuItem();\r
\r
MenuItem avDistanceTreeBlosumMenuItem = new MenuItem();\r
CheckboxMenuItem seqLimits = new CheckboxMenuItem();\r
\r
CheckboxMenuItem centreColumnLabelFlag = new CheckboxMenuItem();\r
- \r
+\r
CheckboxMenuItem followMouseOverFlag = new CheckboxMenuItem();\r
- Menu autoAnnMenu=new Menu();\r
- CheckboxMenuItem showSequenceLogo= new CheckboxMenuItem();\r
+\r
+ Menu autoAnnMenu = new Menu();\r
+\r
+ CheckboxMenuItem showSequenceLogo = new CheckboxMenuItem();\r
+\r
CheckboxMenuItem applyAutoAnnotationSettings = new CheckboxMenuItem();\r
+\r
CheckboxMenuItem showConsensusHistogram = new CheckboxMenuItem();\r
+\r
CheckboxMenuItem showGroupConsensus = new CheckboxMenuItem();\r
+\r
CheckboxMenuItem showGroupConservation = new CheckboxMenuItem();\r
\r
+ CheckboxMenuItem normSequenceLogo = new CheckboxMenuItem();\r
+\r
private void jbInit() throws Exception\r
{\r
\r
\r
item.addActionListener(new java.awt.event.ActionListener()\r
{\r
+ @Override\r
public void actionPerformed(ActionEvent e)\r
{\r
outputText_actionPerformed(e);\r
turnColour.addActionListener(this);\r
buriedColour.setLabel("Buried Index");\r
buriedColour.addActionListener(this);\r
+ purinePyrimidineColour.setLabel("Purine/Pyrimidine");\r
+ purinePyrimidineColour.addActionListener(this);\r
+ RNAHelixColour.setLabel("by RNA Helices");\r
+ RNAHelixColour.addActionListener(this);\r
userDefinedColour.setLabel("User Defined...");\r
userDefinedColour.addActionListener(this);\r
PIDColour.setLabel("Percentage Identity");\r
PIDColour.addActionListener(this);\r
BLOSUM62Colour.setLabel("BLOSUM62 Score");\r
BLOSUM62Colour.addActionListener(this);\r
+ tcoffeeColour.setLabel("T-Coffee Scores");\r
+ tcoffeeColour.setEnabled(false); // it will enabled only if a score file is\r
+ // provided\r
+ tcoffeeColour.addActionListener(this);\r
avDistanceTreeBlosumMenuItem\r
.setLabel("Average Distance Using BLOSUM62");\r
avDistanceTreeBlosumMenuItem.addActionListener(this);\r
showGroupConservation.setLabel("Group Conservation");\r
showConsensusHistogram.setLabel("Show Consensus Histogram");\r
showSequenceLogo.setLabel("Show Consensus Logo");\r
+ normSequenceLogo.setLabel("Normalise Consensus Logo");\r
applyAutoAnnotationSettings.setLabel("Apply to all groups");\r
applyAutoAnnotationSettings.setState(true);\r
autoAnnMenu.setLabel("Autocalculated Annotation");\r
- \r
+\r
invertColSel.addActionListener(this);\r
showColumns.addActionListener(this);\r
showSeqs.addActionListener(this);\r
showGroupConservation.addItemListener(this);\r
showConsensusHistogram.addItemListener(this);\r
showSequenceLogo.addItemListener(this);\r
+ normSequenceLogo.addItemListener(this);\r
+\r
applyAutoAnnotationSettings.addItemListener(this);\r
formatMenu.setLabel("Format");\r
selectMenu.setLabel("Select");\r
autoAnnMenu.add(applyAutoAnnotationSettings);\r
autoAnnMenu.add(showConsensusHistogram);\r
autoAnnMenu.add(showSequenceLogo);\r
+ autoAnnMenu.add(normSequenceLogo);\r
autoAnnMenu.addSeparator();\r
autoAnnMenu.add(showGroupConservation);\r
autoAnnMenu.add(showGroupConsensus);\r
colourMenu.add(turnColour);\r
colourMenu.add(buriedColour);\r
colourMenu.add(nucleotideColour);\r
+ colourMenu.add(purinePyrimidineColour);\r
+ colourMenu.add(tcoffeeColour);\r
colourMenu.add(userDefinedColour);\r
colourMenu.addSeparator();\r
colourMenu.add(conservationMenuItem);\r
colourMenu.add(abovePIDThreshold);\r
colourMenu.add(modifyPID);\r
colourMenu.add(annotationColour);\r
+ colourMenu.add(RNAHelixColour);\r
calculateMenu.add(sort);\r
calculateMenu.add(calculate);\r
calculateMenu.addSeparator();\r
final AlignFrame me = this;\r
viewport.applet.addFocusListener(new FocusListener()\r
{\r
- \r
+\r
@Override\r
public void focusLost(FocusEvent e)\r
{\r
- if (me.viewport.applet.currentAlignFrame==me) {\r
- me.viewport.applet.currentAlignFrame = null;\r
- }}\r
- \r
+ if (me.viewport.applet.currentAlignFrame == me)\r
+ {\r
+ me.viewport.applet.currentAlignFrame = null;\r
+ }\r
+ }\r
+\r
@Override\r
public void focusGained(FocusEvent e)\r
{\r
// TODO: search for a jmv that involves viewer\r
if (jmv == null)\r
{ // create a new viewer/jalview binding.\r
- jmv = new ExtJmol(viewer, alignPanel, new SequenceI[][] {seqs});\r
+ jmv = new ExtJmol(viewer, alignPanel, new SequenceI[][]\r
+ { seqs });\r
}\r
return jmv;\r
\r
}\r
+\r
/**\r
* bind a pdb file to a sequence in the current view\r
* \r
if (applet.useXtrnalSviewer)\r
{\r
// register the association(s) and quit, don't create any windows.\r
- if (StructureSelectionManager.getStructureSelectionManager(applet).setMapping(seqs, chains, pdb.getFile(), protocol)==null) {\r
- System.err.println("Failed to map "+pdb.getFile()+" ("+protocol+") to any sequences");\r
+ if (StructureSelectionManager.getStructureSelectionManager(applet)\r
+ .setMapping(seqs, chains, pdb.getFile(), protocol) == null)\r
+ {\r
+ System.err.println("Failed to map " + pdb.getFile() + " ("\r
+ + protocol + ") to any sequences");\r
}\r
return;\r
}\r
}\r
\r
/**\r
- * modify the current selection, providing the user has not made a selection already.\r
- * @param sel - sequences from this alignment \r
- * @param csel - columns to be selected on the alignment\r
+ * modify the current selection, providing the user has not made a selection\r
+ * already.\r
+ * \r
+ * @param sel\r
+ * - sequences from this alignment\r
+ * @param csel\r
+ * - columns to be selected on the alignment\r
*/\r
public void select(SequenceGroup sel, ColumnSelection csel)\r
{\r
\r
public void scrollTo(int row, int column)\r
{\r
- alignPanel.seqPanel.scrollTo(row, column); \r
+ alignPanel.seqPanel.scrollTo(row, column);\r
}\r
+\r
public void scrollToRow(int row)\r
{\r
- alignPanel.seqPanel.scrollToRow(row); \r
+ alignPanel.seqPanel.scrollToRow(row);\r
}\r
+\r
public void scrollToColumn(int column)\r
{\r
- alignPanel.seqPanel.scrollToColumn(column); \r
+ alignPanel.seqPanel.scrollToColumn(column);\r
}\r
+\r
/**\r
* @return the alignments unique ID.\r
*/\r
- public String getSequenceSetId() {\r
+ public String getSequenceSetId()\r
+ {\r
return viewport.getSequenceSetId();\r
}\r
+\r
+ /**\r
+ * Load the (T-Coffee) score file from the specified url\r
+ * \r
+ * @param source\r
+ * File/URL/T-COFFEE score file contents\r
+ * @throws IOException\r
+ * @return true if alignment was annotated with data from source\r
+ */\r
+ public boolean loadScoreFile(String source) throws IOException\r
+ {\r
+\r
+ TCoffeeScoreFile file = new TCoffeeScoreFile(source,\r
+ AppletFormatAdapter.checkProtocol(source));\r
+ if (!file.isValid())\r
+ {\r
+ // TODO: raise dialog for gui\r
+ System.err.println("Problems parsing T-Coffee scores: "\r
+ + file.getWarningMessage());\r
+ System.err.println("Origin was:\n" + source);\r
+ return false;\r
+ }\r
+\r
+ /*\r
+ * check that the score matrix matches the alignment dimensions\r
+ */\r
+ AlignmentI aln;\r
+ if ((aln = viewport.getAlignment()) != null\r
+ && (aln.getHeight() != file.getHeight() || aln.getWidth() != file\r
+ .getWidth()))\r
+ {\r
+ // TODO: raise a dialog box here rather than bomb out.\r
+ System.err\r
+ .println("The scores matrix does not match the alignment dimensions");\r
+\r
+ }\r
+\r
+ // TODO add parameter to indicate if matching should be done\r
+ if (file.annotateAlignment(alignPanel.getAlignment(), false))\r
+ {\r
+ alignPanel.fontChanged();\r
+ tcoffeeColour.setEnabled(true);\r
+ // switch to this color\r
+ changeColour(new TCoffeeColourScheme(alignPanel.getAlignment()));\r
+ return true;\r
+ }\r
+ else\r
+ {\r
+ System.err.println("Problems resolving T-Coffee scores:");\r
+ if (file.getWarningMessage() != null)\r
+ {\r
+ System.err.println(file.getWarningMessage());\r
+ }\r
+ }\r
+ return false;\r
+ }\r
+\r
}\r