Author: semor Date: Mon Jul 28 21:36:19 2008 New Revision: 6993 URL: http://svn.gna.org/viewcvs/relax?rev=6993&view=rev Log: Started to add system tests for model-free analysis using Modelfree4. Added: 1.3/test_suite/system_tests/palmer.py 1.3/test_suite/system_tests/scripts/palmer.py Modified: 1.3/test_suite/system_tests/__init__.py Modified: 1.3/test_suite/system_tests/__init__.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/system_tests/__init__.py?rev=6993&r1=6992&r2=6993&view=diff ============================================================================== --- 1.3/test_suite/system_tests/__init__.py (original) +++ 1.3/test_suite/system_tests/__init__.py Mon Jul 28 21:36:19 2008 @@ -41,6 +41,7 @@ from model_selection import Modsel from n_state_model import N_state_model from nmrview import NMRView +from palmer import Palmer from pipe_create import Pipe_create from relax_fit import Relax_fit from results import Results @@ -57,6 +58,7 @@ 'model_selection', 'n_state_model', 'nmrview', + 'palmer', 'pipe_create', 'relax_fit', 'results', @@ -89,6 +91,7 @@ suite_array.append(TestLoader().loadTestsFromTestCase(Load_spins)) suite_array.append(TestLoader().loadTestsFromTestCase(Mf)) suite_array.append(TestLoader().loadTestsFromTestCase(Modsel)) + suite_array.append(TestLoader().loadTestsFromTestCase(Palmer)) suite_array.append(TestLoader().loadTestsFromTestCase(Relax_fit)) suite_array.append(TestLoader().loadTestsFromTestCase(Results)) suite_array.append(TestLoader().loadTestsFromTestCase(Sequence)) Added: 1.3/test_suite/system_tests/palmer.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/system_tests/palmer.py?rev=6993&view=auto ============================================================================== --- 1.3/test_suite/system_tests/palmer.py (added) +++ 1.3/test_suite/system_tests/palmer.py Mon Jul 28 21:36:19 2008 @@ -1,0 +1,39 @@ +############################################################################### +# # +# Copyright (C) 2008 Sebastien Morin # +# # +# This file is part of the program relax. # +# # +# relax 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 2 of the License, or # +# (at your option) any later version. # +# # +# relax 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 relax; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# # +############################################################################### + +# Python module imports. +import sys +from unittest import TestCase + + +class Palmer(TestCase): + """Class for testing various aspects specific to model-free analysis using the program + 'Modelfree4'. + """ + + def test_palmer_stage_1(self): + """Test a complete model-free analysis using the program 'Modelfree4'.""" + + # Execute the script. + self.relax.interpreter.run(script_file=sys.path[-1] + '/test_suite/system_tests/scripts/palmer.py') + + Added: 1.3/test_suite/system_tests/scripts/palmer.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/system_tests/scripts/palmer.py?rev=6993&view=auto ============================================================================== --- 1.3/test_suite/system_tests/scripts/palmer.py (added) +++ 1.3/test_suite/system_tests/scripts/palmer.py Mon Jul 28 21:36:19 2008 @@ -1,0 +1,136 @@ +# Script for model-free analysis using the program 'Modelfree4'. + +# Python module imports. +import sys + +# The RelaxError system. +from relax_errors import RelaxError + +# Set the stage of analysis. +# +# The three stages in this script are: +# Stage 1: Initial model-free minimisation. +# Stage 2: Model-free model selection. +# Stage 3: Final optimisation of diffusion tensor parameters together with model-free parameters. + + +# Functions. + +def exec_stage_1(runs): + """Stage 1 function. + + Initial model-free minimisation. + """ + + # Loop over the runs. + for name in runs: + # Create the run. + print "\n\n# " + name + " #" + pipe.create(name, 'mf') + + # Load the sequence. + sequence.read(sys.path[-1] + '/test_suite/system_tests/data/jw_mapping/noe.dat') + + # PDB. + #structure.read_pdb(name, 'Ap4Aase_new_3.pdb') + + # Load the relaxation data. + relax_data.read('R1', '600', 600.0 * 1e6, sys.path[-1] + '/test_suite/system_tests/data/jw_mapping/R1.dat') + relax_data.read('R2', '600', 600.0 * 1e6, sys.path[-1] + '/test_suite/system_tests/data/jw_mapping/R2.dat') + relax_data.read('NOE', '600', 600.0 * 1e6, sys.path[-1] + '/test_suite/system_tests/data/jw_mapping/noe.dat') + + # Setup other values. + diffusion_tensor.init(1e-8) + value.set(NUCLEI, 'heteronucleus') + value.set(1.02 * 1e-10, 'bond_length') + value.set(-172 * 1e-6, 'csa') + + # Select the model-free model. + model_free.select_model(model=name) + + # Create the Modelfree4 files. + palmer.create(force=True, sims=0) + + # Run Modelfree4. + palmer.execute(force=True) + + # Save the program state. + state.save('stage1.save', force=True) + + +def exec_stage_2(runs): + """Stage 2 function. + + Model-free model selection. + """ + + # Load the saved state from stage 1. + state.load('stage1.save') + + # Print out. + print "\n\nLoading all the Modelfree 4 data." + + # Extract the Modelfree4 data from the 'mfout' files. + for name in runs: + palmer.extract() + + # Print out. + print "\n\nModel selection." + + # Create the model selection run. + name = 'aic' + pipe.create(name, 'mf') + + # Model selection. + model_selection(method='AIC', modsel_run=name) + + # Write the results. + results.write(file='results', force=True) + + # Save the program state. + state.save('stage2.save', force=True) + + +def exec_stage_3(): + """Stage 3 function. + + Final optimisation of diffusion tensor parameters together with model-free parameters. + """ + + # Load the saved state from stage 2. + state.load('stage2.save') + + # Set the run name. + name = 'aic' + + # Let the diffusion tensor parameters be optimised. + fix(name, 'diff', 0) + + # Create the Modelfree4 files (change sims as needed, see below). + palmer.create(dir='final', force=True, sims=0) + + # Run Modelfree4. + palmer.execute(dir='final', force=True) + + # Extract the Modelfree4 data from the 'mfout' file. + palmer.extract(dir='final') + + # Save the program state. + state.save('stage3.save', force=True) + + +# Main section of the script. +############################# + +# Nuclei type. +NUCLEI = '15N' + +# Set the run name (also the name of a preset model-free model). +runs = ['m1', 'm2', 'm3'] + +# Run the stages. +exec_stage_1(runs) +exec_stage_2(runs) +exec_stage_3() + +# Either repeat all the above with the optimised diffusion tensor or run Monte Carlo simulations on the final results.