<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="lib" path="/Library/Java/JavaVirtualMachines/1.6.0_29-b11-402.jdk/Contents/Home/lib/plugin.jar"/>
<classpathentry kind="lib" path="lib/activation.jar"/>
<classpathentry kind="lib" path="lib/axis.jar" sourcepath="D:/axis-1_2RC2-src/axis-1_2RC2"/>
<classpathentry kind="lib" path="lib/commons-discovery.jar"/>
<classpathentry kind="lib" path="lib/jswingreader-0.3.jar" sourcepath="/jswingreader"/>
<classpathentry kind="lib" path="lib/min-jaba-client.jar"/>
<classpathentry kind="lib" path="lib/commons-codec-1.3.jar"/>
- <classpathentry kind="lib" path="appletlib/JmolApplet-12.2.0.jar" sourcepath="/Jmol"/>
<classpathentry kind="lib" path="lib/Jmol-12.2.4.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/plugin.jar"/>
+ <classpathentry kind="lib" path="appletlib/JmolApplet-12.2.4.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="output" path="classes"/>
</classpath>
<td>true</td>
<td>Show the jalview button on the page. When false, JalviewLite will open immediately.</td>
</tr>\r </tr>\r <tr><td>sortByTree</td>\r <td>true or false (default is false)</td>\r <td>automatically sort the associated alignment view by the tree when a new tree is opened.</td>\r </tr>\r <tr>\r <td>showTreeBootstraps</td><td>true or false (default is true)</td><td>show or hide branch bootstraps</td>\r </tr>\r <tr><td>showTreeDistances</td><td>true or false (default is true)</td><td>show or hide branch lengths</td></tr>\r <tr><td>showUnlinkedTreeNodes</td><td>true or false (default is false)</td><td>indicate if unassociated nodes should be highlighted in the tree view</td>\r </tr>\r <tr><td>heightScale</td>\r <td>1.0 or greater</td>\r <td>Adjust the height of each cell in the alignment grid relative to the height of a character in the alignment font. (<em>since 2.5.1</em>)</td>\r </tr>
- <tr><td>widthScale</td>\r <td>1.0 or greater</td>\r <td>Adjust the width of each cell in the alignment grid relative to the width of a character in the alignment font. (<em>since 2.5.1</em>)</td>\r </tr>\r <tr><td>centrecolumnlabels</td>\r <td>true of false (default is false)</td>\r <td>When true, text labels associated with a column in the alignment will be shown centered with respect to the column. (<em>since 2.4</em>)</td>\r <tr><td>showUnconserved</td>\r <td>true of false (default is false)</td>\r <td>When true, only gaps and symbols different to the consensus sequence for a column will be shown. Useful for visualizing alignments exhibiting low sequence variation, where it is important to highlight mutations. (<em>since 2.5</em>)</td>\r </tr>\r <tr><td>upperCase</td>\r <td><em>bold</em> or other value</td>\r <td>Indicate a text style to apply to uppercase sequence symbols. Currently, only <strong>bold</strong> is supported.</td>\r </tr>\r <tr><td>automaticScrolling</td>\r <td>true of false (default is true)</td>\r <td>When true, alignment panels will automatically scroll to show any regions of the alignment highlighted due to javascript events or when mousing over a position in an associated structure. (<em>since 2.6</em>)</td>\r </tr>\r \r <tr><td>showGroupConsensus</td>\r <td>true of false (default is false)</td>\r <td>When true, shows consensus annotation row for any groups on the alignment. (<em>since 2.7</em>)</td>\r </tr>\r \r <tr><td>showGroupConservation</td>\r <td>true of false (default is false)</td>\r <td>When true, shows amino-acid property conservation annotation row for any groups on the alignment. (<em>since 2.7</em>)</td>\r </tr>\r <tr><td>showConsensusHistogram</td>\r <td>true of false (default is true)</td>\r <td>When true, shows the percentage occurence of the consensus symbol for each column as a histogram above the consensus sequence row. (<em>since 2.7</em>)</td>\r </tr>\r <tr><td>showSequenceLogo</td>\r <td>true of false (default is false)</td>\r <td>When true, shows a sequence logo above the consensus sequence (overlaid above the Consensus Histogram, if visible, with symbols coloured using the alignment's default colourscheme). (<em>since 2.7</em>)</td>\r </tr>\r <tr><td>oninit</td>\r <td><em>after_init()</em></td>\r <td>name of javascript function that will be called after the jalviewLite instance has completed its initialisation. (<em>since 2.7</em>)</td>\r </tr>\r <tr><td>relaxedidmatch</td>\r <td><em>true or false (default is false)</em></td>\r <td>When true, use stem based matching to identify sequences that match features imported from a GFF or Jalview sequence features file, and for associating PDB data (passed on PDBfile parguments) with sequences (based on a given destination sequence ID). (<em>since 2.7</em>)</td>\r </tr>\r <tr><td>alignpdbfiles</td>\r <td><em>true or false (default is false)</em></td>\r <td>When true, and jalviewLite is able to use jmol as a structure viewer, attempt to show a superposition of all structures loaded onto the alignment, superimposed using the aligned regions of corresponding sequences. [experimental] (<em>since 2.7</em>)</td>\r </tr>\r <tr><td>externalstructureviewer</td>\r <td><em>true or false (default is false)</em></td>\r <td>re-route jmol colouring commands, selection and mouseover events to an external viewer using javascript callbacks. [experimental] (<em>since 2.7</em>)</td>\r \r </tr>\r <tr><td>annotationcolour_max</td>\r <td>colour name or RGB hex triplet (default is red)</td>\r <td>Default colour used for maximum value when shading by annotation. (<em>since 2.7</em>)</td>\r </tr>\r <tr><td>annotationcolour_min</td>\r <td>colour name or RGB hex triplet (default is orange)</td>\r <td>Default colour used for minimum value when shading by annotation. (<em>since 2.7</em>)</td>\r </tr>\r <tr><td>jalviewhelpurl</td>\r <td>absolute or relative url or javascript function prefixed by <em>javascript:</em> (default is http://www.jalview.org/help.html)</td>\r <td>Optional parameter allowing modification of the default Jalview Help URL normally opened when JalviewLite's 'Help' menu item is selected. (<em>since 2.7</em>)</td>\r </tr>\r <tr><td>resolvetocodebase</td>\r <td>True or False (False)</td>\r <td>Set to true to re-instate pre-JalviewLite 2.7 behaviour where relative URLs were prepended with the applet 'codebase' rather than the current document base URL before resolution. (<em>since 2.7</em>)</td>\r </tr>\r \r </table>
+ <tr><td>widthScale</td>\r <td>1.0 or greater</td>\r <td>Adjust the width of each cell in the alignment grid relative to the width of a character in the alignment font. (<em>since 2.5.1</em>)</td>\r </tr>\r <tr><td>centrecolumnlabels</td>\r <td>true of false (default is false)</td>\r <td>When true, text labels associated with a column in the alignment will be shown centered with respect to the column. (<em>since 2.4</em>)</td>\r <tr><td>showUnconserved</td>\r <td>true of false (default is false)</td>\r <td>When true, only gaps and symbols different to the consensus sequence for a column will be shown. Useful for visualizing alignments exhibiting low sequence variation, where it is important to highlight mutations. (<em>since 2.5</em>)</td>\r </tr>\r <tr><td>upperCase</td>\r <td><em>bold</em> or other value</td>\r <td>Indicate a text style to apply to uppercase sequence symbols. Currently, only <strong>bold</strong> is supported.</td>\r </tr>\r <tr><td>automaticScrolling</td>\r <td>true of false (default is true)</td>\r <td>When true, alignment panels will automatically scroll to show any regions of the alignment highlighted due to javascript events or when mousing over a position in an associated structure. (<em>since 2.6</em>)</td>\r </tr>\r \r <tr><td>showGroupConsensus</td>\r <td>true of false (default is false)</td>\r <td>When true, shows consensus annotation row for any groups on the alignment. (<em>since 2.7</em>)</td>\r </tr>\r \r <tr><td>showGroupConservation</td>\r <td>true of false (default is false)</td>\r <td>When true, shows amino-acid property conservation annotation row for any groups on the alignment. (<em>since 2.7</em>)</td>\r </tr>\r <tr><td>showConsensusHistogram</td>\r <td>true of false (default is true)</td>\r <td>When true, shows the percentage occurence of the consensus symbol for each column as a histogram above the consensus sequence row. (<em>since 2.7</em>)</td>\r </tr>\r <tr><td>showSequenceLogo</td>\r <td>true of false (default is false)</td>\r <td>When true, shows a sequence logo above the consensus sequence (overlaid above the Consensus Histogram, if visible, with symbols coloured using the alignment's default colourscheme). (<em>since 2.7</em>)</td>\r </tr>\r <tr><td>oninit</td>\r <td><em>after_init()</em></td>\r <td>name of javascript function that will be called after the jalviewLite instance has completed its initialisation. (<em>since 2.7</em>)</td>\r </tr>\r <tr><td>relaxedidmatch</td>\r <td><em>true or false (default is false)</em></td>\r <td>When true, use stem based matching to identify sequences that match features imported from a GFF or Jalview sequence features file, and for associating PDB data (passed on PDBfile parguments) with sequences (based on a given destination sequence ID). (<em>since 2.7</em>)</td>\r </tr>\r <tr><td>alignpdbfiles</td>\r <td><em>true or false (default is false)</em></td>\r <td>When true, and jalviewLite is able to use jmol as a structure viewer, attempt to show a superposition of all structures loaded onto the alignment, superimposed using the aligned regions of corresponding sequences. [experimental] (<em>since 2.7</em>)</td>\r </tr>\r <tr><td>externalstructureviewer</td>\r <td><em>true or false (default is false)</em></td>\r <td>re-route jmol colouring commands, selection and mouseover events to an external viewer using javascript callbacks. [experimental] (<em>since 2.7</em>)</td>\r \r </tr>\r <tr><td>annotationcolour_max</td>\r <td>colour name or RGB hex triplet (default is red)</td>\r <td>Default colour used for maximum value when shading by annotation. (<em>since 2.7</em>)</td>\r </tr>\r <tr><td>annotationcolour_min</td>\r <td>colour name or RGB hex triplet (default is orange)</td>\r <td>Default colour used for minimum value when shading by annotation. (<em>since 2.7</em>)</td>\r </tr>\r <tr><td>jalviewhelpurl</td>\r <td>absolute or relative url or javascript function prefixed by <em>javascript:</em> (default is http://www.jalview.org/help.html)</td>\r <td>Optional parameter allowing modification of the default Jalview Help URL normally opened when JalviewLite's 'Help' menu item is selected. (<em>since 2.7</em>)</td>\r </tr>\r <tr><td>resolvetocodebase</td>\r <td>True or False (False)</td>\r <td>Set to true to re-instate pre-JalviewLite 2.7 behaviour where relative URLs were prepended with the applet 'codebase' rather than the current document base URL before resolution. (<em>since 2.7</em>)</td>\r </tr>\r <tr><td>scoreFile</td>\r <td>file</td>\r <td>Multiple sequences aligment scores file. Currently is supported only the T-Coffee score_ascii file format</td>\r </tr>\r\r \r </table>
<p align="center"> </p>
<!-- InstanceEndEditable --></td>\r </tr>\r </table>\r</div>\r</body>\r<!-- InstanceEnd --></html>\r
\ No newline at end of file
*/\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.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.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
-public class AlignFrame extends EmbmenuFrame implements ActionListener,\r
- ItemListener, KeyListener\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.StringTokenizer;\r
+import java.util.Vector;\r
+\r
+public class AlignFrame extends EmbmenuFrame implements ActionListener, ItemListener, KeyListener\r
{\r
public AlignmentPanel alignPanel;\r
\r
int DEFAULT_HEIGHT = 500;\r
\r
String jalviewServletURL;\r
+ \r
+ TCoffeeScoreFile tcoffeeScoreFile;\r
\r
- public AlignFrame(AlignmentI al, jalview.bin.JalviewLite applet,\r
- String title, boolean embedded)\r
+ public AlignFrame(AlignmentI al, jalview.bin.JalviewLite applet, String title, boolean embedded)\r
{\r
-\r
if (applet != null)\r
{\r
jalviewServletURL = applet.getParameter("APPLICATION_URL");\r
{\r
loadAnnotations();\r
}\r
+ else if( source == loadScores ) {\r
+ loadScores();\r
+ }\r
else if (source == outputAnnotations)\r
{\r
outputAnnotations(true);\r
{\r
changeColour(new Blosum62ColourScheme());\r
}\r
+ else if (source == tcoffeeColour) {\r
+ changeColour(new TCoffeeColourScheme(tcoffeeScoreFile));\r
+ }\r
else if (source == annotationColour)\r
{\r
new AnnotationColourChooser(viewport, alignPanel);\r
jalview.bin.JalviewLite.addFrame(frame, "Paste Annotations ", 400, 300);\r
\r
}\r
+ \r
+ public void loadScores() {\r
+ //TODO\r
+ \r
+ }\r
\r
public String outputAnnotations(boolean displayTextbox)\r
{\r
\r
cs.setConsensus(viewport.hconsensus);\r
\r
- }\r
+ } \r
viewport.setGlobalColourScheme(cs);\r
\r
if (viewport.getColourAppliesToAllGroups())\r
MenuItem loadTree = new MenuItem("Load Associated Tree ...");\r
\r
MenuItem loadAnnotations = new MenuItem("Load Features/Annotations ...");\r
+ \r
+ MenuItem loadScores = new MenuItem("Load Associated T-Coffee scores ...");\r
\r
MenuItem outputFeatures = new MenuItem("Export Features ...");\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
\r
loadTree.addActionListener(this);\r
loadAnnotations.addActionListener(this);\r
+ loadScores.addActionListener(this);\r
outputFeatures.addActionListener(this);\r
outputAnnotations.addActionListener(this);\r
selectAllSequenceMenuItem.addActionListener(this);\r
PIDColour.addActionListener(this);\r
BLOSUM62Colour.setLabel("BLOSUM62 Score");\r
BLOSUM62Colour.addActionListener(this);\r
- avDistanceTreeBlosumMenuItem\r
- .setLabel("Average Distance Using BLOSUM62");\r
+ tcoffeeColour.setLabel("T-Coffee Scores");\r
+ tcoffeeColour.setEnabled(false); // it will enabled only if a score file is provided\r
+ tcoffeeColour.addActionListener(this);\r
+ avDistanceTreeBlosumMenuItem .setLabel("Average Distance Using BLOSUM62");\r
avDistanceTreeBlosumMenuItem.addActionListener(this);\r
njTreeBlosumMenuItem.setLabel("Neighbour Joining Using BLOSUM62");\r
njTreeBlosumMenuItem.addActionListener(this);\r
fileMenu.add(inputText);\r
fileMenu.add(loadTree);\r
fileMenu.add(loadAnnotations);\r
-\r
+ fileMenu.add(loadScores);\r
+ \r
fileMenu.addSeparator();\r
fileMenu.add(outputTextboxMenu);\r
fileMenu.add(outputFeatures);\r
colourMenu.add(turnColour);\r
colourMenu.add(buriedColour);\r
colourMenu.add(nucleotideColour);\r
+ colourMenu.add(tcoffeeColour);\r
colourMenu.add(userDefinedColour);\r
colourMenu.addSeparator();\r
colourMenu.add(conservationMenuItem);\r
public String getSequenceSetId() {\r
return viewport.getSequenceSetId();\r
}\r
+ \r
+ \r
+ /**\r
+ * Load the (T-Coffee) score file from the specified url \r
+ * \r
+ * @param url The absolute path from where download and read the score file\r
+ * @throws IOException \r
+ */\r
+ public void loadScoreFile( URL url ) throws IOException {\r
+ \r
+ TCoffeeScoreFile file = TCoffeeScoreFile.load( new InputStreamReader( url.openStream() ) );\r
+ if( file == null ) {\r
+ throw new RuntimeException("The file provided does not match the T-Coffee scores file format");\r
+ }\r
+ \r
+ tcoffeeColour.setEnabled(true);\r
+ tcoffeeScoreFile = file;\r
+ \r
+ // switch to this color\r
+ changeColour(new TCoffeeColourScheme(tcoffeeScoreFile));\r
+ }\r
+ \r
+ \r
}\r
*/
package jalview.appletgui;
-import java.awt.*;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.schemes.ColourSchemeI;
-import jalview.datamodel.*;
-import jalview.schemes.*;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
public class SequenceRenderer implements jalview.api.SequenceRenderer
{
{
if (cs != null)
{
- resBoxColour = cs.findColour(seq.getCharAt(i), i);
+ resBoxColour = cs.findColour(seq.getCharAt(i), i, seq.getIndex());
}
else if (forOverview
&& !jalview.util.Comparison.isGap(seq.getCharAt(i)))
*/
package jalview.appletgui;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-
-import jalview.datamodel.*;
-import jalview.schemes.*;
+import jalview.datamodel.SequenceGroup;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.GraduatedColor;
+import jalview.schemes.ResidueProperties;
+import jalview.schemes.UserColourScheme;
+
+import java.awt.Button;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dialog;
+import java.awt.Font;
+import java.awt.Frame;
+import java.awt.GridLayout;
+import java.awt.Label;
+import java.awt.Panel;
+import java.awt.Rectangle;
+import java.awt.Scrollbar;
+import java.awt.TextField;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.AdjustmentEvent;
+import java.awt.event.AdjustmentListener;
+import java.awt.event.MouseEvent;
+import java.util.Vector;
public class UserDefinedColours extends Panel implements ActionListener,
AdjustmentListener
{
try
{
- col = oldColourScheme.findColour(aa.charAt(0), -1);
+ col = oldColourScheme.findColour(aa.charAt(0), -1, -1);
} catch (Exception ex)
{
}
\r
if (protocol == jalview.io.AppletFormatAdapter.PASTE)\r
{\r
- newAlignFrame.setTitle("Sequences from "\r
- + applet.getDocumentBase());\r
+ newAlignFrame.setTitle("Sequences from " + applet.getDocumentBase());\r
}\r
\r
newAlignFrame.statusBar.setText("Successfully loaded file " + file);\r
}\r
}\r
\r
+\r
+ /*\r
+ * Try to load T-Coffee score file\r
+ */\r
+ String sScoreFile = applet.getParameter("scoreFile");\r
+ if( sScoreFile != null && !"".equals(sScoreFile) ) {\r
+ try {\r
+ URL urlScore = new URL(sScoreFile);\r
+ newAlignFrame.loadScoreFile(urlScore);\r
+ //TODO check the scores matrix matches the MSA dimensions\r
+ \r
+ }\r
+ catch( Exception e ) {\r
+ // TODO error message log (shows a warning dialogbox?)\r
+ System.err.printf("Cannot read score file: '%s'. Cause: %s \n", sScoreFile, e.getMessage());\r
+ }\r
+ }\r
+ \r
+\r
// ///////////////////////////\r
// modify display of features\r
// we do this before any features have been loaded, ensuring any hidden groups are hidden when features first displayed\r
*/
package jalview.datamodel;
-import java.util.*;
+import jalview.analysis.AlignSeq;
-import jalview.analysis.*;
+import java.util.Enumeration;
+import java.util.Vector;
/**
*
* to the residues of this sequence
*/
Vector annotation;
+
+ /**
+ * The index of the sequence in a MSA
+ */
+ int index = -1;
/** array of seuqence features - may not be null for a valid sequence object */
public SequenceFeature[] sequenceFeatures;
}
}
+ /**
+ * @return The index (zero-based) on this sequence in the MSA.
+ * It returns {@code -1} if this information is not available.
+ */
+ public int getIndex() { return index; }
+
+ /**
+ * Defines the position of this sequence in the MSA.
+ * Use the value {@code -1} if this information is undefined.
+ *
+ * @param The position for this sequence. This value is zero-based (zero for this first sequence)
+ */
+ public void setIndex(int value) { index = value; }
}
*/
package jalview.datamodel;
-import java.util.*;
+import java.util.Vector;
/**
* DOCUMENT ME!
* null or mapping from entry's numbering to local start/end
*/
public void transferAnnotation(SequenceI entry, Mapping mp);
+
+ /**
+ * @param index The sequence index in the MSA
+ */
+ public void setIndex(int index);
+
+ /**
+ * @return The index of the sequence in the alignment
+ */
+ public int getIndex();
}
import jalview.io.JalviewFileView;
import jalview.io.JnetAnnotationMaker;
import jalview.io.NewickFile;
+import jalview.io.TCoffeeScoreFile;
import jalview.jbgui.GAlignFrame;
import jalview.schemes.Blosum62ColourScheme;
import jalview.schemes.BuriedColourScheme;
import jalview.schemes.PIDColourScheme;
import jalview.schemes.ResidueProperties;
import jalview.schemes.StrandColourScheme;
+import jalview.schemes.TCoffeeColourScheme;
import jalview.schemes.TaylorColourScheme;
import jalview.schemes.TurnColourScheme;
import jalview.schemes.UserColourScheme;
import jalview.schemes.ZappoColourScheme;
-import jalview.ws.WSMenuEntryProviderI;
import jalview.ws.jws1.Discoverer;
import jalview.ws.jws2.Jws2Discoverer;
AlignViewport viewport;
Vector alignPanels = new Vector();
+
+ TCoffeeScoreFile tcoffeeScoreFile;
/**
* Last format used to load or save alignments in this window
}
}
}
-
+
+ @Override
+ public void loadScores_actionPerformed(ActionEvent e)
+ {
+ // Pick the tree file
+ JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.getProperty("LAST_DIRECTORY"));
+ chooser.setFileView(new JalviewFileView());
+ chooser.setDialogTitle("Select a T-Coffee scores ascii file");
+ chooser.setToolTipText("Load a score file");
+
+ int value = chooser.showOpenDialog(null);
+
+ if (value == JalviewFileChooser.APPROVE_OPTION)
+ {
+ String sFilePath = chooser.getSelectedFile().getPath();
+ jalview.bin.Cache.setProperty("LAST_DIRECTORY", sFilePath);
+
+
+ try
+ {
+ TCoffeeScoreFile result = TCoffeeScoreFile.load(new File(sFilePath));
+ if( result == null ) { throw new RuntimeException("The file provided does not match the T-Coffee scores file format"); }
+
+ // TODO check that the loaded scores matches the current MSA 'dimension'
+ changeColour( new TCoffeeColourScheme(result) );
+ tcoffeeScoreFile = result;
+ tcoffeeColour.setEnabled(true);
+ tcoffeeColour.setSelected(true);
+
+ }
+ catch (Exception ex) {
+ JOptionPane.showMessageDialog(
+ Desktop.desktop,
+ ex.getMessage(),
+ "Problem reading tree file",
+ JOptionPane.WARNING_MESSAGE);
+
+ ex.printStackTrace();
+ }
+ }
+
+ }
+
+
+ @Override
+ protected void tcoffeeColorScheme_actionPerformed(ActionEvent e) {
+ if( tcoffeeScoreFile != null ) {
+ changeColour( new TCoffeeColourScheme(tcoffeeScoreFile) );
+ }
+ }
+
+// /**
+// * Load the (T-Coffee) score file from the specified url
+// *
+// * @param url The absolute path from where download and read the score file
+// * @throws IOException
+// */
+// public void loadScoreFile(URL url ) throws IOException {
+//
+// TCoffeeScoreFile result = new TCoffeeScoreFile();
+// result.parse( new InputStreamReader( url.openStream() ) );
+// tcoffeeScoreFile = result;
+// }
+
public TreePanel ShowNewickTree(NewickFile nf, String title)
{
return ShowNewickTree(nf, title, 600, 500, 4, 5);
*/
package jalview.gui;
-import java.awt.*;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.schemes.ColourSchemeI;
-import jalview.datamodel.*;
-import jalview.schemes.*;
+import java.awt.Color;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
/**
* DOCUMENT ME!
{
if (cs != null)
{
- resBoxColour = cs.findColour(seq.getCharAt(i), i);
+ resBoxColour = cs.findColour(seq.getCharAt(i), i, seq.getIndex());
}
else if (forOverview
&& !jalview.util.Comparison.isGap(seq.getCharAt(i)))
*/
package jalview.gui;
-import java.io.*;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-import javax.swing.event.*;
-
-import jalview.datamodel.*;
-import jalview.io.*;
-import jalview.jbgui.*;
-import jalview.schemes.*;
+import jalview.datamodel.SequenceGroup;
+import jalview.io.JalviewFileChooser;
+import jalview.jbgui.GUserDefinedColours;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.ResidueProperties;
+import jalview.schemes.UserColourScheme;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.event.ActionEvent;
+import java.awt.event.MouseEvent;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.util.Hashtable;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import javax.swing.JButton;
+import javax.swing.JInternalFrame;
+import javax.swing.JOptionPane;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
/**
* DOCUMENT ME!
{
try
{
- col = oldColourScheme.findColour(aa.charAt(0), -1);
+ col = oldColourScheme.findColour(aa.charAt(0), -1, -1);
} catch (Exception ex)
{
}
*/
package jalview.io;
-import java.io.*;
-import java.util.*;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceI;
-import jalview.datamodel.*;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
/**
* DOCUMENT ME!
/**
* Sequences to be added to form a new alignment.
*/
- protected Vector seqs;
+ protected Vector<SequenceI> seqs;
/**
* annotation to be added to generated alignment object
public AlignFile(String inFile, String type) throws IOException
{
super(inFile, type);
-
initData();
-
parse();
+ // sets the index of each sequence in the alignment
+ for( int i=0,c=seqs.size(); i<c; i++ ) {
+ seqs.get(i).setIndex(i);
+ }
}
/**
super(source);
initData();
parse();
+ // sets the index of each sequence in the alignment
+ for( int i=0,c=seqs.size(); i<c; i++ ) {
+ seqs.get(i).setIndex(i);
+ }
}
/**
* Return the seqs Vector
*/
- public Vector getSeqs()
+ public Vector<SequenceI> getSeqs()
{
return seqs;
}
*/
package jalview.jbgui;
-import java.awt.*;
-import java.awt.event.*;
-
-import javax.swing.*;
-import javax.swing.event.*;
-
-import jalview.schemes.*;
+import jalview.schemes.ColourSchemeProperty;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.GridLayout;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.FocusAdapter;
+import java.awt.event.FocusEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+
+import javax.swing.BorderFactory;
+import javax.swing.ButtonGroup;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JInternalFrame;
+import javax.swing.JLabel;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JRadioButtonMenuItem;
+import javax.swing.JTabbedPane;
+import javax.swing.SwingUtilities;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.MenuEvent;
+import javax.swing.event.MenuListener;
public class GAlignFrame extends JInternalFrame
{
protected JRadioButtonMenuItem BLOSUM62Colour = new JRadioButtonMenuItem();
+ protected JRadioButtonMenuItem tcoffeeColour = new JRadioButtonMenuItem();
+
+
JMenuItem njTreeBlosumMenuItem = new JMenuItem();
JMenuItem avDistanceTreeBlosumMenuItem = new JMenuItem();
JMenuItem epsFile = new JMenuItem();
JMenuItem LoadtreeMenuItem = new JMenuItem();
+
+ JMenuItem loadScoresMenuItem = new JMenuItem();
public JCheckBoxMenuItem scaleAbove = new JCheckBoxMenuItem();
colours.add(PIDColour);
colours.add(BLOSUM62Colour);
colours.add(nucleotideColour);
+ colours.add(tcoffeeColour);
setColourSelected(jalview.bin.Cache
.getDefault("DEFAULT_COLOUR", "None"));
nucleotideColour.setSelected(true);
break;
+
+ case ColourSchemeProperty.TCOFFEE:
+ tcoffeeColour.setSelected(true);
+ break;
case ColourSchemeProperty.USER_DEFINED:
userDefinedColour.setSelected(true);
nucleotideColour_actionPerformed(e);
}
});
+
+ tcoffeeColour.setText("T-Coffee scores");
+ tcoffeeColour.setEnabled(false);
+ tcoffeeColour.addActionListener( new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ tcoffeeColorScheme_actionPerformed(e);
+ }
+ } );
+
+
deleteGroups.setText("Undefine groups");
deleteGroups.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
java.awt.event.KeyEvent.VK_U, Toolkit.getDefaultToolkit()
}
});
LoadtreeMenuItem.setActionCommand("Load a tree for this sequence set");
- LoadtreeMenuItem.setText("Load Associated Tree");
+ LoadtreeMenuItem.setText("Load Associated Tree");
LoadtreeMenuItem.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
LoadtreeMenuItem_actionPerformed(e);
}
});
+
+ loadScoresMenuItem.setActionCommand("Load T-Coffee scores");
+ loadScoresMenuItem.setText("Load T-Coffee scores");
+ loadScoresMenuItem.addActionListener(new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ loadScores_actionPerformed(e);
+ }
+ });
+
scaleAbove.setVisible(false);
scaleAbove.setText("Scale Above");
scaleAbove.addActionListener(new java.awt.event.ActionListener()
fileMenu.add(exportAnnotations);
fileMenu.add(LoadtreeMenuItem);
fileMenu.add(associatedData);
+ fileMenu.add(loadScoresMenuItem);
fileMenu.addSeparator();
fileMenu.add(closeMenuItem);
editMenu.add(undoMenuItem);
colourMenu.add(turnColour);
colourMenu.add(buriedColour);
colourMenu.add(nucleotideColour);
+ colourMenu.add(tcoffeeColour);
colourMenu.add(userDefinedColour);
colourMenu.addSeparator();
colourMenu.add(conservationMenuItem);
protected void LoadtreeMenuItem_actionPerformed(ActionEvent e)
{
+
+ }
+
+ /**
+ * Template method to handle the 'load T-Coffee scores' menu event.
+ * <p>
+ * Subclasses override this method to provide a custom action.
+ *
+ * @param event The raised event
+ */
+ protected void loadScores_actionPerformed(ActionEvent event) {
+
+ }
+
+
+ /**
+ * Template method to handle the 'Color T-Coffee scores' menu event.
+ * <p>
+ * Subclasses override this method to provide a custom action.
+ *
+ * @param event The raised event
+ */
+ protected void tcoffeeColorScheme_actionPerformed(ActionEvent event) {
+
}
+
protected void jpred_actionPerformed(ActionEvent e)
{