Author: semor Date: Thu Jul 31 16:51:45 2008 New Revision: 7051 URL: http://svn.gna.org/viewcvs/relax?rev=7051&view=rev Log: Started to implement system tests for the use of the external program Dasha. This code is mimicked on the palmer code for testing interaction with ModelFree4. Added: 1.3/test_suite/system_tests/dasha.py 1.3/test_suite/system_tests/scripts/dasha.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=7051&r1=7050&r2=7051&view=diff ============================================================================== --- 1.3/test_suite/system_tests/__init__.py (original) +++ 1.3/test_suite/system_tests/__init__.py Thu Jul 31 16:51:45 2008 @@ -33,6 +33,7 @@ # relax system/functional test module imports. from angles import Angles from consistency_tests import Ct +from dasha import Dasha from diffusion_tensor import Diffusion_tensor from generic import Generic from jw_mapping import Jw @@ -50,6 +51,7 @@ __all__ = ['angles', 'consistency_tests', + 'dasha' 'diffusion_tensor', 'generic', 'jw_mapping', @@ -85,6 +87,7 @@ suite_array = [] suite_array.append(TestLoader().loadTestsFromTestCase(Angles)) suite_array.append(TestLoader().loadTestsFromTestCase(Ct)) + suite_array.append(TestLoader().loadTestsFromTestCase(Dasha)) suite_array.append(TestLoader().loadTestsFromTestCase(Diffusion_tensor)) suite_array.append(TestLoader().loadTestsFromTestCase(Generic)) suite_array.append(TestLoader().loadTestsFromTestCase(Jw)) Added: 1.3/test_suite/system_tests/dasha.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/system_tests/dasha.py?rev=7051&view=auto ============================================================================== --- 1.3/test_suite/system_tests/dasha.py (added) +++ 1.3/test_suite/system_tests/dasha.py Thu Jul 31 16:51:45 2008 @@ -1,0 +1,76 @@ +############################################################################### +# # +# 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 os import chdir +from shutil import rmtree +from tempfile import mkdtemp +from unittest import TestCase + +# relax module imports. +from data import Relax_data_store; ds = Relax_data_store() +from relax_io import test_binary + + +class Dasha(TestCase): + """Class for testing various aspects specific to model-free analysis using the program + 'Dasha'. + """ + + + def setUp(self): + """Set up for all the functional tests.""" + + # Create the data pipe. + self.relax.interpreter._Pipe.create('dasha', 'mf') + + # Create a temporary directory for Dasha outputs. + self.temp_Dasha_dir = mkdtemp() + + + def tearDown(self): + """Reset the relax data storage object.""" + + ds.__reset__() + + # Remove the temporary directory created during the execution of the test_dasha() function. + rmtree(self.temp_Dasha_dir) + + + def test_dasha(self): + """Test a complete model-free analysis using the program 'Dasha'.""" + + # Test for the presence of the Dasha binary (skip the test if not present). + try: + test_binary('dasha') + except: + return + + # Move to the temporary directory for Dasha outputs. + chdir(self.temp_Dasha_dir) + + # Execute the script. + self.relax.interpreter.run(script_file=sys.path[-1] + '/test_suite/system_tests/scripts/dasha.py') + + # Move back to the base relax directory. + chdir(sys.path[-1]) Added: 1.3/test_suite/system_tests/scripts/dasha.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/system_tests/scripts/dasha.py?rev=7051&view=auto ============================================================================== --- 1.3/test_suite/system_tests/scripts/dasha.py (added) +++ 1.3/test_suite/system_tests/scripts/dasha.py Thu Jul 31 16:51:45 2008 @@ -1,0 +1,45 @@ +# Script for model-free analysis using the program Dasha. + +# Python module imports. +import sys + + +# Set the data pipe names (also the names of preset model-free models). +pipes = ['m1', 'm2', 'm3'] + +# Loop over the pipes. +for name in pipes: + # Create the data pipe. + pipe.create(name, 'mf') + + # Load the sequence. + sequence.read(sys.path[-1] + '/test_suite/system_tests/data/jw_mapping/noe.dat') + + # Load a PDB file. + #structure.read_pdb('example.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, fixed=True) + value.set('15N', '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 Dasha script. + dasha.create(algor='NR', force=True) + + # Execute Dasha. + dasha.execute() + + # Read the data. + dasha.extract() + + # Write the results. + results.write(file='results_dasha', force=True)