+\exstep{Open the alignment at
+\textsf{http://www.jalview.org/tutorial/alignment.fa}.}
+
+\exstep{Select {\sl Calculate $\Rightarrow$ Tree or PCA..}. in the alignment
+window and a dialogue box opens. In the tree section select Neighbour
+Joining, in the drop-down list select BLOSUM62 and click the Calculate
+button. A tree window will open.}
+
+\exstep{Click on the
+tree window, a cursor will appear as a vertical line. Note that clicking will
+place this cursor, and divides the tree into a number of groups, each highlighted
+with a different colour. Place the cursor to give about 4 groups.}
+
+
+\exstep{In the tree window, select {\sl View $\Rightarrow$ Sort Alignment
+by Tree}. The sequences are reordered to match the order in the tree and groups
+ are formed implicitly. Alternatively in the alignment window, select
+{\sl Calculate $\Rightarrow$ Sort $\Rightarrow$ By Tree Order $\Rightarrow$
+ Neighbour Joining Tree using BLOSUM62 from...}.}
+
+\exstep{Select {\sl Calculate $\Rightarrow$ Tree or PCA..}. in the alignment
+window. In the dialogue box, select Average Distance and in the drop down
+list select BLOSUM62. Click the Calculate button and a new
+tree window will appear. The group colouring makes it easy to see the differences between the two
+trees calculated by the different methods.}
+
+\exstep{In the alignment window, select sequence 2 from
+column 60 to sequence 12 and column 123. Select {\sl Calculate $\Rightarrow$
+Tree or PCA..}. , in the dialogue box select Neighbour Joining and
+BLOSUM62, then click the Calculate button.
+ A tree will appear containing 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.}
+
+Comparing the location of individual sequences between the three trees illustrates the importance of selecting appropriate regions of the
+alignment for the calculation of trees.
+
+{\bf See the video at:
+\url{http://www.jalview.org/training/Training-Videos}.}
+
+}
+
+%\subsubsection{Multiple Views and Input Data recovery from PCA and Tree Viewers}
+% move to ch. 3 ?
+%Both PCA and Tree viewers are linked analysis windows. This means that their selection and display are linked to a particular alignment, and control and reflect the selection state for a particular view.
+
+\subsubsection{Recovering input data for a Tree or PCA Plot Calculation}
+\parbox[c]{5in}{
+The {\sl File $\Rightarrow$ Input Data } option will open a new alignment window containing the original data used to calculate the tree or PCA plot (if available). This function is useful when a tree has been created and then the alignment subsequently changed.
+}
+\parbox[c]{1.25in}{\centerline{\includegraphics[width=1.25in]{images/pca_fmenu.pdf}
+}}
+
+\subsubsection{Changing the associated view for a Tree or PCA Viewer}
+\parbox[c]{4in}{
+The {\sl View $\Rightarrow$ Associated Nodes With $\Rightarrow$ .. } submenu is shown when the viewer is associated with an alignment that is involved in multiple views. Selecting a different view does not affect the tree or PCA data, but will change the colouring and display of selected sequences in the display according to the colouring and selection state of the newly associated view.
+} \parbox[c]{3in}{\centerline{
+\includegraphics[width=2.5in]{images/pca_vmenu.pdf} }}
+
+\subsection{Tree Based Conservation Analysis}
+\label{treeconsanaly}
+
+Trees reflect the pattern of global sequence similarity exhibited by the
+alignment, or region within the alignment, that was used for their calculation.
+The Jalview tree viewer enables sequences to be partitioned into groups based
+on the tree. This is done by clicking within the tree viewer window. Once subdivided, the
+conservation between and within groups can be visually compared in order to
+better understand the pattern of similarity revealed by the tree and the
+variation within the clades partitioned by the grouping. The conservation based
+colourschemes and the group associated conservation and consensus annotation
+(enabled using the alignment window's {\sl Annotations $\Rightarrow$ Autocalculated
+Annotation $\Rightarrow$ Group Conservation} and {\sl Group Consensus} options)
+can help when working with larger alignments.
+
+
+
+
+%\exercise{Pad Gaps in an Alignment}{
+%\exstep{Open the alignment at
+% \textsf{http://www.jalview.org/tutorial/alignment.fa}. In alignment window, ensure that the {\sl Edit $\Rightarrow$ Pad Gaps } option is {\sl not} ticked, and insert one gap anywhere in the
+%alignment.}
+%\exstep{Select {\sl Calculate $\Rightarrow$ Calculate Tree $\Rightarrow$
+%Neighbour Joining Using BLOSUM62}.
+
+%A warning dialog box {\bf ``Sequences not aligned'' } appears because the
+% sequences input to the tree calculation are of different lengths. }
+
+%\exstep{Select {\sl Edit $\Rightarrow$ tick Pad Gaps } and perform the
+%tree calculation again. This time a new tree should appear - because padding
+%gaps ensures all the sequences are the same length after editing.}
+%{\sl Pad Gaps } option
+%can be set in Preferences using
+%{\sl Tool $\Rightarrow$ Preference $\Rightarrow$ Editing}.
+
+%{\bf See the video at:
+%\url{http://www.jalview.org/training/Training-Videos}.}
+%}
+
+ \exercise{Tree Based Conservation Analysis}{
+\label{consanalyexerc}
+\exstep{Load the PF03460 PFAM seed alignment using the sequence fetcher.
+Select {\sl Colour $\Rightarrow$ Taylor $\Rightarrow$ By Conservation}, set
+ {\sl Conservation} shading threshold at around 20. }
+ \exstep{Build a Neighbour joining tree by selecting {\sl Calculate
+ $\Rightarrow$ Tree or PCA..}. in the alignment window. In the dialogue box, select Neighbour
+Joining and in the drop-down
+list select BLOSUM62, then click the Calculate button.}
+\exstep{Use the cursor to select a point on the tree to partition the
+alignment into groups.}
+\exstep {Select {\sl View $\Rightarrow$ Sort Alignment By Tree} option in the
+tree window to re-order the sequences in the alignment.
+Examine the variation in colouring between different groups of sequences in the
+ alignment window. }
+\exstep {You may find it easier to browse the alignment if you first uncheck
+ the {\sl Annotations $\Rightarrow$ Show Annotations} option. Open the
+Overview Window from the View menu to aid navigation.}
+
+\exstep{Try changing the colourscheme of the residues in the alignment to
+BLOSUM62 (whilst ensuring that {\sl Apply Colour to All Groups} is selected).}
+{\sl Note: You may want to save the alignment and tree as a project file, since
+it is used in the next set of exercises. }
+
+{\bf See the video at:
+\url{http://www.jalview.org/training/Training-Videos}.}
+}
+
+
+\subsection{Redundancy Removal}
+
+The redundancy removal dialog box is opened using the {\sl Edit $\Rightarrow$ Remove Redundancy\ldots} option
+in the alignment menu. As its menu option placement suggests, this is actually an alignment editing function,
+but it is convenient to describe it here. The redundancy removal dialog box presents a percentage identity
+slider which sets the redundancy threshold. Aligned sequences which exhibit a percentage identity greater
+than the current threshold are highlighted in black. The [Remove] button can then be used to delete these
+sequences from the alignment as an edit operation.
+\begin{figure}
+\begin{center}
+\includegraphics[width=5.5in]{images/redundancy.pdf}
+\end{center}
+\label{removeredundancydialog}
+\caption{The Redundancy Removal dialog box opened from the edit menu. Sequences that exceed the current percentage identity threshold and are to be removed are highlighted in black.}
+\end{figure}
+
+
+\subsection{Subdividing the Alignment According to Specific Mutations}
+
+It is often necessary to explore variations in an alignment that may correlate
+with mutations observed in a particular region; for example, sites exhibiting
+single nucleotide polymorphism, or residues involved in substrate recognition in
+an enzyme. One way to do this would be to calculate a tree using the specific
+region, and subdivide it in order to partition the alignment.
+However, calculating a tree can be slow for large alignments, and the tree may
+be difficult to partition when complex mutation patterns are being analysed. The
+{\sl Select $\Rightarrow$ Make groups for selection } function was introduced to
+make this kind of analysis easier. When selected, it will use the characters in
+the currently selected region to subdivide the alignment. For example, if a
+single column is selected, then the alignment (or each group defined on the
+alignment) will be divided into groups based on the residue or nucleotide found
+at that position. These new groups are annotated with the characters in the
+selected region, and Jalview's group based conservation analysis annotation and
+colourschemes can then be used to reveal any associated pattern of sequence
+variation across the whole alignment.
+
+
+% These annotations can be hidden and deleted via the context menu linked to the
+% annotation row; but they are only created on loading an alignment. If they are
+% deleted then the alignment should be saved and then reloaded to restore them.
+% Jalview provides a toggle to autocalculate a consensus sequence upon editing.
+% This is normally selected by default, but can be turned off for large alignments {\sl via} the {\sl Calculate $\Rightarrow$ Autocalculate
+% Consensus} menu option if the interface is too slow.
+
+% \subsubsection{Group Associated Annotation}
+% \label{groupassocannotation}
+% Group associated consensus and conservation annotation rows reflect the
+% sequence variation within a particular group. Their calculation is enabled
+% by selecting the {\sl Group Conservation} or {\sl Group Consensus} options in
+% the {\sl Annotation $\Rightarrow$ Autocalculated Annotation } submenu of the
+% alignment window.
+
+% \subsubsection{Alignment and Group Sequence Logos}
+% \label{seqlogos}
+
+% The consensus annotation row that is shown below the alignment can be overlaid
+% with a sequence logo that reflects the symbol distribution at each column of
+% the alignment. Right click on the Consensus annotation row and select the {\sl
+% Show Logo} option to display the Consensus profile for the group or alignment.
+% Sequence logos can be enabled by default for all new alignments {\sl via} the
+% Visual tab in the Jalview desktop's preferences dialog box.
+
+\section{Pairwise Alignments}
+Jalview can calculate optimal pairwise alignments between arbitrary
+sequences {\sl 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.
+
+
+
+\exercise{Remove Redundant Sequences}{
+\label{redundantex}
+\exstep{Using the alignment generated in the previous exercise (exercise
+\ref{consanalyexerc}).
+In the alignment window, you may need to deselect groups using Esc key.}
+
+\exstep{In the {\sl Edit} menu select {\sl Remove Redundancy} to open the
+Redundancy threshold selection dialog. Adjust the redundancy threshold value, start
+at 50 and increase the value to 65. Sequences selected will change colour in the Sequence ID panel. Select ``Remove'' to
+remove the sequences that are more than 65\% similar under this alignment.}
+
+\exstep{From the tree window, select {\sl View $\Rightarrow$
+Mark Unlinked Leaves} option, and note that the removed sequences are now prefixed with a * in the tree view.} \exstep{Use the [Undo] button in the Redundancy threshold selection dialog box
+to recover the sequences. Note that the * symbols disappear from the tree display.}
+\exstep{Experiment with the redundancy removal and observe the relationship between the percentage identity threshold and the pattern of unlinked nodes in the tree display.}
+}
+
+\exercise{Group Conservation Analysis}{
+\label{conservationex}
+\exstep{Re-use or recreate the alignment and tree which you worked with in the
+tree based conservation analysis exercise (exercise \ref{consanalyexerc}).}
+\exstep{In the {\sl View} menu in the alignment window, select {\sl New View} to
+create a new view. Ensure the annotation panel is displayed ({\sl Show annotation} in {\sl Annotations} menu). Enable the
+display of {\sl Group Consensus} option by checking {\sl Group Consensus} in the {\sl Annotation $\Rightarrow$
+Autocalculated Annotation } submenu in the alignment window.}
+\exstep{Displaying the sequence
+logos will make it easier to see the different residue populations within each
+group. Activate the logo by right clicking on the Consensus annotation row to
+open the context menu and select the {\sl Show Logo} option.}
+\exstep{In the column alignment ruler, select a column exhibiting with about 50\%
+ of its residues conserved ({\em ie. about 50\% in the consensus histogram})
+ that lies within the central conserved region of the alignment.
+(Column 74 is used in \href{https://youtu.be/m-PjynicXRg}{the Tree video}).}
+\exstep{Subdivide the alignment
+according to this selection using {\sl Select $\Rightarrow$ Make groups for selection}.}
+\exstep{Re-order the alignment according to the new groups that have been
+defined by selecting {\sl Calculate $\Rightarrow$ Sort $\Rightarrow$
+By Group}.
+
+Click on the group annotation row IDs to select groups exhibiting a
+specific mutation.}
+\exstep{Select another column exhibiting about 50\% conservation
+overall, and subdivide the alignment further. Note that the new groups
+inherit the names of the original groups, allowing you to identify the
+combination of mutations that resulted in the subdivision.}
+\exstep{Clear the groups, and try to subdivide the alignment using two
+non-adjacent columns.
+
+{\sl Hint: You may need to hide the intervening columns before you can select
+both of the columns that you wish to use to subdivide the alignment.}}
+\exstep{Switch back to the original view, and experiment with subdividing
+the tree groups made in the previous exercise.}
+{\bf See the video at:
+\url{http://www.jalview.org/training/Training-Videos}.}
+}
+
+\begin{figure}[]
+\begin{center}
+\includegraphics[width=4in]{images/pairwise.pdf}
+\caption{{\bf Pairwise alignment of sequences.} Pairwise alignments of three selected sequences are shown in a textbox.}
+\label{pairwise}
+\end{center}
+\end{figure}
+
+
+% To review, Chapter \ref{featannot} describes the mechanisms provided by
+% Jalview for interactive creation of sequence and alignment annotation, and how
+% they can be displayed, imported and exported and used to reorder the alignment. Chapter
+% \ref{featuresfromdb} discusses the retrieval of database references and
+% establishment of sequence coordinate systems for the retrieval and display of
+% features from databases and DAS annotation services.
+% Chapter \ref{msaservices} describes how to use the range of multiple alignment
+% programs provided by JABAWS, and Chapter \ref{aacons} introduces JABAWS AACon
+% service for protein multiple alignment conservation analysis.
+% In Chapter \ref{alignanalysis}, you will find
+% descriptions and exercises on building and displaying trees, PCA analysis,
+% alignment redundancy removal, pairwise alignments and alignment conservation
+% analysis.
+% Chapter \ref{wkwithstructure} introduces the structure visualization
+% capabilities of Jalview.
+% Chapter \ref{protsspredservices} explains how to perform protein secondary
+% structure predictions with JPred, and JABAWS protein disorder prediction
+% services are introduced in Chapter \ref{protdisorderpred}.
+% Chapter \ref{workingwithnuc} describes functions and visualization techniques
+% relevant to working with nucleotide sequences, coding region annotation and nucleotide
+% sequence alignments.
+% Chapter \ref{jvwebservices} introduces the various web based services
+% available to Jalview users, and Chapter \ref{jabaservices} explains how to
+% configure the Jalview Desktop for access to new JABAWS servers.
+
+
+% and Section \ref{workingwithrna} covers the visualization,
+% editing and analysis of RNA secondary structure.
+
+\chapter{Working with 3D structures}
+\label{3Dstructure}
+\label{wkwithstructure}
+Jalview facilitates the use of 3D structure data for the analysis of alignments
+by providing a linked view of structures associated with the aligned sequences.
+It also allows sequence, secondary structure and B-factor data to be imported
+from structure files, and supports the use of the EMBL-EBI's SIFTS database to
+construct accurate mappings between UniProt protein sequences and structures
+retrieved from the PDB.
+
+\section{Molecular graphics systems supported by Jalview}
+Jalview can interactively view 3D structure using Jmol, a Java based molecular
+viewing program\footnote{See the Jmol homepage \url{http://www.jmol.org} for
+more information.} integrated with Jalview.\footnote{Earlier
+versions of Jalview included MCView - a simple main chain structure viewer.
+Structures are visualized as an alpha carbon trace and can be viewed, rotated
+and coloured using the sequence alignment.} It also supports the use of UCSF
+Chimera, a powerful molecular graphics system that needs separate installation.
+Jalview can also read PDB and mmCIF format files directly to extract sequences
+and secondary structure information, and retrieve records from the European
+Protein Databank (PDBe) using the Sequence Fetcher (see \ref{fetchseq}).
+
+\subsection{Configuring the default structure viewer}
+\label{configuring3dviewer}
+To configure which viewer is used when creating a new
+structure view, open the Structures preferences window {\sl via} {\sl Tools $\Rightarrow$ Preferences\ldots} and
+select either JMOL or CHIMERA as the default viewer. If you select Chimera,
+Jalview will search for the installed program, and if it cannot be found,
+you will be prompted to locate the Chimera binary, or alternately, open the UCSF
+Chimera download page to obtain the software.
+
+\section{Automatic Association of PDB Structures with Sequences}
+Jalview will attempt to automatically determine which structures are associated
+with a sequence via its ID, and any associated database references. To do this
+for a particular sequence or the current selection, open the Sequence ID popup
+menu and select {\sl View 3D Structure}, to open the 3D Structure Chooser.
+%(Figure\ref{auto}).
+
+When the structure chooser is first opened, if no database identifiers are
+available, Jalview will automatically perform a database reference
+retrieval (See \ref{fetchdbrefs}) to discover identifiers for the
+sequences to use to search the PDB. This can take a
+few seconds for each sequence and will be performed for all selected
+sequences.\footnote{After this is done, you can see the added database
+references in a tool tip by mousing over the sequence ID. You can use the {\sl
+View $\Rightarrow$ Sequence ID Tooltip $\Rightarrow$ Show Db References }
+submenu option to enable or disable these data in the tooltip.}
+
+Once the retrieval has finished, the structure chooser dialog will show any
+available PDB entries for the selected sequences.
+
+%
+% \begin{figure}[htbp]
+% \begin{center}
+% %TODO fix formatting
+% \begin{center}
+% \includegraphics[width=3.5in]{images/pdbstructurechooser.pdf}
+% \end{center}
+%
+%
+% \caption{{\bf The PDB Structure Chooser dialog.} }
+% \label{auto}
+% \end{center}
+% \end{figure}
+
+\subsection{Drag-and-Drop Association of PDB Files with Sequences by Filename
+Match}
+\label{multipdbfileassoc}
+If you have PDB files stored on your computer named the same way as the
+sequences in the alignment, then you can drag them from their location on the
+file browser onto an alignment window. Jalview will search the alignment for
+sequences with IDs that match any of the files, and offer a dialog like the one
+in Figure \ref{multipdbfileassocfig}.
+
+If no associations are made, then sequences extracted
+from the structure will be simply added to the alignment. However, if only
+some of the PDB files are associated, Jalview will raise another dialog box
+giving you the option to add any remaining sequences from the PDB structure files not present in
+the alignment. This allows you to easily decorate sequences in a newly imported
+alignment with any corresponding structures you've already collected in a directory
+accessible from your computer.\footnote{We plan to extend this facility in
+future so Jalview will automatically search for PDB files matching your
+sequence within a local directory. Check out
+\href{http://issues.jalview.org/browse/JAL-801}{Jalview issue 801}}
+
+After associating sequences with PDB files, you can view the PDB structures by
+opening the Sequence ID popup
+menu and selecting {\sl View 3D Structure}. The PDB files you loaded will be
+shown in the {\bf Cached Structures} view, after selecting it from the drop down
+menu in the dialog box.
+
+% there is no mention of the other footnote (#3) that appears saying: Tip: The sequence ID tooltip can often become large for heavily cross-referenced sequence IDs. Use the ...
+% JBP: yes there is - under 'Discovery of ' subsection.