+\subsubsection{Automatically Discovering a Sequence's Database References}
+Jalview includes a function to automatically verify and update each sequence's
+start and end numbering against any of the sequence databases that the {\sl
+Sequence Fetcher} has access to. This function is accessed from the {\sl
+Web Service $\Rightarrow$ Fetch DB References} sub-menu in the Alignment
+window. This menu allows you to query either the set of {\sl Standard
+Databases}, which includes EMBL, Ensembl, Uniprot, the PDB, or just a specific datasource from one of the submenus.
+When one of the entries from this menu is selected, Jalview will use the ID
+string from each sequence in the alignment or in the currently selected set to
+retrieve records from the external source. Any sequences that are retrieved are
+matched against the local sequence, and if the local sequence is found to be a
+sub-sequence of the retrieved sequence then the local sequence's start/end
+numbering is updated. A new database reference mapping is created, mapping the
+local sequence to the external database, and the local sequence inherits any
+additional annotation retrieved from the database sequence.
+
+The database retrieval process terminates when a valid mapping is found for a
+sequence, or if all database queries failed to retrieve a matching sequence.
+Termination is indicated by the disappearance of the moving progress indicator
+on the alignment window. A dialog box may be shown once it completes which
+lists sequences for which records were found, but the sequence retrieved from
+the database did not exactly contain the sequence given in the alignment (the
+{\sl ``Sequence not 100\% match'' dialog box}).
+
+
+\subsubsection{Rate of Feature Retrieval}
+Feature retrieval can take some time if a large number of sources are selected
+and if the alignment contains a large number of sequences.
+As features are retrieved, they are immediately added to the current alignment view.
+The retrieved features are shown on the sequence and can be customised as described previously.
+
+
+\subsection{Customising Feature Display}
+
+\begin{figure}[htbp]
+\begin{center}
+\includegraphics[width=5in]{images/features5.pdf}
+\caption{{\bf Customising sequence features.} Features can be recoloured, switched on or off and have the rendering order changed. }
+\label{custfeat}
+\end{center}
+\end{figure}
+
+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 is usually necessary to customise the display. Jalview allows the
+display, colour, rendering order and transparency of features to be modified
+{\sl via} the {\sl View $\Rightarrow$ Feature Settings\ldots} menu option. This
+brings up a dialog window (Figure \ref{custfeat}) which allows the
+visibility of individual feature types to be selected, assigned colours to be 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. Clicking in the {\sl Configuration} column
+ opens the {\sl Display Settings} dialog which allows more complex shading schemes
+ and also the creation of filters, and right-clicking opens a context sensitive menu
+ that offers options for selecting and hiding columns or sorting the alignment according the feature's distribution or score attribute.
+These capabilities are described further in sections
+\ref{featureschemes} and \ref{featureordering}.
+
+
+\subsection{Changing how Features are coloured and displayed}
+\label{featureschemes}
+Sometimes, you may need to visualize the differences in information carried by
+sequence features of the same type. This is most often the case when features
+of a particular type are the result of a specific type of database query or calculation.
+Here, they may also carry information within their textual description, or most commonly
+for calculations, a score related to the property being investigated. Features imported
+from genomic databases and Variant Call Format files may also have a number of additional
+attributes. Jalview allow filters and different types of colouring to be applied to allow variations in these attributes to be highlighted.
+In order to create a filter or modify the way a feature type is coloured, select the `Configuration' column for that {\sl Feature Type} in the {\sl Sequence Feature Settings} dialog box.
+
+Instead of shading a feature with an assigned colour according to its type, you can select the `Colour by text'
+option to create feature colours according to the description text associated
+with each feature. This is useful for general feature types - such as
+Uniprot's `DOMAIN' feature - where the actual type of domain is given in the
+feature's description. If other attributes are present you can choose one of them from the drop-down menu.
+
+If Scores or numeric attributes are present, the {\sl Graduated Colour} section of the dialog allows a quantitative
+shading scheme to be defined, with the highest
+scores receiving the `Max' colour, and the lowest scoring features coloured
+with the `Min' colour. Alternately,
+you can define a threshold to exclude low or
+high-scoring features from the alignment display. This is done by choosing your
+desired threshold type (either above or below), using the drop-down menu in the
+dialog box. Then, adjust the slider or enter a value in the text box to set the
+threshold for displaying this type of feature.
+
+When filters and complex colourschemes are applied, the configuration column will show coloured blocks or text to indicate the colouring
+style and any attribute filters.
+
+
+\subsection{Using Features to Re-order the Alignment}
+\label{featureordering}
+The presence of sequence features on certain sequences or in a particular
+region of an alignment can quantitatively identify important trends in
+the aligned sequences. In this case, it is more useful to
+re-order the alignment based on the number of features or their associated scores, rather than simply re-colour the aligned sequences.
+The sequence feature settings
+dialog box provides two buttons: `Sequence sort by Density' and `Sequence sort by
+Score', that allow you to reorder the alignment according to the number of
+sequence features present on each sequence, and also according to any scores
+associated with a feature. Each of these buttons uses the currently displayed
+features to determine the ordering, but
+if you wish to re-order the alignment using a single type of feature, then you can do this from the {\sl Feature Type}'s
+popup menu. Simply right-click the type's style in the Sequence Feature Settings dialog
+box, and select one of the {\sl Sort by Score} and {\sl Sort by Density}
+options to re-order the alignment. Finally, if a specific region is selected,
+then only features found in that region of the alignment will be used to
+create the new alignment ordering.
+% \exercise{Shading and Sorting Alignments using Sequence Features}{
+% \label{shadingorderingfeatsex}
+%
+% This exercise is currently not included in the tutorial because no DAS servers
+% currently exist that yield per-residue features for any Uniprot sequence.
+%
+% \exstep{Re-load the alignment from \ref{dasfeatretrexcercise}.
+% }
+% \exstep{Open the
+% feature settings panel, and, after first clearing the current
+% selection, press the {\em Seq Sort by Density} button a few times.}
+% \exstep{Use the DAS fetcher to retrieve the Kyte and Doolittle Hydrophobicity
+% scores for the protein sequences in the alignment.
+% {\sl Hint: the nickname for the das source is `KD$\_$hydrophobicity'.}}
+% \exstep{Change the feature settings so only the hydrophobicity features are
+% displayed. Mouse over the annotation and also export and examine the GFF and
+% Jalview features file to better understand how the hydrophobicity measurements
+% are recorded.}
+% \exstep{Apply a {\sl Graduated Colour} to the hydrophobicity annotation to
+% reveal the variation in average hydrophobicity across the alignment.}
+% \exstep{Select a range of alignment columns, and use one of the sort by feature buttons to order the alignment according to that region's average
+% hydrophobicity.}
+% \exstep{Save the alignment as a project, for use in exercise
+% \ref{threshgradfeaturesex}.} }
+%
+% \exercise{Shading alignments with combinations of graduated feature
+% colourschemes}{
+% \label{threshgradfeaturesex}
+% \exstep{Reusing the annotated alignment from exercise
+% \ref{shadingorderingfeatsex}, experiment with the colourscheme threshold to
+% highlight the most, or least hydrophobic regions. Note how the {\sl Colour} icon for the {\sl Feature Type} changes when you change the threshold type and press OK.}
+% \exstep{Change the colourscheme so
+% that features at the threshold are always coloured grey, and the most
+% hydrophobic residues are coloured red, regardless of the threshold value
+% ({\em hint - there is a switch on the dialog to do this for you}).}
+% \exstep{Enable the Uniprot {\em chain} annotation in the feature settings
+% display and re-order the features so it is visible under the hydrophobicity
+% annotation.}
+% \exstep{Apply a {\sl Graduated Colour} to the {\em chain}
+% annotation so that it distinguishes the different canonical names associated
+% with the mature polypeptide chains.}
+% \exstep{Export the alignment's sequence features using the Jalview and GFF file formats, to see how the different types of graduated feature
+% colour styles are encoded. }
+% }
+
+
+\subsection{Sequence Feature File Formats}
+
+Jalview supports the widely used GFF tab delimited format\footnote{see
+http://www.sanger.ac.uk/resources/software/gff/spec.html} and its own Jalview
+Features file format for the import of sequence annotation. Features and
+alignment annotation are also extracted from other formats such as Stockholm,
+and AMSA. URL links may also be attached to features. See the online
+documentation for more details of the additional capabilities of the Jalview
+features file.
+
+\exercise{Creating Features}{
+\label{featuresex}
+\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 dialog box will appear.
+}
+\exstep{
+Enter a suitable Sequence Feature Name (e.g. ``Iron binding site") in the
+appropriate box. Click on the Feature Colour bar to change the colour if
+desired, add a short description (``One of four Iron binding Cysteines") and
+press {\sl OK}. The features will then appear on the sequences. }
+ \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]. Select the [SHIFT] key,
+ then insert a gap in sequence 3 at column 95 by moving the mouse.
+Roll the mouse cursor over the features and you will see that the feature has moved
+with the sequence. Delete the gap you created using {\sl Edit
+$\Rightarrow$ Undo}.
+}
+\exstep{
+Add a similar feature to column 102. When the feature dialog 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.}
+\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 now 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}.}
+
+\exstep{Select {\sl View $\Rightarrow$ Show Sequence Features} from the
+alignment window menu. The sequence features are now hidden. Repeat this step and the features are
+displayed.}
+
+\bf See the video at:
+\url{http://www.jalview.org/training/Training-Videos}.}
+
+\chapter{Multiple Sequence Alignment}
+\label{msaservices}
+Sequences can be aligned using a range of algorithms provided by JABA web
+services, including 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}, 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.},
+ProbCons,\footnote{PROBCONS: Probabilistic Consistency-based Multiple Sequence
+Alignment.
+Do, C.B., Mahabhashyam, M.S.P., Brudno, M., and Batzoglou, S.
+(2005) {\sl Genome Research} {\bf 15} 330-340.} T-COFFEE\footnote{T-Coffee:
+A novel method for multiple sequence alignments. (2000) Notredame, Higgins and
+Heringa {\sl JMB} {\bf 302} 205-217} and Clustal Omega.\footnote{Fast, scalable
+generation of high-quality protein multiple sequence alignments using Clustal
+Omega. Sievers F, Wilm A, Dineen DG, Gibson TJ, Karplus K, Li W, Lopez R,
+McWilliam H, Remmert M, Soding J, Thompson JD, Higgins DG (2011) {\sl Molecular
+Systems Biology} {\bf 7} 539
+\href{http://dx.doi.org/10.1038/msb.2011.75}{doi:10.1038/msb.2011.75}} Of these,
+T-COFFEE is slow but accurate. ClustalW is historically
+the most widely used. Muscle is fast and probably best for
+smaller alignments. MAFFT is probably the best for large alignments,
+however Clustal Omega, released in 2011, is arguably the fastest and most
+accurate tool for protein multiple alignment.
+
+\section{Performing a multiple sequence alignment}
+To run an alignment web service, select the appropriate method from the {\sl
+Web Service $\Rightarrow$ Alignment $\Rightarrow$ \ldots} submenu (Figure
+\ref{webservices}). For each service you may either perform an alignment with
+default settings, use one of the available presets, or customise the parameters
+with the `{\sl Edit and Run ..}' dialog box. Once the job is submitted, a
+progress window will appear giving information about the job and any errors that
+occur. After successful completion of the job, a new alignment window is opened
+with the results, in this case an alignment. By default, the new alignment will be
+ordered in the same way as the input sequences. Note: many alignment
+programs re-order the input during their analysis and place homologous
+sequences close together, the MSA algorithm ordering can be recovered
+using the `Algorithm ordering' entry within the {\sl Calculate $\Rightarrow$
+Sort } sub menu.
+
+\subsection{Realignment to add sequences to an existing alignment}
+The re-alignment option is currently only supported by Clustal
+Omega and ClustalW. When performing a re-alignment, Jalview submits the
+current selection to the alignment service complete with any existing gaps.
+Realignment with ClustalW is useful when one wishes to align
+additional sequences to an existing alignment without any further optimisation
+to the existing alignment. ClustalO's realignment works by generating a
+probabilistic model (a.k.a HMM) from the original alignment, and then realigns
+{\bf all} sequences to this profile. For a well aligned MSA, this process
+will simply reconstruct the original alignment (with additional sequences), but
+in the case of low quality MSAs, some differences may be introduced.
+
+\begin{figure}[htbp]
+\begin{center}
+\parbox[c]{1.5in}{\includegraphics[width=1.5in]{images/ws1.pdf}}
+\parbox[c]{2.5in}{\includegraphics[width=2.5in]{images/ws2.pdf}}
+\parbox[c]{2in}{\includegraphics[width=2in]{images/ws3.pdf}}
+\caption{{\bf Multiple alignment via web services} The appropriate method is
+selected from the menu (left), a status box appears (centre), and the results
+appear in a new window (right).}
+\label{webservices}
+\end{center}
+\end{figure}
+
+\subsection{Alignments of Sequences that include Hidden Regions}
+If the view or selected region submitted for alignment contains hidden
+regions, then {\bf only the visible sequences will be submitted to the service}.
+Furthermore, each contiguous segment of sequences will be aligned independently
+(resulting in a number of alignment `subjobs' appearing in the status window).
+Finally, the results of each subjob will be concatenated with the hidden regions
+in the input data prior to their display in a new window. This approach ensures
+that 1) hidden column boundaries in the input data are preserved in the
+resulting alignment - in a similar fashion to the constraint that hidden columns
+place on alignment editing (see Section \ref{lockededits} and 2) hidden
+columns can be used to preserve existing parts of an alignment whilst the
+visible parts are locally refined.
+
+\subsection{Alignment Service Limits}
+Multiple alignment is a computationally intensive calculation. Some JABA server
+services and service presets only allow a certain number of sequences to be
+aligned. The precise number will depend on the server that you are using to
+perform the alignment. Should you try to submit more sequences than a service
+can handle, then an error message will be shown informing you of the maximum
+number allowed by the server.
+
+\exercise{Multiple Sequence Alignment}{
+\label{msaex}
+\exstep{ Close all windows. Open the alignment at {\sf
+http://www.jalview.org/tutorial/unaligned.fa}. Select {\sl
+Web Service $\Rightarrow$ Alignment $\Rightarrow$ Muscle with Defaults}.
+A window will open giving the job status. After a short time, a second window will open
+ with the results of the alignment.}
+ \exstep{Return to the first sequence alignment window by clicking on
+ the window, and repeat using {\sl ClustalO} (Omega) ({\sl with Defaults}), from the
+ {\sl Web Service $\Rightarrow$ Alignment} menu, using the same initial
+ alignment.
+ Compare them and you should notice small differences. }
+\exstep{Select the last three sequences in the MAFFT alignment (you may need the scroll down the alignment), and de-align them
+with {\sl Edit $\Rightarrow$ Remove All Gaps}. Press [ESC] to deselect these
+sequences. Then submit this view for re-alignment with {\sl ClustalO}.}
+\exstep{Return to the MAFFT alignment window in section (c), use [CTRL]-Z (undo) to
+recover the alignment of the last three sequences in this MAFFT alignment.
+Once the ClustalO re-alignment has completed, compare the results of
+re-alignment of the three sequences with their alignment in the original MAFFT result.}
+\exstep{Select columns 60 to 125 in the original MAFFT alignment and hide them,
+by right clicking the mouse to bring up context menu.
+Select {\sl Web Service $\Rightarrow$ Alignment $\Rightarrow$ Mafft with Defaults} to
+submit the visible portion of the alignment to MAFFT. When the web service job pane appears,
+note that there are now two alignment job status panes shown in the window.}
+\exstep{When the MAFFT job has finished, compare the alignment of the N-terminal visible
+region in the result with the corresponding region of the original alignment.}
+\exstep {If you wish,
+select and hide a few more columns in the N-terminal region, and submit the alignment to the
+service again and explore the effect of local alignment on the non-homologous parts of the
+N-terminal region.}
+{\bf See the video at:
+\url{http://www.jalview.org/training/Training-Videos}.}