+\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 a 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: `Seq sort by Density' and `Seq 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] then insert a gap in sequence 3 at column 95.
+Roll the mouse 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}.}
+\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) and {\sl MAFFT}, 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, 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 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}.}
+}
+
+\section{Customising the Parameters used for Alignment}
+
+JABA web services allow you to vary the parameters used when performing a
+bioinformatics analysis. For JABA alignment services, this means you are
+usually able to modify the following types of parameters:
+\begin{list}{$\bullet$}{}
+\item{Amino acid or nucleotide substitution score matrix}
+\item{Gap opening and widening penalties}
+\item{Types of distance metric used to construct guide trees}
+\item{Number of rounds of re-alignment or alignment optimisation}
+\end{list}
+\begin{figure}[htbc]
+\center{
+\includegraphics[width=3in]{images/jvaliwsparamsbox.pdf}
+\caption{{\bf An alignment service's parameter editing dialog box}.}
+\label{jwsparamsdialog} }
+\end{figure}
+
+\subsection{Getting Help on the Parameters for a Service}
+
+Each parameter available for a method usually has a short description, which
+Jalview will display as a tooltip, or as a text pane that can be opened under
+the parameter's controls. In the parameter shown in Figure
+\ref{clustalwparamdetail}, the description was opened by selecting the button on the left hand side. Online help for the
+service can also be accessed, by right clicking the button and selecting a URL
+from the pop-up menu that will open.
+
+\begin{figure}[htbp]
+\begin{center}
+\includegraphics[width=2.5in]{images/clustalwparamdetail.pdf}
+\caption{{\bf ClustalW parameter slider detail}. From the ClustalW {\sl Clustal $\Rightarrow$ Edit settings and run ...} dialog box. }
+\label{clustalwparamdetail}
+\end{center}
+\end{figure}
+
+\subsection{Alignment Presets}
+The different multiple alignment algorithms available from JABA vary greatly in
+the number of adjustable parameters, and it is often difficult to identify what
+are the best values for the sequences that you are trying to align. For these
+reasons, each JABA service may provide one or more presets -- which are
+pre-defined sets of parameters suited for particular types of alignment
+problem. For instance, the Muscle service provides the following presets:
+\begin{list}{$\bullet$}{}
+\item Large alignments (balanced)
+\item Protein alignments (fastest speed)
+\item Nucleotide alignments (fastest speed)
+\end{list}
+
+The presets are displayed in the JABA web services submenu, and can also be
+accessed from the parameter editing dialog box, which is opened by selecting
+the `{\sl Edit settings and run ...}' option from the web services menu. If you have used
+a preset, then it will be mentioned at the beginning of the job status file shown
+in the web service job progress window.
+
+\subsection{User Defined Presets}
+Jalview allows you to create your own presets for a particular service. To do
+this, select the `{\sl Edit settings and run ...}' option for your service,
+which will open a parameter editing dialog box like the one shown in Figure
+\ref{jwsparamsdialog}.
+
+The top row of this dialog allows you to browse the existing presets, and
+when editing a parameter set, allows you to change its nickname. As you
+adjust settings, buttons will appear at the top of the parameters dialog that
+allow you to Revert or Update the currently selected user preset with your changes, Delete the current preset, or Create a new preset, if none exists with the given name. In addition to the parameter set name, you can also provide a short
+description for the parameter set, which will be shown in the tooltip for the
+parameter set's entry in the web services menu.
+
+\subsubsection{Saving Parameter Sets}
+When creating a custom parameter set, you will be asked for a file name to save
+it. The location of the file is recorded in the Jalview user preferences in the
+same way as a custom alignment colourscheme, so when Jalview is launched again,
+it will show your custom preset amongst the options available for running the
+JABA service.
+
+%% TODO - reinstate this exercise about reinstating presets
+%
+% \exercise{Creating and using user defined presets}{\label{createandusepreseex}
+% \exstep{Import the file at
+% \textsf{http://www.jalview.org/tutorial/fdx\_unaligned.fa} into jalview.}
+% \exstep{Use the `{\slDiscover Database Ids}' function to recover the PDB cross
+% references for the sequences.}
+% \exstep{Align the sequences using the default ClustalW parameters.}
+% \exstep{Use the `{\sl Edit and run..}'
+% option to open the ClustalW parameters dialog box, and create a new preset using
+% the following settings:
+% \begin{list}{$\bullet$}{}
+% \item BLOSUM matrix (unchanged)
+% \item Gap Opening and End Gap penalties = 0.05
+% \item Gap Extension and Separation penalties = 0.05
+% \end{list}
+%
+% As you edit the parameters, buttons will appear on the dialog box
+% allowing you revert your changes or save your settings as a new parameter
+% set.
+%
+% Before you save your settings, remeber to give them a meaningful name by editing
+% the text box at the top of the dialog box.
+% }
+% \exstep{Repeat the alignment using your new parameter set by selecting it from
+% the {\sl ClustalW Presets menu}.}
+% \exstep{These sequences have PDB structures associated with them, so it is
+% possible to compare the quality of the alignments.
+%
+% Use the {\sl View all {\bf N}
+% structures} option to calculate the superposition of 1fdn on 1fxd for both
+% alignments (refer to section \ref{superposestructs} for instructions). Which
+% alignment gives the best RMSD ? }
+% \exstep{Apply the same alignment parameter settings to the example alignment
+% (available from \textsf{http://www.jalview.org/examples/uniref50.fa}).
+%
+% Are there differences ? If not, why not ?
+% }
+% }
+
+\section{Protein Alignment Conservation Analysis}
+\label{aacons}
+The {\sl Web Service $\Rightarrow$ Conservation} menu controls the computation
+of up to 17 different amino acid conservation measures for the current alignment
+view. The JABAWS AACon Alignment Conservation Calculation Service, which is used
+to calculate these scores, provides a variety of standard measures described by
+Valdar in 2002\footnote{Scoring residue conservation. Valdar (2002) {\sl
+Proteins: Structure, Function, and Genetics} {\bf 43} 227-241.} as well as an efficient implementation of the SMERFs
+score developed by Manning et al. in 2008.\footnote{SMERFS Score Manning et al. {\sl BMC
+Bioinformatics} 2008, {\bf 9} 51 \href{http://dx.doi.org/10.1186/1471-2105-9-51}{doi:10.1186/1471-2105-9-51}}
+
+\subsection{Enabling and Disabling AACon Calculations}
+When the AACon Calculation entry in the {\sl Web Service $\Rightarrow$
+Conservation} menu is ticked, AACon calculations will be performed every time
+the alignment is modified. Selecting the menu item will enable or disable
+automatic recalculation.