%  doc/coot-shelx.tex
%  
%  Copyright 2008 by the University of Oxford
%  Copyright 2014 by Medical Research Council
%  Author: Paul Emsley
%  
%  This program is free software; you can redistribute it and/or modify
%  it under the terms of the GNU General Public License as published by
%  the Free Software Foundation; either version 3 of the License, or (at
%  your option) any later version.
%  
%  This program is distributed in the hope that it will be useful, but
%  WITHOUT ANY WARRANTY; without even the implied warranty of
%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
%  General Public License for more details.
%  
%  You should have received a copy of the GNU General Public License
%  along with this program; if not, write to the Free Software
%  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
%  02110-1301, USA

% 10pt is the smallest font for article
\documentclass{article}

% \usepackage{graphicx}
\usepackage{epsf}
\usepackage{a4}
\usepackage{palatino}
\usepackage{euler}
\newcommand {\atilde} {$_{\char '176}$} % tilde(~) character

\title{Coot Tutorial II: More Advanced Usage}
%(Part of Protein Crystallography)}

%\author{Your Workshop Here}
%\author{M.Res. Functional Genomics}
%\author{CCP4 Workshop Bangalore}
%\author{CCP4 Workshop}
%\author{CSHL 2006 Workshop}
%\author{Osaka 2006 Workshop}
%\author{EMBO 2007 Workshop}
%\author{CSHL 2008 Workshop}
%\author{CCP4 School APS 2010}
% \author{BCA/CCP4 Summer School Oxford 2010}
\author{CSHL 2014}

\begin{document}
\maketitle
%\tableofcontents
%\listoffigures


%% NOTE: Add "Make 4mer-XYS" to the advanced tutorial.
   


The idea here is to use more advanced\footnote{``less commonly-used''
  might be a better description} tools of Coot.  There will be less
description of low-level widget manipulation in this tutorial - we
presume that you already have experience with that.  You may well trip
over issues not discussed here\footnote{Feel free to shout out if you
  do, several others may have this same problem and we can examine the
  issue together.}.

\section{Preamble}

When automatic building fails, typically because the resolution limit
of your data is too low, then building the molecule ``by hand'' may be
the only way to proceed.  Recognizing the shape of main-chain and
side-chain densities is valuable and this tutorial aims to introduce
these to you.  Note that this tutorial map is an easy map to build
into, the sidechains are (mostly) clear.  If you want a more realistic
``bad'' map, you can apply a resolution limit to the data read in from
the MTZ file\footnote{the resolution limit widget will appear when you
  activate the ``Expert Mode`` button.}.

Using just a map and a sequence, we will attempt to generate a model.
This model can then be validated and refined with Refmac for several
rounds.  With some experience you should be able to get an R-factor of
less than 20\% in less than 30 minutes.


\section{Key Bindings}

If you look at "Paul's Key Bindings"\footnote{Use Bernhard's
  Key-bindings if you are using pythonized or WinCoot} in
the Coot Wiki\footnote{you can find a link to this from the Coot web
  page}, you will see a page of customizations.  One of those
customizations can help you in Baton-Building mode - and that is the
``quoteleft'' key binding.

So, cut the bindings out of the web page, paste them into a file and
then use \textsf{Calculate $\rightarrow$ Run Script\ldots} to evaluate
that file\footnote{``read it in'', you might say}.  To check that your
key-bindings are activated, Use \textsf{Extensions $\rightarrow$ Key
  Bindings\ldots}.

Now, we can use quoteleft (or ``backquote'', "`" is how it might
appear on the keyboard) to accept the baton position - this is much
more convenient than using the ``Accept'' button\footnote{You can do
  that as well, of course, but \emph{clicky-clicky pressy button} is for
Coot noobs, and that's not us, right?}.


\section{At the end of the Chain} 

At some stage\footnote{hopefully residue 96} you will come to a point
where no progress can be made, the only direction takes us into
density we've already built into.  OK, so stop: \textsl{Dismiss}.

Now we need to turn these CA positions into mainchain.
\textsf{Calculate $\rightarrow$ Other Modelling Tools $\rightarrow$ CA
  Zone to Mainchain}.  Use the \textsf{Go To Atom} dialog to centre on the
first residue of ``Baton Atoms'', click it, then centre on the last
residue of ``Baton Atoms'' and click on that.

\textsf{  [Coot thinks for a several seconds while building a mainchain]}

OK, great, we have a mainchain.  Let's tidy it up:

\textsf{Extensions $\rightarrow$ Stepped Refine}.  

Refine the ``mainchain'' molecule, watch it as it goes.  Is it making
mistakes?

That refinement may have gone to quickly to make a note of problem
areas, so use \textsf{Validation $\rightarrow$ Density Fit Analysis}
on the ``mainchain'' molecule and find areas that are marked with
large spikes.

``There are none'' you say?  Good\footnote{If that's not what you say,
  you can use the refinement or other tools that we learned about in
  the first tutorial to improve the fit to density.}. Let's move on.

\section{Assign Sequence}

Let's tell Coot that we have a sequence associated with this set
of CA points.  So, \textsf{Extensions $\rightarrow$ Dock Sequence
  $\rightarrow$ Dock Sequence}. The file to use if \texttt{rnase-A.pir},
 found in the usual place\footnote{Make sure you select the correct 
molecule at the top of the GUI.}.

Turn on auto-fit of residues.

So when the file is assigned ``Sequence closest fragment''.

\textsl{ [Coot thinks for a several seconds while assigning
  sidechains, then goes about mutating and fitting the residues]}

What's that you say?  Coot didn't do that?  Well, that's because you
mainchain model is too bad for Coot to recognize the sidechain
positions.  You need to review you mainchain model and make sure sure
that the CBs are in density and pointing in the right direction.  When
you have improved you model sufficiently well, Coot will apply the
sequence to it using the above method.

Change the Chain ID from `` `` to ``A''.

\section{Cell and Symmetry}

Display Symmetry Atoms:

\textsf{Draw $\rightarrow$ Cell \& Symmetry $\rightarrow$ Master
  Switch: Show Symmetry Atoms $\rightarrow$ Yes} and \textsf{OK}.

By zooming out and eyeballing the density, check for unassigned density.

\textsl{ [Coot displays symmetry-related atoms in grey - by default
  (you may not see many symmetry related atoms, it depends on where in
  the unit cell you are)]}

\section{Skeletonization and Baton Building}


You can calculate the map skeleton in Coot directly:

\textsf{Calculate $\rightarrow$ Map Skeleton\ldots $\rightarrow$ On.}

This can be used to ``baton build'' a map.  You can turn off the
coordinates and try it if you like (the Baton Building window can be
found by clicking \textsf{``Ca Baton Mode\ldots''} in the Other
Modelling Tools dialog.
  
I suggest you use Go To Atom and start residue 2 A. This allows you to
build the complete A chain in the correct direction and you can
directly compare it to the real structure afterward\footnote{if don't
  follow this instruction, you could well build a symmetry related
  molecule, which is perfectly valid, of course, just that the
  comparison versus the correct structure will be more difficult.}.
Once you are at residue 2A, use the Display Manager to turn off the
``{\small\texttt{tutorial-modern.pdb}}'' and don't look at it again
until you have finished building, validating and refining.
  
Remember, when you start, you are placing a CA at the baton
\emph{tip} and at the start you are placing atom CA 1.  This might
seem that you are ``double-backing'' on yourself - which can be
confusing the first time.

So build from the N-terminus to the C (it takes about 15 minutes or
so).  There are 96 residues to build.

Note that you need at least 6 CA baton points for CA Zone to Mainchain
to work\footnote{otherwise it silently fails - more feedback will be
  added in later versions.}

\section{Build another molecule}

%Alternatively, find somewhere nice to start, where there is a clear
%side-chain and start building.  Build 30 or so CA baton positions.
%Like above, convert this to mainchain.  Again, clean up - noting that
%this time that we want the latest ``mainchain'' (largest molecule
%number) - there should be 2 of them (at least).

Now we need to build another molecule (the NCS related copy).  So
using the map skeleton search around to find a volume of density not
already build (and not symmetry related to the model already built).

Here's a hint, find the a helix in the skeleton. 

\begin{itemize}
\item Using the Other Modelling Tools, place a helix over the skeleton
  points of the skeleton.
\item Improve the fit of the skeleton, taking note that the N and C
  terminus of the helix are well-fitted.
\item Associate the same sequence with the new Helix molecule
\item Dock sidechains on the new molecule (it should work if your
  helix is good)
\item Now compare the Helix molecule with the previously built model.
  Find matching start and end point on the helix and previous model.
\item LSQ fit a copy of the previous model on top of the Helix molecule

  \textsl{ [Coot displayes a new molecule that almost fits the so-far
    unbuilt density.]}

  Let's call this new chain, chain ``B''

\item Now clean up the fit, first do a rigid body refinement of the
  whole new model\ldots{}

\item then an All Molecule stepped refine should make the fit nice.

\end{itemize}


\section{Merge Molecules}

Merge the ``B'' chain into the ``A'' chain molecule above: 

\textsf{Calculate $\rightarrow$ Merge molecules $\rightarrow$
  Append/Insert Molecule(s) \emph{[Choose the most recent mainchain
    molecule]} into Molecule \emph{[Choose the molecule of the A chain]}
  $\rightarrow$ Merge}.

\section{Ghosts}

Unfortunately, there is no slick way to make Coot rebuild ghosts for
this composite molecule.  We need to write out the pdb file and read
it in again - inelegant.

\textsf{File $\rightarrow$ Save Coordinates, \emph{[Choose the
    molecule that does now contains both the A and B chains]}
  $\rightarrow$ Select Filename\ldots } Pick a filename then use
\textsf{File $\rightarrow$ Open Coordinates\ldots} to read it in
again.

Check the console as you do this, Coot will tell you that there are
NCS related molecules.  If\footnote{When} it does this, we're in
business.

In the following, you will need to know the first and last residue
numbers in the ``A'' chain.  Use the Go To Atom dialog to find them.

If ghosts appear, use:

\textsf{Extensions $\rightarrow$ NCS\ldots $\rightarrow$ Copy NCS
  Residue Range\ldots} using ``A''\footnote{presumably} as the Master
Chain ID then fill in the first and last residue numbers of the A
chain.

\textsl{[Coot builds the B chain as an NCS copy of the A chain]}

\section{Rinse, Repeat}

\begin{trivlist}
\item  Use NCS jumping (the 'O' key) to see NCS differences.
\item Now unmodelled blobs - like we did before.
\item Find the ligand (3GP), merge it in.
\item Refine using Refmac.
\item Validate. 
\item Rebuild.
\end{trivlist}


\section{Make some pictures}


  \begin{itemize}
    \item Highlight active site, with ligand.  Take a screenshot.
    \item Use Raster3D to take a screenshot
    \item Now make a Raster3D image without spheres for atoms, how do
      you do that?
    \item Now give the ligand a dotted surface
    \item Now Use \textsf{Extension $\rightarrow$ Mask Map} to make a
      map that has density only around the ligand.
    \item Now take the residues in the active site, use Copy Fragment
      and merge molecule to make a single molecule of them. Display
      this atom selection as an electrostatic surface
  \end{itemize}

\section{Views}

Try out the ``View'' system
\begin{itemize}
\item Zoom out to see the whole molecule on the screen
\item Recentre and Zoom in to the active site
\item Play Views\ldots
\end{itemize}


\section{More Exercises}
\begin{trivlist}
\item What does ``Another Level'' do? 
\item What does ``Multi-chicken'' do?
\item Use the skeletonization of a map to find a helix.  Use
  \textsf{Calculate $\rightarrow$ Other Modelling Tools} to add a
  helix there.
\item Try to represent the map with a higher resolution grid (use
  \textsf{Edit $\rightarrow$ Map Parameters}).  Do you prefer that?
  Why?
\item Use the EDS service to download 1H4P.  Can you find anything
  wrong with the main-chain?  If so, how can you correct it?
\item Use the EDS service to download 1QEX.  Can you find anything
  wrong with the main-chain?  If so, how can you correct it?
\end{trivlist}

\end{document}
