59ad2573afca9481b4a3ed0a5ebb539f4e48a6c3
[jalview-manual.git] / TheJalviewTutorial.tex
1 \documentclass[11pt]{report}
2 \usepackage{graphicx}
3 \usepackage{amssymb}
4 \usepackage{epstopdf}
5 \DeclareGraphicsRule{.tif}{png}{.png}{`convert #1 `dirname #1`/`basename #1 .tif`.png}
6
7 \textwidth = 6.5 in
8 \textheight = 9 in
9 \oddsidemargin = 0.0 in
10 \evensidemargin = 0.0 in
11 \topmargin = 0.0 in
12 \headheight = 0.0 in
13 \headsep = 0.0 in
14 \parskip = 0.2in
15 \parindent = 0.0in
16
17 \newtheorem{theorem}{Theorem}
18 \newtheorem{corollary}[theorem]{Corollary}
19 \newtheorem{definition}{Definition}
20
21 \title{Jalview 2.2: A manual and introductory tutorial}
22 \author{David Martin}
23 \r%\renewcommand{menustyle}{\tt}\r%do something more advanced here.\r\begin{document}\r
24
25 \newcounter{ecount} 
26 \newcounter{exstep}[ecount]
27 \renewcommand{\theecount} {\arabic{ecount}}
28 \renewcommand{\theexstep} {\arabic{ecount}.\alph{exstep}}
29
30 \newcommand{\exercise}[2] { \refstepcounter{ecount}  \begin{center} \fbox{\parbox[b][\height]{6in}{ {\bf Exercise \theecount  :  #1  }  \par #2 }} \end{center}}
31 \newcommand{\exstep}[1]{ \stepcounter{exstep} {\sl \theexstep.}  \begin{minipage}[t]{5.5in} #1 \end{minipage} \par \vspace *{1mm} }
32 %%% Remove the % on the next 2 lines to hide tutorials.
33 %\renewcommand{\exercise}[2]{} 
34 %\renewcommand{\exstep}[1]{} 
35
36
37 \maketitle
38 \tableofcontents\r
39
40 \chapter{Basics}\r\section{Introduction}
41 \subsection{Jalview}
42 Jalview is a sequence multiple alignment viewer, editor and analysis tool. Jalview is designed to be platform independent (running on Mac, MS Windows, Linux and any other platform that supports Java), capable of editing and analysing large alignments (thousands of sequences) with minimal degradation in performance, and able to show multiple integrated views of the alignment and other data. Jalview can read and write many common sequence formats including FASTA, Clustal, MSF(GCG) and PIR. 
43
44 Jalview 2.2 provides improved access to databases and analyses via web services, allowing the retrieval and display of third party data such as features and structures in association with the sequences. Jalview is typically run as a stand alone application or as an applet embedded in a web page, allowing customised integration with alignment databases such as pFam\footnote{A demonstration version of Jalview (Jalview Micro Edition) also runs on a mobile phone but the functionality is limited to sequence colouring.}.
45
46 \subsubsection{Jalview History}
47 Jalview was initially developed in 1996 by Michele Clamp, James Cuff, Steve Searle and Geoff Barton at the University of Oxford and then the European Bioinformatics Institute. Development of Jalview slowed considerably before resuming with funding from the BBSRC\footnote{Biotechnology and Biological Sciences Research Council grant  {\sl "VAMSAS: Visualisation and Analysis of Molecules, Sequence Alignments and Structures"}, a joint project to enable interoperability between Jalview, TOPALi and AstexViewer.} in 2004 with Andrew Waterhouse and Jim Procter bringing current developments in bioinformatics  into Jalview 2 through the latest web and Java technology. Jalview continues to be one of the worlds most popular\footnote{and in the authors opinion, the best.} sequence alignment and analysis tools.
48 \subsubsection{Citing Jalview}
49 If you use Jalview in your work you should cite {\sl "The Jalview Java alignment editor"} Michele Clamp, James Cuff, Stephen M. Searle and Geoffrey J. Barton (2004) {\sl Bioinformatics} {\bf 20} 426-427. 
50   \r\subsection{About this tutorial }
51
52 This tutorial is written in a manual format with short exercises where appropriate, typically at the end of each section. The first chapter concerns the basic operation of Jalview and should be sufficient for those who just want to open an alignment, perform basic editing and colouring, and produce publication and presentation quality graphical output.
53
54 The second chapter covers analysis in Jalview, sequence alignment and visualisation of external features and structural data.
55
56 The third chapter covers the detail of Jalview and is aimed at the user who is already familiar with Jalview operation but wants to get more out of their Jalview experience.
57 \r\section{Obtaining and starting Jalview}\r
58 \begin{figure}[htbp]
59 \begin{center}
60 \includegraphics[width=4.5in]{images/download.pdf}
61 \caption{{\bf Download page on the Jalview web site}}
62 \label{download}
63 \end{center}
64 \end{figure}
65 \r       Jalview can be run in three ways; as an application from the web via Java Web Start, as an application loaded onto your hard drive, or as an applet embedded in a web page. This tutorial is only concerned with running the application via Web Start, though much of the information will be useful whichever way you run Jalview.\r\rThe Jalview web site is http://www.jalview.org/ and Jalview can be launched by navigating to the Download page (via the menu on the left hand side) and clicking the 'Start with Java Webstart' button. (figure \ref{download}). This will always launch the latest public release of Jalview.\r
66 \rThe application will start automatically though you may be prompted to accept a security certificate signed by the Barton Group. You can trust us so click trust or accept as appropriate. The splash screen (figure \ref{splash}) gives information about the latest version and the paper to cite in your publications. This information is also available on the Jalview web site and from the {\sl Help $\Rightarrow$ About} menu option.\r \r%[fig 2]
67 \begin{figure}[htbp]
68 \begin{center}
69 \includegraphics[width=4.5in]{images/splash.pdf}
70 \caption{{\bf Jalview splash screen}}
71 \label{splash}
72 \end{center}
73 \end{figure}
74
75
76 \rWhen Jalview starts it will automatically load an example alignment from the Jalview site. Later in the tutorial we will discover how to alter this behaviour. This alignment looks like figure \ref{startpage}. \r%[figure 3 ]\r
77 \begin{figure}[htbp]
78 \begin{center}
79 \includegraphics[width=4in]{images/start.pdf}
80 \caption{{\bf Default startup for Jalview}}
81 \label{startpage}
82 \end{center}
83 \end{figure}
84
85
86 \exercise{Starting Jalview}{
87 \label{start}
88 \exstep{Point your web browser at the Jalview web site and start Jalview by clicking on the 'Start with Java WebStart' button.} }
89
90 \subsection{Getting Help}
91
92 \subsubsection{Built in documentation}
93 Jalview has comprehensive on-line help documentation. Select  {\sl Help $\Rightarrow$ Documentation} from the main window menu and a new window will open (Figure \ref{help}). The appropriate topic can then be selected from the navigation panel on the left hand side. To search for a specific topic, click the 'search' tab and enter keywords in the box which appears.
94
95
96 \begin{figure}[htbp]
97 \begin{center}
98 \parbox[c]{2in}{\centerline{\includegraphics[width=1.75in]{images/help1.pdf}}}
99 \parbox[c]{4in}{\includegraphics[width=4in]{images/help2.pdf}}
100 \caption{{\bf Accessing the built in Jalview documentation}}
101 \label{help}
102 \end{center}
103 \end{figure}
104
105 \subsubsection{Email lists}
106
107 The Jalview developers can be contacted with news of bugs, feature requests and so on via the email address {\tt help@jalview.org}. A mailing list for information related to Jalview announcements and new releases can also be found on the Jalview web site.
108 \r\section{Navigation}
109 The major  features of the Jalview application are illustrated in Figure \ref{anatomy}. Each area of the alignment window has a separate context menu accessed by clicking the right mouse button.
110
111  Jalview has two navigation and editing modes: normal mode, where editing and navigation is performed using the mouse, and cursor mode where editing and navigation are performed using the keyboard. The F2 key is used to switch between these two modes. 
112
113 \begin{figure}[htb]
114 \begin{center}
115 \includegraphics[width=6.5in]{images/jalview_anatomy.pdf}
116 \caption{{\bf The anatomy of Jalview.} The major features of the Jalview application are labelled.}
117 \label{anatomy}
118 \end{center}
119 \end{figure}
120
121 \subsection{Navigation in Normal mode}
122 \rJalview always starts up in Normal mode. With anything more than a few residues or sequences, alignments become difficult to visualise on the screen.  Jalview shows a window on the alignment, limited by the size of the window and the font used to render it. You can move about the alignment by clicking and dragging the ruler scroll bar to move horizontally, or by clicking and dragging the alignment scroll bar to the right of the alignment to move vertically.  If all the rows or columns in the alignment are displayed, the scroll bars will not be visible.\r\rIt can help, especially when examining a large alignment, to have an overview of the whole alignment. Select {\sl View $\Rightarrow$ Overview Window} from the window menu (Figure \ref{overview}).\r%(figure 4)
123 \begin{figure}[htbp]
124 \begin{center}
125 \includegraphics[width=1.5in]{images/overviewmenu.pdf}
126 \includegraphics[width=4.5in]{images/overview.pdf}
127 \caption{{\bf Alignment Overview Window}}
128 \label{overview}
129 \end{center}
130 \end{figure}
131 \rThe red box in the overview window shows the current view in the alignment window. You can navigate around the alignment by dragging the red box. %Try this now and see how the view in the alignment window changes.\r\r\parbox[c]{3in}{We can close these windows by clicking on the icons indicated by arrows, or by selecting {\sl Window $\Rightarrow$ Close All} from the main menu. }
132 \parbox[c]{3in}{\centerline{\includegraphics[width=2.5in]{images/start_closeall.pdf}
133 }}
134 \r
135 \subsection{Navigation in Cursor mode}
136
137 \parbox[c]{5in}{Cursor mode provides a fast means for an experienced use to navigate to the part of the alignment in which they are interested. On pressing F2 to enter cursor mode the position of the cursor is indicated by a black background and white text. The cursor can be placed using the mouse or moved by pressing the arrow keys ($\uparrow$, $\downarrow$, $\leftarrow$, $\rightarrow$). 
138 }\parbox[c]{1.25in}{\centerline{\includegraphics[width=0.8in]{images/cursor1.pdf}}}
139
140 Rapid movement to specific positions is accomplished as listed below:
141 \begin{list}{$\circ$}{}
142 \item {\bf Jump to Sequence {\sl n}:} Type a number {\sl n} then press [S] to move to sequence (row) {\sl n}  
143 \item {\bf Jump to Column {\sl n}:} Type a number {\sl n} then press [C] to move to column {\sl n} in the alignment.  
144 \item {\bf Jump to Residue {\sl n}:} Type a number {\sl n} then press [P] to move to residue number {\sl n} in the current sequence.  
145 \item {\bf Jump to  column {\sl m} row {\sl n}:} Type the column number {\sl m}, a comma, the row number {\sl n} and press [RETURN]. 
146 \end{list}
147
148 \exercise{Navigation}{
149 \label{navigate}
150 \exstep{Scroll around the alignment using the alignment (vertical) and ruler (horizontal) scroll bars.}
151 \exstep{Find and open the Overview Window. Move around the alignment by clicking and dragging the red box in the overview window.}
152 \exstep{Look at the status bar as you move the mouse over the alignment. It should indicate information about the sequence and residue under the cursor.
153 }
154 \exstep{Press [F2] to enter Cursor mode. Use the arrow keys to move the cursor around the alignment. 
155 Move to sequence 7 by pressing {\sl 7 S}. Move to column 18 by pressing {\sl 1 8 C}. Move to residue 18 by pressing {\sl 1 8 P}. Note that these can be two different positions if gaps are inserted into the sequence. Move to sequence 5, column 13 by typing {\sl 1 3 , 5 [RETURN]}.
156 }
157
158 \r\section{Loading your own sequences}\r\rJalview provides many ways to load your own sequences. %For this section of the tutorial you will need to download the file http://www.jalview.org/tutorial/alignment.fa to a suitable location on your hard drive.\r\r\subsection{Drag and Drop}\r In some operating systems (Mac OS X, Windows XP) you can just drag a file icon from a file browser window and drop it on an open Jalview application window (Figure \ref{drag}). The file will then be opened as a new alignment window. %You can try this with the tutorial file you have downloaded. When you have opened the file, close it again by selecting the close control on the window.\rIf you drop an alignment file onto an open alignment window it will be appended to that alignment.\r%[fig 5]\r\begin{figure}[htbp]
159 \begin{center}
160 \includegraphics[width=2in]{images/drag2.pdf}
161 \includegraphics[width=2in]{images/drag3.pdf}
162 \caption{{\bf An alignment can be opened by dragging the file onto the Jalview window. }}
163 \label{drag}
164 \end{center}
165 \end{figure}
166
167 %\includegraphics[width=2in]{images/drag1.pdf}
168
169 \r\subsection{From a File}\r      Jalview can read sequence alignments from a sequence alignment file. This is a text file, not a word processor document. For entering sequences from a wordprocessor document see Cut and Paste  (section \ref{cutpaste}) below. Select {\sl File $\Rightarrow$ Input Alignment $\Rightarrow$ From File} from the main menu (Figure \ref{loadfile}). You will then get a file selection window where you can choose the file to open. Remember to select the appropriate file type. Jalview can automatically identify some sequence file formats.\r\r%[fig 6]\r\begin{figure}[htbp]
170 \begin{center}
171 \includegraphics[width=2in]{images/loadfilebox.pdf}
172 %\includegraphics[width=2in]{images/loadfilebox2.pdf}
173 \includegraphics[width=3in]{images/loadfileboxdrop.pdf}
174 \caption{{\bf Opening an alignment from a file saved on disk. }}
175 \label{loadfile}
176 \end{center}
177 \end{figure}
178 \r\subsection{From a URL}\r       Jalview can read sequence alignments directly from a URL. Please note that the files must be in a sequence alignment format - a pretty HTML alignment or graphics file cannot be read by Jalview. \rSelect {\sl File $\Rightarrow$ Input Alignment $\Rightarrow$ From URL}  from the main menu and a window will appear asking you to enter the URL (figure \ref{loadurl}). Jalview will attempt to automatically discover the file format.\r\r%[fig 7]
179 \begin{figure}[htbp]
180 \begin{center}
181 \includegraphics[width=2in]{images/menuloadurl.pdf}
182 \includegraphics[width=3in]{images/loadurlbox.pdf}
183 \caption{{\bf Opening an alignment from a URL }}
184 \label{loadurl}
185 \end{center}
186 \end{figure}
187 \r\subsection{Cut and Paste}
188 \label{cutpaste}\rDocuments such as those produced by Microsoft Word cannot be readily understood by Jalview. The way to read sequences from these documents is to select the data from the document and copy it to the clipboard. Select {\sl File $\Rightarrow$ Input Alignment $\Rightarrow$ From Textbox} from the main menu and a textbox window will appear (Figure \ref{loadtext}). Paste the sequences you have copied to the clipboard and, presuming that they are in the right format, Jalview will happily read them.\r%[fig 8]
189 \r
190 \begin{figure}[htbp]
191 \begin{center}
192 \includegraphics[width=2in]{images/menuloadtext.pdf}
193 \includegraphics[width=3in]{images/loadtextbox.pdf}
194 \caption{{\bf Opening an alignment from pasted text }}
195 \label{loadtext}
196 \end{center}
197 \end{figure}
198
199 \r\subsection{From a public database}\rJalview can retrieve sequences and sequence alignments from public databases such as Uniprot, Pfam and the PDB. This facility avoids having to manually locate, save and load the sequences.\rSelect {\sl File $\Rightarrow$ Fetch Sequence(s) \ldots} from the main menu and a window will appear (Figure \ref{loadseq}). Select the appropriate database, enter a sequence ID/accession number, or several separated by a semicolon and Jalview will retrieve it/them from the public databases housed at the European Bioinformatics Institute.\r\r%[fig 9]\r\begin{figure}[htbp]
200 \begin{center}
201 \includegraphics[width=3in]{images/fetchseq.pdf}
202 \caption{{\bf Retrieving sequences from a public database}}
203 \label{loadseq}
204 \end{center}
205 \end{figure}
206
207 \exercise{Loading sequences}{
208 \label{load}
209 \exstep{Start Jalview then close all windows by selecting {\sl Window $\Rightarrow$ Close All} from the main menu}
210 \exstep{Select {\sl File $\Rightarrow$ Input Alignment $\Rightarrow$ From URL} from the main menu and enter \textsf{http://www.jalview.org/tutorial/alignment.fa} in the box. Click {\sl OK} and the alignment should load.
211 }
212 \exstep{Close all windows using the {\sl Window $\Rightarrow$ Close All} main menu option. Point your web browser to \textsf{http://www.jalview.org/tutorial/alignment.fa} and save the file to your desktop. Open this file in Jalview by selecting {\sl File $\Rightarrow$ Input Alignment $\Rightarrow$ From File} from the main menu and browsing to the appropriate location. Click OK and load the alignment
213 }
214 \exstep{
215 Drag the alignment.fa file from the desktop onto the Jalview window. The alignment should open. Try dragging onto an empty Jalview and onto an existing alignment and observe the results.
216 }
217 \exstep{
218 Select {\sl File $\Rightarrow$ Fetch Sequence(s)\ldots } from the main menu. Select the {sl PFAM} database and enter the accession number PF03460. Click OK. An alignment of about 107 sequences should load.
219 }
220 \exstep{Open the URL \textsf{http://www.jalview.org/tutorial/alignment.fa}  in a web browser. Select and copy the entire text to the clipboard (usually via the browser's {\sl Edit $\Rightarrow$ Copy} menu option). Ensure Jalview is running and select {\sl File $\Rightarrow$ Input Alignment $\Rightarrow$ From   Textbox} . Paste the clipboard into the large window using the {\sl Edit $\Rightarrow$ Paste} text box menu option. Click {\sl Close} and the alignment will be loaded.
221 }
222 }\r\section{Writing sequence alignments}\r\subsection{Saving the alignment}\rJalview allows the current sequence alignments to be saved to file so they can be restored at a later date, passed to colleagues or analysed in other programs. From the alignment window menu select {\sl File $\Rightarrow$ Save As} and a dialog box will appear (Figure \ref{savealign}). You can navigate to an appropriate directory in which to save the alignment. Jalview offers several different formats in which an alignment can be saved. The jalview format is the only one which will preserve the colours, groupings and similar information in the alignment. The other formats produce text files containing just the sequences with no visualisation information. Unfortunately only Jalview can read Jalview files. Using the {\sl File $\Rightarrow$ Output To Textbox} menu option allows the alignment to be copied and pasted into other documents or web servers.
223 \r%[fig 10]\r
224 \begin{figure}[htbp]
225 \begin{center}
226 \includegraphics[width=1.75in]{images/saveas.pdf}
227 \includegraphics[width=3.5in]{images/saveas2.pdf}
228 \caption{{\bf Saving alignments in Jalview to disk}}
229 \label{savealign}
230 \end{center}
231 \end{figure}
232
233 \subsection{Jalview Projects}\r\parbox[c]{4in}{If you wish to save the complete Jalview session rather than just one alignment (e.g. because you have calculated trees or multiple different alignments) then your work should be saved as a Jalview Project file. From the main menu select {\sl File $\Rightarrow$ Save Project} and a file save dialog box will appear. Loading a project will restore Jalview to exactly the view at which the file was saved, complete with all alignments, trees etc. rendered appropriately.}
234 \parbox[c]{2in}{
235 \centerline {
236 \includegraphics[width=1.5in]{images/saveproj.pdf}
237 }}
238
239 \exercise{Saving Alignments}{
240 \label{save}
241 \exstep{Start Jalview, close all windows and load the ferrodoxin alignment from pFam (accession number PF03460 (see Exercise \ref{load}).
242 }
243 \exstep{
244 Select {\sl File $\Rightarrow$ Save As} from the alignment window menu. Choose a location into which to save the alignment and select a format. All formats except {\sl  Jalview } can be viewed in a normal text editor (e.g. Notepad) or in a web browser. Enter a file name and click {\sl Save}. Check this file by browsing to it with your web browser or by closing all windows and opening it with Jalview. 
245 }
246 \exstep{ Repeat the previous step trying different file formats.}
247 \exstep{Select {\sl File $\Rightarrow$ Output to Textbox $\Rightarrow$ FASTA}. You can select and copy this alignment to the clipboard using the textbox menu options {\sl Edit $\Rightarrow$ Select All} followed by {\sl Edit $\Rightarrow$ Copy}. The alignment can then be pasted into any application of choice, e.g. a word processor or web form.
248 }
249 \exstep{Ensure at least one alignment window is shown in Jalview. Open the overview window and scroll to any part of the alignment. Select {\sl File $\Rightarrow$ Save Project} from the main menu and save in a suitable place. Close all windows and then load the project via the {\sl File $\Rightarrow$ Save Project} menu option. Note how all the windows and positions  are exactly as they were when they were saved.
250 }
251 }
252 \r\r\section{Selecting and editing sequences} \rJalview makes extensive use of selections which are arbitrary regions in an alignment. This section illustrates how to make and use selections and groups. 
253 \r\subsection{Selecting parts of an alignment}
254 Selections can be of arbitrary regions in an alignment, one or more complete columns, or one or more complete sequences.
255  
256 A selected region can be copied and pasted as a new alignment using the {\sl Edit $\Rightarrow$ Copy} and {\sl Edit $\Rightarrow$ Paste $\Rightarrow$ As New Alignment}  alignment window menu options.\r
257
258 To clear (unselect)  the selection press the [ESC] (escape) key.
259
260 \subsubsection{Selecting arbitrary regions}\rTo select part of an alignment, place the mouse at the top left corner of the region you wish to select. Press the mouse button and drag the mouse to the bottom right corner of the chosen region before releasing the mouse button. A dashed red box appears around the selected region (Figure \ref{select}). \r%[fig 12]
261
262 \begin{figure}[htbp]
263 \begin{center}
264 \includegraphics[width=4in]{images/select1.pdf}
265 \caption{{\bf Selecting a region in an alignment}}
266 \label{select}
267 \end{center}
268 \end{figure}
269
270 \subsubsection{Selecting columns}\rTo select the same residues in all sequences, click and drag along the alignment ruler. This selects the entire height of the alignment. Ranges of positions can also be selected by clicking on the first position then holding down the [SHIFT] key whilst clicking the other end of the selection. Discontinuous regions can be selected by holding down [CTRL] and clicking on positions to add to the selection. Selected columns are indicated by red highlighting in the ruler bar (Figure \ref{selectcols}).\r%[fig 13]
271
272 \begin{figure}[htbp]
273 \begin{center}
274 \includegraphics[width=4in]{images/select2.pdf}
275 \caption{{\bf Selecting multiple columns in an alignment}}
276 \label{selectcols}
277 \end{center}
278 \end{figure}
279
280 \subsubsection{Selecting sequences}
281
282 \begin{figure}[htb]
283 \begin{center}
284 \includegraphics[width=4in]{images/select3.pdf}
285 \caption{{\bf Selecting multiple sequences in an alignment}}
286 \label{selectrows}
287 \end{center}
288 \end{figure}
289 \rTo select multiple complete sequences, click and drag the mouse along the sequence ID panel. Multiple sequences will be selected. The same technique as used for columns above can be used with SHIFT-Click  and CTRL-Click to select discontinuous ranges of sequences (Figure \ref{selectrows}).\r%[fig 14]
290
291
292
293
294 \subsubsection{Making selections in Cursor mode}
295
296 To define a selection in cursor mode, navigate to the top left corner of the proposed selection. Pressing the [Q] key marks this as the corner. A red outline appears around the cursor (Figure \ref{cselect})
297
298 Navigate to the bottom right corner of the proposed selection and press the [M] key. This marks the bottom right corner of the selection. The selection can then be treated in the same way as if it had been created in normal mode.
299
300
301 \begin{figure}[htbp]
302 \begin{center}
303 \includegraphics[width=1.5in]{images/csel1.pdf}
304 \includegraphics[width=1.5in]{images/csel2.pdf}
305 \includegraphics[width=1.5in]{images/csel3.pdf}
306 \includegraphics[width=1.5in]{images/csel4.pdf}
307 \caption{{\bf Making a selection in cursor mode.}Navigate to the top left corner (left), press [Q] (left center), navigate to the bottom right corner (right center) and press [M] (right)}
308 \label{cselect}
309 \end{center}
310 \end{figure}
311 \r\r\subsection{Creating groups}\rSelections are lost as soon as a different region is selected. Groups can be created which are labeled regions of the alignment. To create a group, first select the region which is to comprise the group. Then click the right mouse button on the selection to bring up a context menu. Select {\sl Selection $\Rightarrow$ Group $\Rightarrow$ Group} then enter a name for the group in the dialogue box which appears. 
312
313 \begin{figure}[htbp]
314 \begin{center}
315 \includegraphics[width=3.5in]{images/group1.pdf}
316 \includegraphics[width=2in]{images/newgroup.pdf}
317 \caption{{\bf Creating a new group from a selection}}
318 \label{makegroup}
319 \end{center}
320 \end{figure}
321
322 By default the selection will have a box drawn around it. The appearance of the group can be changed (see section \ref{colours} below). This group will stay defined even when the selection is removed.\r
323
324 \exercise{Making selections and groups}{
325 \label{exselect}
326 \exstep{Close all windows in  Jalview and load the ferrodoxin alignment (PFAM ID PF03460). Choose a residue and  place the mouse cursor on it. Click and drag the mouse cursor to create a selection. As you drag, a red box will 'rubber band' out to show the extent of the selection. Release the mouse button and a red box should border the selected region. Now press [ESC] to clear the selection.}
327 \exstep{
328 Select one sequence by clicking on the id panel. Note that the sequence ID takes on a highlighted background and a red box appears around the selected sequence. Now hold down [SHIFT] and click another sequence ID a few positions above or below. Note how the selection expands to include all the sequences between the two positions on which you clicked.
329 Now hold down [CTRL] and click on several sequences ID's both selected and unselected. Note how unselected IDs are individually added to the selection and previously selected IDs are individually deselected. 
330 }
331 \exstep{ Repeat the step above but selecting columns by clicking on the ruler bar instead of selecting rows by clicking on the sequence ID.
332 }
333 \exstep{Press [F2] to enter Cursor mode. Navigate to column 59, row 1 by pressing {\sl 5 9 , 1 [RETURN]}. Press {\sl Q} to mark this position. Now navigate to column 65, row 8 by pressing {\sl 6 5 , 8 [RETURN]}. Press {\sl M} to complete the selection.}
334
335 }
336
337 \r\subsection{Reordering the alignment}\rSequence reordering is simple. Highlight the sequences to move then press the up or down arrow keys as appropriate (Figure \ref{reorder}). If you wish to move a sequence up past several other sequences it is often quicker to select the group past which you want to move it and then move the group rather than the individual sequence.\r\r\begin{figure}[htbp]
338 \begin{center}
339 \includegraphics[width=3in]{images/move1.pdf}
340 \includegraphics[width=3in]{images/move2.pdf}
341 \caption{{\bf Reordering the alignment.} The selected sequence moves up one position on pressing the $\uparrow$ key}
342 \label{reorder}
343 \end{center}
344 \end{figure}
345
346 \exercise{Reordering the alignment}{
347 \exstep{Open an alignment (e.g.the PFAM domain PF03460). Select one sequence. Using the up and down arrow keys, alter it's position in the alignment.
348 }
349 }
350
351 \subsection{Introducing and removing gaps}
352
353 Jalview provides interactive editing, allowing sequences to be dragged to create gaps.
354
355 \subsubsection{Introducing gaps in a single sequence}
356
357 To introduce a gap, place the cursor on the residue to the immediate right of where the gap should appear. Hold down the SHIFT key and the left mouse button, then drag the sequence to the right till the required number of gaps has been inserted.
358
359 One common error is to forget to hold down [SHIFT]. This results in a selection which is one sequence high and one residue long. Gaps cannot be inserted in such a selection. The selection can be cleared and editing enabled by pressing the [SHIFT] key.
360
361 \begin{figure}[htb]
362 \begin{center}
363 \includegraphics[width=3in]{images/edit1.pdf}
364 \includegraphics[width=3in]{images/edit2.pdf}
365 \caption{{\bf Introducing gaps.} Gaps are introduced as the selected sequence is dragged to the right.}
366 \label{gapseq}
367 \end{center}
368 \end{figure}
369
370 \subsubsection{Introducing gaps in all sequences of a group}
371
372 To insert gaps in all sequences in a selection or group, place the mouse cursor  on any residue in the selection or group to the immediate right of the position in which a gap should appear. Hold down the CTRL key and the left mouse button, then drag the sequences to the right until the required number of gaps has appeared.
373
374 \begin{figure}[htb]
375 \begin{center}
376 \includegraphics[width=3in]{images/edit3.pdf}
377 \includegraphics[width=3in]{images/edit4.pdf}
378 \caption{{\bf Introducing gaps.} Gaps are introduced as the selected group is dragged to the right.}
379 \label{gapgroup}
380 \end{center}
381 \end{figure}
382
383 Gaps can be removed by dragging the residue to the immediate right of the gap leftwards whilst holding down [SHIFT] (for single sequences) or [CTRL] (for a group of sequences).
384
385 \subsubsection{Editing in Cursor mode}
386
387 Gaps can be inserted in cursor mode by pressing [SPACE]. Gaps will be inserted at the cursor, pushing the residue under the cursor to the right. To insert {\sl n} gaps type {\sl n} and then press [SPACE]. To insert gaps into all sequences of a group, use [CTRL]-[SPACE] or [SHIFT]-[SPACE] (both keys held down together).
388
389 Gaps can be removed in cursor mode by pressing [BACKSPACE]. The gap under the cursor will be removed. To remove {\sl n} gaps, type {\sl n} and then press [BACKSPACE]. Gaps will be deleted up to the number specified. To delete gaps from all sequences of a group, use [CTRL]-[BACKSPACE] or [SHIFT]-[BACKSPACE] (both keys held down together).
390  
391
392 \subsubsection{Undoing edits}
393 Jalview supports the undoing of edits via the {\sl Edit $\Rightarrow$ Undo Edit} alignment window menu option. Each editing action is stored and can be reversed in sequence. Colouring of the alignment is not reversible via the {\sl Undo} option.  
394
395 \exercise{Editing alignments}{
396 \exstep{
397 Load the URL \textsf{http://www.jalview.org/tutorial/unaligned.fa}  which contains part of the ferrodoxin alignment from PF03460. Select the lower 5 sequences.
398 }
399 \exstep{
400 Place the mouse cursor over the selection at column 24. ({\tt RVG{\bf G}QAK} in O23813\_ MAIZE). Hold down [CTRL], press down the mouse button and drag the sequences two spaces to the right until the G is aligned with the G in the row above. Release the mouse button and the [CTRL] key.
401 }
402 \exstep{ Repeat for the next residue Q until it aligns with the Q in the row above. 
403 }
404 \exstep{
405 Try editing a single sequence. Hold down [SHIFT] and drag the sequence to the right. Just the clicked on sequence should move.
406 }
407 \exstep{
408 Delete the gaps created in the previous step by [SHIFT]-Clicking on the residue and dragging it to the left. 
409 }
410 \exstep{
411 Use the {\sl Edit $\Rightarrow$ Undo Edit} menu option to step backwards through the edits you have made.
412 }
413 }
414
415 \exercise{Keyboard edits}{
416 \exstep{Load the sequence alignment at \textsf{http://www.jalview.org/tutorial/unaligned.fa}. Enter cursor mode by pressing [F2]}
417 \exstep{Insert 58 gaps at the start of the first sequence (FER\_CAPAA). Press {\sl 58} then {\sl [SPACE]}. }
418 \exstep{Go down one sequence and select rows 2-5 as a block. Click on the second sequence id (FER\_CAPAN). Hold down shift and click on the fifth (FER1\_PEA). }
419 \exstep{Insert 6 gaps at the start of this group. Go to column 1 row 2 by typing {\sl 1,2} then pressing {\sl [RETURN]}. Now insert 6 gaps. Type {\sl 6} then hold down [CTRL] and press the space bar.}
420 \exstep{Now insert one gap at column 34 and another at 38. Insert 3 gaps at 47. Press {\sl 3 4 C} then [CTRL]-[SPACE].  Press {\sl 3 8 C} then [CTRL]-[SPACE]. Press {\sl 4 7 C} then {\sl 3 [CTRL-SPACE]} the first through fourth sequences are now aligned.} 
421 \exstep{The fifth sequence (FER1\_PEA) is poorly aligned. We will delete some gaps and add some new ones. Navigate to the start of sequence 5 and delete 3 gaps. Press {\sl 1 , 5 [RETURN]} then {\sl 3 [BACKSPACE]} to delete three gaps. Go to column 31 and delete the gap. Press {\sl 3 1 C [BACKSPACE]} .}
422 \exstep{ Similarly delete the gap now at column 34, then insert two gaps at column 38 . Press {\sl 3 4 C [BACKSPACE]  3 8 C  2 [SPACE]}. Delete three gaps at 44 and insert one at 47 by pressing {\sl 4 4 C 3 [BACKSPACE] 4 7 C [SPACE]}.  The top five sequences are now aligned.}
423 }
424 \r\subsection{Hiding regions}
425
426 It can be the case that one does not wish to view some sequences or residues in the alignment but does not wish to remove them from the alignment. Jalview allows sequences or regions to be hidden. To hide a set of sequences, select them and right-click the mouse on the selected sequence id's to bring up the context menu. Select {\sl Hide Sequences} and the sequences will be concealed, with a small triangle indicating their position (Figure \ref{hideseq}). To unhide (reveal) the sequences, right click on the triangle and select {\sl Reveal Sequences} from the context menu.
427
428
429  \begin{figure}[htbp]
430 \begin{center}
431 \includegraphics[width=1.5in]{images/hide1.pdf}
432 \includegraphics[width=2.5in]{images/hide2.pdf}
433 \includegraphics[width=1.75in]{images/hide3.pdf}
434 \caption{{\bf Hiding Sequences} Hidden sequences are represented by a blue triangle in the sequence ID panel}
435 \label{hideseq}
436 \end{center}
437 \end{figure}
438
439
440
441 A similar mechanism applies to columns (Figure \ref{hidecol}). Selected columns can be hidden and revealed in the same way via the context menu (right click) on the ruler bar. The hidden selection is indicated by a blue triangle in the ruler bar.
442
443  \begin{figure}[htbp]
444 \begin{center}
445 \includegraphics[width=2in]{images/hide4.pdf}
446 \includegraphics[width=3in]{images/hide5.pdf}
447 \includegraphics[width=1in]{images/hide6.pdf}
448 \caption{{\bf Hiding Columns} Hidden columns are represented by a blue triangle in the ruler bar}
449 \label{hidecol}
450 \end{center}
451 \end{figure}
452
453 \exercise{Hiding and revealing regions}{
454 \exstep{Close all windows then open the PFAM accession PF03460. Select a contiguous set of sequences by clicking and dragging on the sequence ID panel. Right click on the selected sequence IDs and select {\sl Hide Sequences}.
455 }
456 \exstep{
457 Right click on the blue triangle indicating hidden sequences and select {\sl Reveal Sequences}. (If you have hidden all sequences then you will need to use the alignment window menu option {\sl View $\Rightarrow$ Show $\Rightarrow$ All Sequences.})
458 }
459 \exstep{
460 Repeat but using a non-contiguous set of sequences. Note that when multiple regions are hidden there are two options, {\sl Reveal Sequences} and {\sl Reveal All}.
461 }
462 \exstep{Repeat the above but hiding and revealing columns instead of sequences.
463 }
464 }
465 \r\section{Colouring sequences}
466 \label{colours}\r
467
468 Colouring sequences is a key aspect of alignment presentation. Jalview allows both for colouring of the whole alignment and colouring of selections/groups. The colour schemes available are the same for both mechanisms and are described in section \ref{colscheme} below.
469
470 \subsection{Colouring the whole alignment}
471
472 \parbox[c]{3.75in}{The alignment can be coloured via the Colour  menu option in the alignment window. Selecting the colour scheme causes all residues to be coloured.
473
474 For certain colour schemes, the  intensity of the colour can be scaled by a conservation threshold. Selecting {\sl Colour $\Rightarrow$ By Conservation} brings up a selection box allowing the alignment colouring to be modified. Selecting a higher threshold limits colouring to higher conserved groups (Figure \ref{colcons}).
475
476 }\parbox[c]{3in}{
477 \centerline {
478 \includegraphics[width=2.5in]{images/colour2.pdf}
479 }
480 }
481
482 %For certain colour schemes, the  intensity of the colour can be scaled by a conservation threshold. Selecting {\sl Colour $\Rightarrow$ By Conservation} brings up a selection box allowing the alignment colouring to be modified. Selecting a higher threshold limits colouring to higher conserved groups.
483
484  \begin{figure}[htbp]
485 \begin{center}
486 \includegraphics[width=2in]{images/colourcons1.pdf}
487 \includegraphics[width=2in]{images/colourcons3.pdf}
488 \includegraphics[width=2in]{images/colourcons5.pdf}
489 \caption{{\bf Conservation Threshold} The transparency of the residue colouring is controlled by the conservation threshold. The effect of 0\% (left), 50\% (center) and 100\% (right) thresholds are shown.
490 }
491 \label{colcons}
492 \end{center}
493 \end{figure}
494
495
496
497
498 %fig
499 \subsection{Colouring a group or selection}
500
501 Selections or groups can be coloured via two ways. The first is via the alignment Colour menu but ensuring that the Apply to all groups flag is not selected. This will have to be turned off specifically as it is on by default.
502
503 The second method is to use the  {\sl Selection $\Rightarrow$ Group $\Rightarrow$ Group Colour}  context menu option obtained by right clicking on the group (Figure \ref{colgrp}). 
504
505 \begin{figure}[htbp]
506 \begin{center}
507 \includegraphics[width=4in]{images/group_col.pdf}
508 \caption{{\bf Colouring a group via the context menu.}}
509 \label{colgrp}
510 \end{center}
511 \end{figure}
512
513 \subsection{Colour schemes} 
514 \label{colscheme}
515 Full details on each colour scheme can be found in the Jalview on-line help. 
516 \r
517 \subsubsection{ClustalX}
518
519
520  \parbox[c]{3.5in}{This is an emulation of the default colourscheme used for alignments in Clustal X, a graphical interface for the ClustalW multiple sequence alignment program. Each residue in the alignment is assigned a colour if the amino acid profile of the alignment at that position meets some minimum criteria specific for the residue type. }
521 \parbox[c]{3in}{\includegraphics[width=2.75in]{images/col_clustalx.pdf}}
522
523 \subsubsection{Blosum62}
524
525 \parbox[c]{3.5in}{Gaps are coloured white. If a residue matches the consensus sequence residue at that position it is coloured dark blue. If it does not match the consensus residue but the Blosum 62 matrix gives a positive score, it is coloured light blue.}
526 \parbox[c]{3in}{
527 \includegraphics[width=2.75in]{images/col_blosum62.pdf}
528 }
529
530 \subsubsection{Percentage Identity}
531 \parbox[c]{3.5in}{
532 The Percent Identity  option colours the residues (boxes and/or text) according to the percentage of the residues in each column that agree with the consensus sequence. Only the residues that agree with the consensus residue for each column are coloured.
533 }
534 \parbox[c]{3in}{
535 \includegraphics[width=2.75in]{images/col_percent.pdf}
536 }
537
538 \subsubsection{Zappo}
539 \parbox[c]{3.5in}{
540 The residues are coloured according to their physicochemical properties. The physicochemical groupings are Aliphatic/hydrophobic, Aromatic, Positive, Negative, Hydrophillic, conformationally special, and Cyst(e)ine.
541 }
542 \parbox[c]{3in}{
543 \includegraphics[width=2.75in]{images/col_zappo.pdf}
544 }
545
546 \subsubsection{Taylor}
547
548 \parbox[c]{3.5in}{
549 This colour scheme was devised by Willie Taylor and an entertaining description of it's origin can be found in Protein Engineering, Vol 10 , 743-746 (1997)
550 }
551 \parbox[c]{3in}{
552 \includegraphics[width=2.75in]{images/col_taylor.pdf}
553 }
554
555 \subsubsection{Hydrophobicity}
556 \parbox[c]{3.5in}{
557 Residues are coloured according to the hydrophobicity table of Kyte, J., and Doolittle, R.F., J. Mol. Biol. 1157, 105-132, 1982. The most hydrophobic residues are coloured red and the most hydrophilic ones are coloured blue.
558 }
559 \parbox[c]{3in}{
560 \includegraphics[width=2.75in]{images/col_hydro.pdf}
561 }
562
563 \subsubsection{Helix Propensity}
564
565 \parbox[c]{3.5in}{
566 The residues are coloured according to their helix propensity. The highest propensity is magenta, the lowest is green.
567 }
568 \parbox[c]{3in}{
569 \includegraphics[width=2.75in]{images/col_helix.pdf}
570 }
571
572 \subsubsection{Strand Propensity}
573
574 \parbox[c]{3.5in}{
575 The residues are coloured according to their Strand propensity. The highest propensity is Yellow, the lowest is blue.
576 }
577 \parbox[c]{3in}{
578 \includegraphics[width=2.75in]{images/col_strand.pdf}
579 }
580
581
582
583 \subsubsection{Turn Propensity}
584 \parbox[c]{3.5in}{
585 The residues are coloured according to their turn propensity. The highest propensity is red, the lowest is cyan.
586 }
587 \parbox[c]{3in}{
588 \includegraphics[width=2.75in]{images/col_turn.pdf}
589 }
590
591 \subsubsection{Buried Index}
592 \parbox[c]{3.5in}{
593 The residues are coloured according to their burial propensity. The highest propensity is blue, the lowest is green.
594 }
595 \parbox[c]{3in}{
596 \includegraphics[width=2.75in]{images/col_buried.pdf}
597 }
598  
599
600 \subsubsection{Nucleotide}
601 \parbox[c]{3.5in}{
602 Residues are coloured with four colours corresponding to the four nucleotide bases. All non ACTG residues are uncoloured.
603 }
604 \parbox[c]{3in}{
605 \includegraphics[width=2.75in]{images/col_nuc.pdf}
606 }
607
608
609
610 \exercise{Colouring Alignments}{ 
611 \exstep{
612 Open a sequence alignment, for example the PFAM domain PF03460. Select the alignment menu option {\sl Colour $\Rightarrow$ ClustalX}. Note the colour change. Now try all the other colour schemes in the {\sl Colour} menu. Note that some colour schemes do not colour all residues.
613 }
614 \exstep{
615 Colour the alignment using {\sl Colour  $\Rightarrow$ Blosum62}. Select a group of around 4 similar sequences. Use the context menu (right click on the group) option {\sl Selection $\Rightarrow$ Group $\Rightarrow$ Group Colour $\Rightarrow$ Blosum62} to colour the selection. Notice how some residues which were not coloured are ntw coloured. The calculations performed for colouring schemes just apply to the group being coloured, not the whole alignment.
616 }
617 \exstep{
618 Keeping the same selection as before, colour the complete alignment using {\sl Colour  $\Rightarrow$ Taylor}. Select the menu option  {\sl Colour  $\Rightarrow$ By Conservation}. Slide the selector from side to side and observe the changes in the alignment colouring in the selection and in the complete alignment. 
619 }
620 }
621
622 \subsubsection{User Defined}
623 This dialogue allows the user to create any number of names colour schemes at will. Any residue may be assigned any colour. The colour scheme can then be named. If you save the colour scheme, this name will appear on the Colour menu
624
625
626 \begin{figure}[htbp]
627 \begin{center}
628 \includegraphics[width=2.5in]{images/col_user1.pdf}
629 \includegraphics[width=2in]{images/col_user2.pdf}
630 \includegraphics[width=1.75in]{images/col_user3.pdf}
631 \caption{{\bf Creation of a user defined colour scheme.} Residue types are assigned colours (left). The profile is saved (center) and can then be accessed via the {\sl Colour} menu (right).}
632 \label{usercol}
633 \end{center}
634 \end{figure}
635
636
637 \exercise{User defined colour schemes}{
638 \exstep{Load a sequence alignment. Select the alignment menu option {\sl Colour $\Rightarrow$ User Defined}. A dialogue window will open.
639 }
640 \exstep{Click on an amino acid button, then select a colour for that amino acid. Repeat till all amino acids are coloured to your liking.
641 }
642 \exstep{ Insert a name in the appropriate field and click {\sl Save Scheme}. You will be prompted for a file name in which to save the colour scheme. The dialogue window can now be closed.
643 }
644 \exstep{
645 The new colour scheme appears in the list of colour schemes in the {\sl Colour} menu and can be selected in future Jalview sessions.
646 }
647 }
648 \r\section{Screen layout and graphics output}\r
649
650 \subsection{Screen layout}
651 Jalview provides two screen layout modes, unwrapped (the default) where the alignment is in one long line across the window, and wrapped, where the alignment is on multiple lines, each the width of the window. Most layout options are controlled by the Format menu option in the alignment window.
652 \subsubsection{Wrapped alignments}
653 Wrapped alignments can be toggled on and off using the {\sl Format $\Rightarrow$ Wrap} menu option (Figure \ref{wrap}). Note that the annotation lines are also wrapped. Wrapped alignments are great for publications and presentations but are hard to work with on the screen. Selecting regions can be difficult if they span more than one line.
654
655 \begin{figure}[htbp]
656 \begin{center}
657 \parbox[c]{2in}{\includegraphics[width=2in]{images/wrap1.pdf}}
658 \parbox[c]{4in}{\includegraphics[width=4in]{images/wrap2.pdf}}
659 \caption{{\bf Wrapping the alignment}}
660 \label{wrap}
661 \end{center}
662 \end{figure}
663
664
665 \subsubsection{Fonts}
666
667 \parbox[c]{4in}{Text appearance can be modified via the {\sl Format $\Rightarrow$ Font\ldots} alignment window menu. Additionally, font size and spacing can be adjusted rapidly by clicking the middle mouse button and dragging across the alignment window.}
668 \parbox[c]{2in}{\centerline{\includegraphics[width=1.75in]{images/font.pdf}}}
669
670 \subsubsection{Numbering and annotations}
671
672 The {\sl Format} menu also provides options to control the display of numbers and annotations on sequence alignments.
673 The annotation lines which appear below the sequence alignment can be hidden by toggling the {\sl View $\Rightarrow$ Show Annotations} menu option. Additionally, each annotation line can be hidden and revealed in the same way as sequences via the context menu on the annotation name panel (Figure \ref{annot}). Annotations can be reordered by dragging the annotation line label on the annotation label panel. Placing the mouse over the top annotation label brings up a resize icon. Dragging the top annotation line label up and down alters the relative size of the sequence alignment and annotation alignment panels.
674
675 \begin{figure}
676 \begin{center}
677 \includegraphics[width=2.5in]{images/annot1.pdf}
678 \includegraphics[width=2.5in]{images/annot2.pdf}
679 \caption{{\bf Hiding Annotations} Annotations can either be hidden from the {\sl View} menu (left) or individually from the context menu (right)}
680 \label{annot}
681 \end{center}
682 \end{figure}
683
684 \exercise{Screen Layout}{
685 \label{exscreen}
686 \exstep{Start Jalview and open the URL \textsf{http://www.jalview.org/examples/exampleFile.jar}. Select {\sl Format $\Rightarrow$ Wrap} from the alignment window menu. Experiment with the various options from the {\sl Format} menu. to adjust the ruler placement, sequence ID format and so on. }
687 \exstep{Hide all the annotation rows by selecting {\sl View $\Rightarrow$ Show Annotations} from the alignment window menu. Reveal the annotations by selecting the same menu option.} 
688 \exstep{Right click on the annotation row labels to bring up the context menu.  Select {\sl Hide This Row}. Bring up th econtext menu again and select {\sl Show All Hidden Rows} to reveal them}
689 \exstep{Annotations can be reordered by clicking and dragging the row to the desired position. Click on the {\sl Consensus} row and drag it upwards to just above {\sl Quality}. The rows should now be reordered. Features and annotations are covered in more detail in section \ref{featannot} below.}
690 \exstep{Drag the Secondary Structure label to resize the Alignment Annotation panel}
691 }
692
693 \subsection{Graphical output}
694
695 \parbox[c]{4in}{Jalview allows alignments to be exported in three different formats, each of which is suited to a particular purpose. Image export is via the {\sl File $\Rightarrow$ Export Image $\Rightarrow$ \ldots } alignment window menu option. }
696 \parbox[c]{2in}{\centerline{\includegraphics[width=1.25in]{images/image.pdf}}}
697
698 \subsubsection{HTML}
699
700 \parbox[c]{3in}{HTML is the format used by web pages. Jalview outputs the alignment as an HTML table with all the colours and fonts as seen. This file can then be viewed directly with any web browser. Each residue is placed in an individual table cell. Unwrapped alignments will produce a very wide page.}
701 \parbox[c]{3.5in}{\centerline{\includegraphics[width=3in]{images/image_html.pdf}}}
702
703 \subsubsection{EPS}
704 \parbox[c]{3in}{EPS is Encapsulated Postscript. It is the format of choice for publication and posters as it gives the highest quality output of any of the image types. It can be scaled indefinitely so will still look good on an A0 poster. This format can be read by most good presentation and graphics packages such as Adobe Illustrator.
705 }
706 \parbox[c]{3.5in}{\centerline{\includegraphics[width=3in]{images/image_eps.pdf}} \par \centerline{Zoom Detail of EPS image.}}
707
708 \subsubsection{PNG}
709 \parbox[c]{3in}{
710 PNG is Portable Network Graphics. This output option produces an image that can be easily included in web pages and incorporated in presentations using e.g. Powerpoint or Open Office. It is a bitmap image so does not scale and is unsuitable for use on posters.
711 }
712 \parbox[c]{3.5in}{\centerline{\includegraphics[width=3in]{images/image_png.pdf}} \par \centerline{Zoom Detail of PNG image.}}
713
714 \exercise{Graphical Output}{
715 \exstep{Load the example Jalview Jar file in Exercise \ref{exscreen}. Customise it how you wish but leave it unwrapped. Select {\sl File $\Rightarrow$ Export Image $\Rightarrow$ HTML} from the alignment menu. Save the file and open it in your favourite web browser.  }
716 \exstep{Now wrap the alignment (Exercise \ref{exscreen}) and export the image to HTML again. Compare the two images. Note that the exported image matches the format displayed in the alignment window but annotations are not exported.}
717 \exstep{Export the alignment using the {\sl File $\Rightarrow$ Export Image $\Rightarrow$ PNG} menu option. Open the file in an image viewer that allows zooming (eg. Paint or Photoshop on Windows, Preview on Mac OS X) and zoom in. Notice that the image is a bitmap and it becomes pixelated very quickly. Note also that the annotation lines are included in the image.}
718 \exstep{Export the alignment using the {\sl File $\Rightarrow$ Export Image $\Rightarrow$ EPS} menu option. Open the file in a suitable program such as Ghostview or Preview (Mac OS X). Zoom in and note that the image is indefinitely scalable.}
719 }
720
721 \chapter{Analysis}
722
723 \section{Analysis of alignments}
724 Jalview provides support for sequence analysis in two ways. A number of analytical methods are 'built-in' and run inside Jalview itself and are mostly accessed from the {\sl Calculate} alignment window menu. Other, more computationally intensive analyses,  are run outside Jalview via web services, typically accessed via the {\sl Web Services}. It is anticipated that Jalview will extend further the range of Web Services based analyses.
725
726 This section describes the built in analyses. Web Services are described in a subsequent section.
727  
728 \subsection{PCA}
729 This calculation creates a spatial representation of the similarities within the current selection or the whole alignment if no selection has been made. After the calculation finishes, a 3D viewer displays the each sequence as a point in 3D 'similarity space'. Sets of similar sequences tend to lie near each other in this space.
730 Note: The calculation is computationally expensive, and may fail for very large sets of sequences - usually because the JVM has run out of memory. A future release of Jalview will be able to avoid this by executing the calculation via a web service.
731 \subsubsection{What is PCA?}
732
733 Principal components analysis is a technique for examining the structure of complex data sets. The components are a set of dimensions formed from the measured values in the data set, and the principle component is the one with the greatest magnitude, or length. The sets of measurements that differ the most should lie at either end of this principle axis, and the other axes correspond to less extreme patterns of variation in the data set.
734 In this case, the components are generated by an eigenvector decomposition of the matrix formed from the sum of BLOSUM scores at each aligned position between each pair of sequences. The basic method is described in the 1995 paper by {\sl G. Casari, C. Sander} and {\sl A. Valencia} \footnote{{\sl Nature Structural  Biology} (1995) {\bf 2}, 171-8. \rPMID: 7749921} and implemented at the SeqSpace server at the EBI.
735
736 \subsubsection{The PCA Viewer}
737
738 PCA analysis can be launched from the {\sl Calculate $\Rightarrow$ Principle Component Analysis} menu option. PCA requires a selection containing at least 4 sequences.  A window opens containing the PCA tool (Figure \ref{PCA}). Each sequence is represented by a square, coloured by the background colour of the sequence ID label. The axes can be rotated by clicking and dragging the left mouse button and zoomed using the $\uparrow$ and $\downarrow$ keys or the scroll wheel of the mouse (if available).  A tool tip appears if the cursor is placed over a sequence. Sequences can be selected by clicking on them. [CTRL]-Click can be used to select multiple sequences. 
739 \begin{figure}[hbtp]
740 \begin{center}
741 \includegraphics[width=2in]{images/PCA1.pdf}
742 \includegraphics[width=3in]{images/PCA3.pdf}
743 \caption{{\bf PCA Analysis} }
744 \label{PCA}
745 \end{center}
746 \end{figure}
747 Labels will be shown for each sequence by toggling the {\sl View $\Rightarrow$ Show Labels} menu option, and the plot background colour changed via the {\sl View $\Rightarrow$ Background Colour..} dialog box. A graphical representation of the PCA plot can be exported as an EPS or PNG image via the {\sl File $\Rightarrow$ Save As $\Rightarrow$ \ldots } submenu.
748
749 \exercise{Principle Component Analysis}{
750 \exstep{Load the alignment at \textsf{http://www.jalview.org/examples/exampleFile.jar} and select {\sl Edit $\Rightarrow$ Undefine Groups}.
751
752 \exstep{Select the menu option {\sl Calculate $\Rightarrow$ Principle Component Analysis}. A new window will open. Move this window so that the tree, alignment and PCA viewer window are all visible. Try rotating the plot by clicking and dragging the mouse on the plot in the PCA window. Note that clicking on points in the plot will highlight them on the alignment and tree.
753 }
754 \exstep{
755 Click on the tree window. Careful selection of mouse location will divide the alignment into a number of groups, each of a different colour. Note how the colour of the sequence id label matches the colour in the PCA plot.
756 }
757 }
758
759
760 \subsection{Trees}
761 Jalview can calculate and display trees, providing interactive tree-based grouping of sequences though a tree viewer. All trees are calculated via the {\sl Calculate $\Rightarrow$ Calculate Tree $\Rightarrow$ \ldots} submenu. Trees can be calculated from distance matrices determined from \% identity or aggregate BLOSUM 62 score  and reconstructed with either average distance (UPGMA) or Neighbour joining algorithms. The sequence alignment from which a tree is calculated  is the current selection, or the whole alignment if no selection is present.
762
763 On calculating a tree, a new window opens (Figure \ref{trees1}) which contains the tree. Various display options can be found in the tree window {\sl View} menu, and export options in the {\sl File $\Rightarrow$ Save As} submenu. Newick format is a standard file format for trees which allows them to be exported to other programs.  Jalview can also read in external trees in Newick format via the {\sl File $\Rightarrow$ Load Associated Tree} menu option. The sequence ID's have to match between the alignment and the loaded tree. Nodes for which no sequence is found in the alignment are ignored.
764
765
766 \begin{figure}
767 \begin{center}
768 \includegraphics[width=2.5in]{images/trees1.pdf}
769 \includegraphics[width=2.5in]{images/trees2.pdf}
770 \includegraphics[width=1.25in]{images/trees4.pdf}
771 \caption{{\bf Calculating Trees} Jalview provides four built in models for calculating trees. Jalview can also load precalculated trees in Newick format (right).}
772 \label{trees1}
773 \end{center}
774 \end{figure}
775
776
777 Clicking on the tree brings up a cursor across the height of the tree. The sequences are automatically partitioned and coloured (Figure \ref{trees2}). To group them together, select the {\sl Calculate $\Rightarrow$ Sort $\Rightarrow$ By Tree Order} alignment window menu option and the correct tree. The sequences will then be sorted to group them together. The coloured background to the sequence IDs can be removed with {\sl Select $\Rightarrow$ Undefine Groups}  from the alignment window menu.
778
779 \begin{figure}
780 \begin{center}
781 \includegraphics[width=5in]{images/trees3.pdf}
782 \caption{{\bf Interactive Trees} The tree level cutoff can be used to designate groups in Jalview}
783 \label{trees2}
784 \end{center}
785 \end{figure}
786
787 \subsubsection{Other Calculations}
788
789 On loading a sequence alignment, Jalview calculates alignment quality, conservation and consensus as alignment annotations. Conservation is calculated according to Livingstone and Barton\footnote{{\sl "Protein Sequence Alignments: A Strategy for the Hierarchical Analysis of Residue Conservation." } Livingstone C.D. and Barton G.J. (1993) {\sl CABIOS } {\bf 9}, 745-756}. Consensus is the modal residue (or {\tt +} where there is an equal top residue). The inclusion of gaps in the consensus calculation can be toggled by right-clicking on the the Consensus label and selecting {\sl Ignore Gaps in Consensus} from the context menu. Quality is a measure of the inverse likelihood of unfavourable mutations in the alignment. Further details on these calculations can be found in the on-line documentation.
790
791 These annotations can be hidden and deleted but are only created on loading an alignment. If they are deleted then the alignment should be saved and reloaded to restore them. Jalview provides a toggle to autocalculate a consensus sequence upon editing. This is normally left selected but for large alignments can be turned off via the {\sl Calculate $\Rightarrow$ Autocalculate Consensus} menu option if the interface is too sluggish.
792
793 Jalview can calculate optimal pairwise alignments between  arbitrary sequences via the {\sl Calculate $\Rightarrow$ Pairwise Alignments\ldots} menu option. Global alignments of all pairwise combinations of the selected sequences are performed and the results returned in a text box.
794
795 \begin{figure}[htbp]
796 \begin{center}
797 \includegraphics[width=4in]{images/pairwise.pdf}
798 \caption{{\bf Pairwise alignment of sequences.} Pairwise alignments of three selected sequences are shown in a textbox.}
799 \label{pairwise}
800 \end{center}
801 \end{figure}
802
803 \exercise{Trees}{
804 \exstep{ Open the alignment at \textsf{http://www.jalview.org/tutorial/alignment.fa}. Select {\sl Calculate $\Rightarrow$ Calculate Tree $\Rightarrow$ Neighbour Joining Using BLOSUM62}. A new tree window will appear.}
805 \exstep{Click on the tree window. A cursor will appear. Note that placing this cursor divides the tree into a number of groups by colour. Place the cursor to give about 4 groups, then select {\sl Calculate $\Rightarrow$ Sort $\Rightarrow$ By Tree Order $\Rightarrow$ Neighbour Joining Tree using BLOSUM62 from ... }. The sequences are reordered to match the order in the tree and groups are formed implicitly.}
806 \exstep{Select {\sl Calculate $\Rightarrow$ Calculate Tree $\Rightarrow$ Neighbour Joining Using \% Identity}. A new tree window will appear. The group colouring makes it easy to see the diferences between the two trees, calculated using different methods.}
807 \exstep{Select from sequence 2 column 60 to sequence 12 column 123. Select  {\sl Calculate $\Rightarrow$ Calculate Tree $\Rightarrow$ Neighbour Joining Using BLOSUM62}. A new tree window will appear. It can be seen that the tree contains 11 sequences. It has been coloured according to the already selected groups from the first tree and is calculated purely from the residues in the selection. 
808 Comparing the location of individual sequences between the two trees illustrates teh importance of selecting appropriate  resides for calculation of trees. 
809 }
810 }
811
812 \section{Web Services}
813 Web services are a technology which allows the Jalview application to offload compute intensive tasks to remote servers via the internet. Jalview will construct a job, ask the remote server to run the job, monitor status of the job and, finally, retrieve the results of the job and display them. The Jalview user is kept informed of the progress of the job through a status window.
814
815 It is essential that you have a continuous network connection in order to successfully use Web Services from Jalview.
816
817 \subsection{Realignment}
818
819 Proteins can be realigned using any of three algorithms: ClustalW\footnote{{\sl "CLUSTAL W: improving the sensitivity of progressive multiple sequence alignment through sequence weighting, position specific gap penalties and weight matrix choice."} Thompson JD, Higgins DG, Gibson TJ (1994) {\sl  Nucleic Acids Research} {\bf 22}, 4673-80}, Muscle\footnote{{\sl "MUSCLE: a multiple sequence alignment method with reduced time and space complexity"} Edgar, R.C. (2004) {\sl BMC Bioinformatics} {\bf 5}, 113}  or MAFFT\footnote{{\sl "MAFFT: a novel method for rapid multiple sequence alignment based on fast Fourier transform"}  Katoh, K., Misawa, K., Kuma, K. and Miyata, T. (2002) {\sl  Nucleic Acids Research} {\bf 30}, 3059Ð3066.  and {\sl "MAFFT version 5: improvement in accuracy of multiple sequence alignment"} Katoh, K., Kuma, K., Toh, H. and Miyata, T. (2005) {\sl Nucleic Acids Research} {\bf 33}, 511Ð518.} Of these, ClustalW is the slowest but is historically widely used. Muscle is fast and probably the most accurate for smaller alignments and MAFFT is probably the best for large alignments. 
820
821 To run an alignment web service, select the appropriate method from the {\sl Web Service $\Rightarrow$  Alignment $\Rightarrow$ \ldots} submenu (Figure \ref{webservices}). A progress window will appear giving information about the job and any errors that occur. After successful completion of the job, a new window is opened with the results, in this case an alignment.
822
823 \begin{figure}[htbp]
824 \begin{center}
825 \parbox[c]{1.5in}{\includegraphics[width=1.5in]{images/ws1.pdf}}
826 \parbox[c]{2.5in}{\includegraphics[width=2.5in]{images/ws2.pdf}}
827 \parbox[c]{2in}{\includegraphics[width=2in]{images/ws3.pdf}}
828 \caption{{\bf Multiple alignment via web services} The appropriate method is selected from the menu (left), a status box appears (center), and the results appear in a new window (right)}
829 \label{webservices}
830 \end{center}
831 \end{figure}
832
833 \exercise{Multiple Sequence Alignment}{
834 \exstep{ Close all windows and open the alignment at {\sf http://www.jalview.org/tutorial/unaligned.fa}.  Select {\sl Web Service $\Rightarrow$ Alignment $\Rightarrow$ Muscle Multiple Protein Sequence Alignment}. A window will open giving the job status. After a short time, a second window will open with the results of the alignment.}
835 \exstep{Select the first sequence set by clicking on the window and try running ClustalW and MAFFT (from the {\sl Web Services $\Rightarrow$ Alignment} menu) on the same initial alignment. Compare them and you should notice small differences.
836 }
837
838
839
840 }
841 \r
842 \subsection{Secondary Structure Prediction}
843
844 Secondary structure prediction is performed using the Jpred\footnote{{\sl "Jpred: A Consensus Secondary Structure Prediction Server"} Cuff, J. A., Clamp, M. E., Siddiqui, A. S., Finlay, M. and Barton, G. J. (1998) {\sl Bioinformatics} {\bf 14}, 892-893} server at the University of Dundee\footnote{http://www.compbio.dundee.ac.uk/~www-jpred/}. The behaviour of this calculation depends on the current selection: 
845 \begin{list}{$\circ$}{}
846 \item If nothing is selected, and the displayed sequences appear to be aligned, then a JNet prediction will be run for the first sequence in the alignment, using the current alignment. Otherwise the first sequence will be submitted for prediction. 
847 \item If just one sequence (or a region on one sequence) has been selected, it will be submitted to the automatic JNet prediction server for homolog detection and prediction. 
848 \item If a set of sequences are selected, and they appear to be aligned, then the alignment will be used for a Jnet prediction on the first sequence in the set (that is, the one that appears first in the alignment window).
849 \end{list}
850
851 Jpred is launched in the same way as the other web services. Select {\sl Web Services $\Rightarrow$ Secondary Structure Prediction $\Rightarrow$ JNet Secondary Structure Prediction} from the alignment window menu (figure \ref{jpred}). A status window opens to inform you of the progress of the job. Upon completion, a new alignment window opens and the Jpred predictions are included as annotations. Consult the Jpred documentation for information on interpreting these results.
852
853 \begin{figure}[htbp]
854 \begin{center}
855 \includegraphics[width=2.25in]{images/jpred1.pdf}
856 \includegraphics[width=3in]{images/jpred2.pdf}
857 \caption{{\bf Secondary Structure Prediction} Status (left) and results (right) windows for JNet predictions. }
858 \label{jpred}
859 \end{center}
860 \end{figure}
861
862 \exercise{Secondary Structure Prediction}{
863 \exstep{ Open the alignment at \textsf{http://www.jalview.org/tutorial/alignment.fa}. Select the sequence {\sl FER\_MESCR} by clicking on the sequence ID. Then select {\sl Web Services $\Rightarrow$ Secondary Structure Prediction $\Rightarrow$ JNet Secondary Structure Prediction} from the alignment window menu. A status window will appear and after some time a new window with the JPred prediction will appear. Note that the number of sequences in the results window is many more than in the original alignment as JNet performs a PSI-BLAST search to expand the prediction dataset.
864 }
865 \exstep{
866 Select a different sequence and perform a JNet prediction in the same way. There will probably be minor differences in the predictions.
867 }
868 }
869
870
871 \section{Features and Annotation}
872 \label{featannot}
873 Features and annotations are additional information that is overlaid on the sequences and the alignment. Annotations are properties of the alignment as a whole -  as the alignment changes,  the annotations will change along with it. Features are properties of the individual sequences. They do not change with the alignment. Annotations are associated with  columns in the alignment. Features are associated with specific residues in the sequence.
874
875 \subsection{Creating sequence features}
876 Sequence features can be created by simply selecting the area in a sequence (or sequences) to form the feature and selecting {\sl Selection $\Rightarrow$ Create Sequence Feature } from the right-click context menu (Figure \ref{features}). A dialogue box allows the user to customise the feature with respect to name, group, and colour. The feature is then associated with the sequence. Moving the mouse over a residue associated with a feature brings up a tool tip listing all features associated with the residue.
877
878 \begin{figure}[htbp]
879 \begin{center}
880 \includegraphics[width=2in]{images/feature1.pdf}
881 \includegraphics[width=2.5in]{images/feature2.pdf}
882 \includegraphics[width=1.5in]{images/feature3.pdf}
883 \caption{{\bf Creating sequence features.} Features can readily be created from selections via the context menu and are then displayed on the sequence. }
884 \label{features}
885 \end{center}
886 \end{figure}
887
888 Creation of features from a selection spanning multiple sequences results in the creation of one feature per sequence. Each feature remains associated with it's own sequence.
889
890 \subsection{Customising feature display}
891
892 Feature display can be toggled on or off by selecting the {\sl View $\Rightarrow$ Show Sequence Features} menu option. When multiple features are present it can be necessary to customise the display. Jalview allows the display, colour, rendering order and transparency of features to be modified via the {\sl View $\Rightarrow$ Feature Settings\ldots} menu option. This brings up a dialogue window (Figure \ref{custfeat}) which allows the visibility of individual feature types to be selected, colours changed (by clicking on the colour of each sequence feature type) and the rendering order modified by dragging feature types to a new position in the list. Dragging the slider alters the transparency of the feature rendering.
893
894 \begin{figure}[htbp]
895 \begin{center}
896 \includegraphics[width=4in]{images/features4.pdf}
897 \caption{{\bf Multiple sequence features.} An alignment with many sequence features overlaid }
898 \end{center}
899 \end{figure}
900
901 \begin{figure}[htbp]
902 \begin{center}
903 \includegraphics[width=4in]{images/features5.pdf}
904 \caption{{\bf Customising sequence features.} Features can be recoloured, switched on or off and have the rendering order changed. }
905 \label{custfeat}
906 \end{center}
907 \end{figure}
908
909 \exercise{Creating features}{
910 \exstep{Open the alignment at \textsf{http://www.jalview.org/tutorial/alignment.fa}. We know that the Cysteine residues at columns 97, 102, 105 and 135 are involved in iron binding so we will create them as features. Navigate to column 97, sequence 1. Select the entire column by clicking in the ruler bar. Then right-click on the selection to bring up the context menu and select {\sl Selection $\Rightarrow$ Create Sequence Feature}. A dialogue box will appear.
911 }
912 \exstep{
913 Enter a suitable Sequence Feature Name  (e.g. "Iron binding site") in the appropriate box. Click on teh Feature Colour bar to change the colour if desired, add a short description ("One of four Iron binding Cysteines") and press OK. The features will then appear on the sequences.
914 }
915 \exstep{Roll the mouse cursor over the new features. Note that the position given in the tool tip is the residue number, not the column number.  To demonstrate that there is one feature per sequence, clear all selections by pressing [ESC] then insert a gap in sequence 3 at position 95. Roll the mouse over the features and you will see that the feature has moved with the sequence. Delete the gap you created.
916 }
917 \exstep{
918 Add a similar feature to column 102. When the feature dialogue box appears, clicking the Sequence Feature Name box brings up a list of previously described features. Using the same Sequence Feature Name allows the features to be grouped.}
919 \exstep{Select {\sl View $\Rightarrow$ Feature Settings\ldots} from the alignment window menu. The Sequence Feature Settings window will appear. Move this so that you can see the features you have just created. Click the check box for "Iron binding site"  under {\sl Display} and note that display of this feature type is turned off. Click it again and note that the features are now displayed. Close the sequence feature settings box by clicking {\sl OK} or {\sl Cancel}.}
920 }
921
922 \subsection{Creating user defined annotation}
923
924 Annotations are properties that apply to the alignment as a whole and are visualised on rows in the annotation panel.
925 To create a new annotation row, right click on the annotation label panel and select the {\sl Add New Row} menu option (Figure \ref{newannotrow}). A dialogue box appears. Enter the label to use for this row and a new row will appear.
926
927 \begin{figure}[htbp]
928 \begin{center}
929 \includegraphics[width=1.3in]{images/annots1.pdf}
930 \includegraphics[width=2in]{images/annots2.pdf}
931 \caption{{\bf Creating a new annotation row.} Annotation rows can be reordered by dragging them to the desired place.}
932 \label{newannotrow}
933 \end{center}
934 \end{figure}
935
936 To create a new annotation, first select all the positions to be annotated on the appropriate row. Right-clicking on this selection brings up the context menu which allows the insertion of graphics for secondary structure ({\sl Helix} or {\sl Sheet}), text {\sl Label} and the colour in which to present the annotation (Figure \ref{newannot}). On selecting {\sl Label} a dialogue box will appear, requesting the text to place at that position. After the text is entered, the selection can be removed and the annotation becomes clearly visible\footnote{When annotating a block of positions, the text can be partly obscured by the selection highlight. Pressing the  [ESC] key clears the selection and the label is then visible.}. Annotations can be coloured or deleted as desired.
937
938 \begin{figure}[htbp]
939 \begin{center}
940 \includegraphics[width=2in]{images/annots3.pdf}
941 \includegraphics[width=2in]{images/annots4.pdf}
942 \includegraphics[width=2in]{images/annots5.pdf}
943 \caption{{\bf Creating a new annotation.} Annotations are created from a selection on the annotation row and can be coloured as desired.}
944 \label{newannot}
945 \end{center}
946 \end{figure}
947
948 \exercise{Annotating alignments}{
949 \exstep{Load the alignment at \textsf{http://www.jalview.org/tutorial/alignment.fa}. Right-click on the annotation label for {\sl Conservation} to bring up the context menu and select {\sl Add New Row}. A dialogue box will appear asking for  {\sl Label for annotation}. Enter "Iron binding site" and click {\sl OK}. A new, empty, row appears.
950 }
951 \exstep{
952 Navigate to column 97. Select column 97 on the new annotation row. Right click on the selection and select {\sl Label} from the context menu. Enter "Fe" in the box and click {\sl OK}. Right-click on the selection again and select {\sl Colour}. Choose a colour from the colour chooser dialogue and click {\sl OK}. Press [ESC] to remove the selection.
953 }
954 \exstep{ Select columns 70-77 on the annotation row. Right-click and choose {\sl Sheet} from the context menu. You will be prompted for a label. Enter "B" and press OK. A new line showing the sheet as an arrow appears. The colour of the label can be changed but not the colour of the sheet arrow. 
955 }
956 }
957  
958 \subsection{Importing features from databases}
959
960 Jalview supports feature retrieval from public databases exported via the Distributed Annotation System\footnote{http://www.biodas.org/}. To retrieve features, select {\sl View $\Rightarrow$ Feature Settings\ldots} from the alignment window menu. Select the {\sl DAS Settings} tab in the Feature Settings Window (Figure \ref{das}). A list of DAS sources compiled from the major public DAS registry\footnote{} is shown in the left hand pane. Highlighting an entry on the left brings up information about that source in the right hand panel.
961
962 \begin{figure}[htbp]
963 \begin{center}
964 \includegraphics[width=2.5in]{images/das1.pdf}
965 \includegraphics[width=2.5in]{images/das2.pdf}
966 \caption{{\bf Retrieving DAS annotations.} DAS featrues are retrieved using the {\sl DAS Settings} tab (left) and display customised using the {\sl Feature Settings} tab (right).}
967 \label{das}
968 \end{center}
969 \end{figure}
970
971
972
973 Select appropriate DAS sources as required then click on {\sl Fetch DAS Features}. This can take some time if a large number of sources is selected and if the alignment contains a large number of sequences.  The retrieved features are shown on the sequence and can be customised as described previously.
974
975 Following DAS feature retrieval, the {\sl Feature Settings} panel takes on a slightly different appearance (Figure \ref{das} (right)). Each data source is listed and groups of features from one data source ccan be selected/deselected by checking the labeled box at the top of the panel.
976
977 \exercise{Retrieving features with DAS}{
978 \exstep{Load the alignment at \textsf{http://www.jalview.org/tutorial/alignment.fa}.  Select {\sl View $\Rightarrow$ Sequence Features\ldots} from the alignment window menu. Select the {\sl DAS Settings} tab. A long list of available DAS sources is listed. Select a small number, eg Uniprot, DSSP, signalP and netoglyc. Click {\sl OK}. A window may prompt whether you wish Jalview to map the sequence IDs onto Uniprot IDs. Click {\sl Yes}. Jalview will start retrieving features. As features become available they will be mapped onto the alignment.
979 }
980 \exstep{If Jalview is taking too long to retrieve features, the process can be cancelled with the {\sl Cancel Fetch} button. Rolling the mouse cursor over the sequences reveals a large number of features annotated in the tool tip. Close the Feature Settings window.
981 }
982 \exstep{
983 Select {\sl View $\Rightarrow$ Feature Settings\ldots} to reopen the Feature Settings window. All the loaded feature types should now be displayed. Those at the top of the list sit on top of and obscure those below. Move the feature settings window so that the alignment is visible and uncheck some of the feature types by clicking the tick box in the display column.. Observe how the alignment display changes. Note that unselected feature types do not appear in the tool tip.
984 }
985 \exstep{Reorder the features by dragging feature types up and down the order in the Feature Settings panel. e.g. Click on {\sl CHAIN} then move the mouse downwards to drag it below {\sl DOMAIN}. Note that {\sl DOMAIN} is now shown on top of {\sl CHAIN} in the alignment window. Drag {\sl METAL} to the top of the list. Observe how the cysteine residues are now highlighted as they have a {\sl METAL} feature associated with them.
986 }
987
988 }
989 \section{Working with structures}
990 Jalview provides integration between protein sequences and protein structures by providing a simple structure viewer. Structures are visualised as an alpha carbon trace and can be viewed, rotated and coloured in a structure viewer and the results interpreted on a sequence alignment.
991
992 \subsection{Automatic association of PDB structures with sequences}
993 Jalview can automatically determine which structures are associated with a sequence, if that sequence has an ID from a public database such as Uniprot. Right-click on any sequence ID and select {\sl $<$Sequence ID$>$ $\Rightarrow$ Associate Structure with Sequence $\Rightarrow$ Discover PDB IDs } from the context menu (where {\sl $<$Sequence ID$>$} is the ID of the sequence on which you clicked) (Figure \ref{auto}). Jalview will attempt to associate the sequence with a Uniprot sequence and from there discover any associated PDB structures. This takes a few seconds and applies to all sequences in the alignment which have valid Uniprot IDs. On moving the cursor over the sequence ID the tool tip now shows the Uniprot ID and any associated PDB structures. 
994
995 \begin{figure}[htbp]
996 \begin{center}
997 \includegraphics[width=1.5in]{images/auto1.pdf}
998 \includegraphics[width=3in]{images/auto2.pdf}
999 \includegraphics[width=1.5in]{images/auto3.pdf}
1000 \caption{{\bf Automatic PDB ID discovery.} The tooltip (left) indicates that no PDB structure has been associated with the sequence. After PDB ID discovery (center) the tool tip now indicates the Uniprot ID and any associated PDB structures (right)}
1001 \label{auto}
1002 \end{center}
1003 \end{figure}
1004
1005 \subsection{Viewing Protein Structures}
1006 The structure viewer can be launched through the sequence ID context menu. Select {\sl $<$Sequence ID$>$ $\Rightarrow$ View PDB entry: $<$PDB ID$>$}. A viewer window will open with the alpha carbon chain(s) of the structure shown (Figure \ref{structure}). The structure can be rotated by clicking and dragging in the structure window. The structure can be zoomed using the mouse scroll wheel (if available).  
1007
1008 Moving the mouse cursor over the sequence to which the structure is linked in the alignment panel highlights the respective residue and shows a label on the structure (Figure \ref{structure} (right)).
1009
1010 \begin{figure}[htbp]
1011 \begin{center}
1012 \includegraphics[width=2.5in]{images/structure1.pdf}
1013 \includegraphics[width=2.5in]{images/structure2.pdf}
1014 \caption{{\bf Structure visualisation} The structure viewer is launched from the sequence ID context menu (left) and allows the structure to be visualised as a rotatable and zoomable alpha carbon trace (right). }
1015 \label{structure}
1016 \end{center}
1017 \end{figure}
1018
1019 \subsubsection{Customisng structure display}
1020 Structure display can be modified using the {\sl Colour} and {\sl View} menus in the structure viewer. The background colour can be modified by selecting the {\sl Colours $\Rightarrow$ Background Colour\ldots} option and display parameters such as depth cueing and Z-buffering by selecting the appropriate option from the {\sl View} menu.
1021
1022 The structure can be coloured independently of the sequence by selecting an appropriate colour scheme from the {\sl Colours} menu. It can be coloured according to the alignment using the {\sl Colours $\Rightarrow$ By Sequence } option. The image in the structure viewer can be output to EPS or PNG format via the {\sl File $\Rightarrow$ Save As $\Rightarrow$ \ldots} submenu. The mapping between the structure and the sequence (How well and which parts of the  structure relate to the sequence) can be viewed with the {\sl File $\Rightarrow$ View Mapping} menu option.  
1023
1024 \exercise{Viewing Structures}{
1025 \exstep{Load the alignment at \textsf{http://www.jalview.org/examples/exampleFile.jar}. Right-click on the sequence ID label for any of the sequences (e.g. {\sl FER1\_SPIOL}) to bring up the context menu. Select {\sl FER1\_SPIOL $\Rightarrow$ Associate Structure with Sequence $\Rightarrow$ Discover PDB ids}. Jalview will now attempt to find PDB structures for the sequences in the alignment.
1026 }
1027 \exstep{
1028 Right-click on the sequence id for {\sl FER1\_SPIOL}. Select { \sl FER1\_SPIOL $\Rightarrow$ View PDB Entry: 1A70} A structure viewing window appears. Rotate the molecule by clicking and dragging in the structure viewing box. Zoom with the mouse scroll wheel.
1029 }
1030 \exstep{Roll the mouse cursor along the {\sl FER1\_SPIOL} sequence in the alignment. Note that if a residue in the sequence maps to one in the structure, a label will appear next to that residue in the structure viewer. Move the mouse over the structure. Placing the mouse over the alpha carbon will bring up a tool tip indicating the name and number of that residue. The corresponding residue in the sequence is highlighted in black. Clicking the alpha carbon toggles the highlight and residue label on and off. Try this by clicking on a set of three or four adjacent residues so that the labels are persistent, then finding where they are in the sequence.
1031 }
1032 \exstep{Select {\sl Colours $\Rightarrow$ Background Colour\ldots} from the structure viewer menu and choose a suitable colour. Press {\sl OK} to apply this. Select {\sl File $\Rightarrow$ Save As $\Rightarrow$ PNG} and save the image. View this with your web browser.
1033 }
1034 \exstep{Select {\sl File $\Rightarrow$ View Mapping} from the structure viewer menu. A new window opens showing the residue by residue alignment between the sequence and the structure.} 
1035
1036 }
1037
1038 \chapter{Advanced Jalview}
1039 \section{Customising Jalview}
1040 \subsection{Setting preferences}
1041 \section{The Jalview Interface}
1042 \subsection{Multiple views}
1043 \subsection{Keyboard Editing Mode}
1044 \section{Regions}
1045 \subsection{Locked Editing}
1046 \subsection{Alignments including hidden regions}
1047 \subsection{Secondary Structure predictions}
1048 \section{Features and Annotations}
1049
1050 \subsection{Annotation display}
1051 \subsubsection{Altering annotation row height}
1052 \subsection{Annotation files}
1053 \subsection{Feature files}
1054 \subsection{Moving sequence associated annotation}
1055 \subsection{Propagating features}
1056 \section{Structures}
1057 \subsection{Working with Modeller files}
1058 \subsection{Using local PDB files}
1059 \section{Pairwise alignments}
1060 \r \end{document}\r