Hi Ed,

I agree with what you propose here. It is important that installation of
ModelFree4 stays a possibility, not an obligation, while, for those with
an installed program, the tools in relax should be tested to see if they
work.

I think your approach in r7017
(http://svn.gna.org/viewcvs/relax?rev=7017&view=rev) is really perfect
for this purpose and has the advantage of leaving complete flexibility
for the user.

Regards,


Séb




Edward d'Auvergne wrote:
> Hi,
>
> This is a difficult question.  At the moment, I think the simplest
> solution would be to use the relax_io.test_binary() function to see if
> these binaries are located in the system path and are executable and
> if not skip the test (essentially just return without executing the
> main part of the test, hence the test counts as a pass).  I'll add
> this to your new Modelfree4 system test to see if it works.  Ideally
> though, the system tests should report that this test could not be run
> as the binary could not be found, but still the system tests should
> pass.  Otherwise the failing system test will make users think that
> they need to install Modelfree4, which is not possible on all
> platforms.
>
> Additionally in this test, a temporary directory should be given to
> Modelfree4 to dump it's output into.  This directory would then be
> destroyed by the tearDown() method, no matter what happens in the
> test.
>
> Regards,
>
> Edward
>
>
> On Mon, Jul 28, 2008 at 10:06 PM, Sébastien Morin
> <[EMAIL PROTECTED]> wrote:
>   
>> Hi Ed (and others)
>>
>> I don't know what you think about this... as some people might not have
>> ModelFree4 installed and could not be interested in the features related
>> to it... On the other hand, we most have system tests for interaction
>> with ModelFree4 stuff...
>>
>> The same applies for Dasha...
>>
>> What do you think ?
>>
>> Regards,
>>
>>
>> Séb
>>
>>
>>
>> [EMAIL PROTECTED] wrote:
>>     
>>> 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.
>>>
>>>
>>> _______________________________________________
>>> relax (http://nmr-relax.com)
>>>
>>> This is the relax-commits mailing list
>>> [EMAIL PROTECTED]
>>>
>>> To unsubscribe from this list, get a password
>>> reminder, or change your subscription options,
>>> visit the list information page at
>>> https://mail.gna.org/listinfo/relax-commits
>>>
>>>
>>>
>>>       
>> _______________________________________________
>> relax (http://nmr-relax.com)
>>
>> This is the relax-devel mailing list
>> [email protected]
>>
>> To unsubscribe from this list, get a password
>> reminder, or change your subscription options,
>> visit the list information page at
>> https://mail.gna.org/listinfo/relax-devel
>>
>>     
>
>   


_______________________________________________
relax (http://nmr-relax.com)

This is the relax-devel mailing list
[email protected]

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-devel

Reply via email to