Author: bugman Date: Thu May 1 15:42:07 2008 New Revision: 6031 URL: http://svn.gna.org/viewcvs/relax?rev=6031&view=rev Log: Updated the relaxation curve fitting chapter to the new relax design. Modified: 1.3/docs/latex/curvefit.tex Modified: 1.3/docs/latex/curvefit.tex URL: http://svn.gna.org/viewcvs/relax/1.3/docs/latex/curvefit.tex?rev=6031&r1=6030&r2=6031&view=diff ============================================================================== --- 1.3/docs/latex/curvefit.tex (original) +++ 1.3/docs/latex/curvefit.tex Thu May 1 15:42:07 2008 @@ -23,90 +23,91 @@ \begin{exampleenv} \# Script for relaxation curve-fitting. \\ \\ -\# Create the run. \\ -name = `rx' \\ -run.create(name, `relax\_fit') \\ +\# Create the `rx' data pipe. \\ +pipe.create(`rx', `relax\_fit') \\ \\ -\# Load the sequence from a PDB file. \\ -pdb(name, `Ap4Aase\_new\_3.pdb', load\_seq=1) \\ +\# Load the backbone amide 15N spins from a PDB file. \\ +structure.read\_pdb(`Ap4Aase\_new\_3.pdb') \\ +structure.load\_spins(spin\_id=`@N') \\ \\ \# Load the peak intensities. \\ -relax\_fit.read(name, file=`T2\_ncyc1.list', relax\_time=0.0176) \\ -relax\_fit.read(name, file=`T2\_ncyc1b.list', relax\_time=0.0176) \\ -relax\_fit.read(name, file=`T2\_ncyc2.list', relax\_time=0.0352) \\ -relax\_fit.read(name, file=`T2\_ncyc4.list', relax\_time=0.0704) \\ -relax\_fit.read(name, file=`T2\_ncyc4b.list', relax\_time=0.0704) \\ -relax\_fit.read(name, file=`T2\_ncyc6.list', relax\_time=0.1056) \\ -relax\_fit.read(name, file=`T2\_ncyc9.list', relax\_time=0.1584) \\ -relax\_fit.read(name, file=`T2\_ncyc9b.list', relax\_time=0.1584) \\ -relax\_fit.read(name, file=`T2\_ncyc11.list', relax\_time=0.1936) \\ -relax\_fit.read(name, file=`T2\_ncyc11b.list', relax\_time=0.1936) \\ +relax\_fit.read(file=`T2\_ncyc1.list', relax\_time=0.0176) \\ +relax\_fit.read(file=`T2\_ncyc1b.list', relax\_time=0.0176) \\ +relax\_fit.read(file=`T2\_ncyc2.list', relax\_time=0.0352) \\ +relax\_fit.read(file=`T2\_ncyc4.list', relax\_time=0.0704) \\ +relax\_fit.read(file=`T2\_ncyc4b.list', relax\_time=0.0704) \\ +relax\_fit.read(file=`T2\_ncyc6.list', relax\_time=0.1056) \\ +relax\_fit.read(file=`T2\_ncyc9.list', relax\_time=0.1584) \\ +relax\_fit.read(file=`T2\_ncyc9b.list', relax\_time=0.1584) \\ +relax\_fit.read(file=`T2\_ncyc11.list', relax\_time=0.1936) \\ +relax\_fit.read(file=`T2\_ncyc11b.list', relax\_time=0.1936) \\ \\ \# Calculate the peak intensity averages and the standard deviation of all spectra. \\ -relax\_fit.mean\_and\_error(name) \\ +relax\_fit.mean\_and\_error() \\ \\ \# Deselect unresolved residues. \\ -deselect.read(name, file=`unresolved') \\ +deselect.read(file=`unresolved') \\ \\ \# Set the relaxation curve type. \\ -relax\_fit.select\_model(name, `exp') \\ +relax\_fit.select\_model(`exp') \\ \\ \# Grid search. \\ -grid\_search(name, inc=11) \\ +grid\_search(inc=11) \\ \\ \# Minimise. \\ -minimise(`simplex', run=name, constraints=0) \\ +minimise(`simplex', scaling=False, constraints=False) \\ \\ \# Monte Carlo simulations. \\ -monte\_carlo.setup(name, number=500) \\ -monte\_carlo.create\_data(name) \\ -monte\_carlo.initial\_values(name) \\ -minimise(`simplex', run=name, constraints=0) \\ -monte\_carlo.error\_analysis(name) \\ +monte\_carlo.setup(number=500) \\ +monte\_carlo.create\_data() \\ +monte\_carlo.initial\_values() \\ +minimise(`simplex', scaling=False, constraints=False) \\ +monte\_carlo.error\_analysis() \\ \\ \# Save the relaxation rates. \\ -value.write(name, param=`rx', file=`rx.out', force=1) \\ +value.write(param=`rx', file=`rx.out', force=True) \\ \\ \# Grace plots of the relaxation rate. \\ -grace.write(name, y\_data\_type=`rx', file=`rx.agr', force=1) \\ +grace.write(y\_data\_type=`rx', file=`rx.agr', force=True) \\ grace.view(file=`rx.agr') \\ \\ \# Save the program state. \\ -state.save(file=name + `.save', force=1) +state.save(file=`rx.save', force=True) \end{exampleenv} -% Initialisation of the run and loading of the data. -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Initialisation of the data pipe and loading of the data. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\section{Initialisation of the run and loading of the data} +\section{Initialisation of the data pipe and loading of the data} -The start of this sample script is very similar to that of the NOE calculation on page~\pageref{NOE initialisation}. The two commands +The start of this sample script is very similar to that of the NOE calculation on page~\pageref{NOE initialisation}. The command \begin{exampleenv} -name = `rx' \\ -run.create(name, `relax\_fit') +pipe.create(`rx', `relax\_fit') \end{exampleenv} -initialise the run by setting the variable \texttt{name} to \texttt{`rx'} to be used in the calls to user functions and creating a run called \texttt{`rx'}. The run type is set to relaxation curve-fitting by the argument \texttt{`relax\_fit'}. The sequence is extracted from a PDB\index{PDB} file using the same command as the NOE calculation script +initialises the data pipe labelled \texttt{`rx'}. The data pipe type is set to relaxation curve-fitting by the argument \texttt{`relax\_fit'}. The backbone amide nitrogen sequence is extracted from a PDB\index{PDB} file using the same commands as the NOE calculation script -\example{pdb(name, `Ap4Aase\_new\_3.pdb', load\_seq=1)} +\example{structure.read\_pdb(name, `Ap4Aase\_new\_3.pdb')} \index{PDB} + +\example{structure.load\_spins(spin\_id=`@N')} To load the peak intensities\index{peak!intensity} into relax the user function \texttt{relax\_fit.read} is executed. Two important keyword arguments to this command are the file name and the relaxation time period of the experiment in seconds. It is assumed that the file format is that of a Sparky\index{computer programs!Sparky} peak list. Using the format argument, this can be changed to XEasy\index{computer programs!XEasy} text window output format. To be able to import any other type of format please send an email to the relax development mailing list\index{mailing list!relax-devel} with the details of the format. Adding support for new formats is trivial. The following series of commands will load peak intensities from six different relaxation periods, four of which have been duplicated \begin{exampleenv} -relax\_fit.read(name, file=`T2\_ncyc1.list', relax\_time=0.0176) \\ -relax\_fit.read(name, file=`T2\_ncyc1b.list', relax\_time=0.0176) \\ -relax\_fit.read(name, file=`T2\_ncyc2.list', relax\_time=0.0352) \\ -relax\_fit.read(name, file=`T2\_ncyc4.list', relax\_time=0.0704) \\ -relax\_fit.read(name, file=`T2\_ncyc4b.list', relax\_time=0.0704) \\ -relax\_fit.read(name, file=`T2\_ncyc6.list', relax\_time=0.1056) \\ -relax\_fit.read(name, file=`T2\_ncyc9.list', relax\_time=0.1584) \\ -relax\_fit.read(name, file=`T2\_ncyc9b.list', relax\_time=0.1584) \\ -relax\_fit.read(name, file=`T2\_ncyc11.list', relax\_time=0.1936) \\ -relax\_fit.read(name, file=`T2\_ncyc11b.list', relax\_time=0.1936) +relax\_fit.read(file=`T2\_ncyc1.list', relax\_time=0.0176) \\ +relax\_fit.read(file=`T2\_ncyc1b.list', relax\_time=0.0176) \\ +relax\_fit.read(file=`T2\_ncyc2.list', relax\_time=0.0352) \\ +relax\_fit.read(file=`T2\_ncyc4.list', relax\_time=0.0704) \\ +relax\_fit.read(file=`T2\_ncyc4b.list', relax\_time=0.0704) \\ +relax\_fit.read(file=`T2\_ncyc6.list', relax\_time=0.1056) \\ +relax\_fit.read(file=`T2\_ncyc9.list', relax\_time=0.1584) \\ +relax\_fit.read(file=`T2\_ncyc9b.list', relax\_time=0.1584) \\ +relax\_fit.read(file=`T2\_ncyc11.list', relax\_time=0.1936) \\ +relax\_fit.read(file=`T2\_ncyc11b.list', relax\_time=0.1936) \end{exampleenv} @@ -118,15 +119,15 @@ Once all the peak intensity data has been loaded a few calculations are required prior to optimisation. Firstly the peak intensities for individual residues needs to be averaged across replicated spectra. The peak intensity errors also have to be calculated using the standard deviation formula. These two operations are executed by the user function -\example{relax\_fit.mean\_and\_error(name)} +\example{relax\_fit.mean\_and\_error()} Any residues which cannot be resolved due to peak overlap were included in a file called \texttt{`unresolved'}. This file consists solely of one residue number per line. These residues are excluded from the analysis by the user function -\example{deselect.read(name, file=`unresolved')} +\example{deselect.read(file=`unresolved')} Finally the experiment type is specified by the command -\example{relax\_fit.select\_model(name, `exp')} +\example{relax\_fit.select\_model(`exp')} The argument \texttt{`exp'} sets the relaxation curve to a two parameter \{$\mathrm{R}_x$, $I_0$\} exponential which decays to zero. The formula of this function is \begin{equation} @@ -147,11 +148,11 @@ Now that everything has been setup minimision can be used to optimise the parameter values. Firstly a grid search is applied to find a rough starting position for the subsequent optimisation algorithm. Eleven increments per dimension of the model (in this case the two dimensions \{$\mathrm{R}_x$, $I_0$\}) is sufficient. The user function for executing the grid search is -\example{grid\_search(name, inc=11)} +\example{grid\_search(inc=11)} The next step is to select one of the minimisation algorithms to optimise the model parameters. Currently for relaxation curve-fitting only simplex minimisation is supported. This is because the relaxation curve-fitting C module is incomplete only implementing the chi-squared function. The chi-squared gradient (the vector of first partial derivatives) and chi-squared Hessian (the matrix of second partial derivatives) are not yet implemented in the C modules and hence optimisation algorithms which only employ function calls are supported. Simplex minimisation is the only technique in relax which fits this criteron. In addition constraints cannot be used as the constraint algorithm is dependent on gradient calls. Therefore the minimisation command for relaxation curve-fitting is forced to be -\example{minimise(`simplex', run=name, constraints=0)} +\example{minimise(`simplex', constraints=False)}