Author: bugman Date: Fri Jan 31 10:36:17 2014 New Revision: 22083 URL: http://svn.gna.org/viewcvs/relax?rev=22083&view=rev Log: Created the Noe.test_bug_21562_noe_replicate_fail system test. This is to catch bug #21562 (https://gna.org/bugs/?21562), reported by Dhanas Muthu (https://gna.org/users/dhanas). This is the failure of the NOE analysis when spectra are replicated. This uses the truncated data taken from the files attached to the bug report. The NOE output file is checked to see if the contents are correct. Added: trunk/test_suite/system_tests/scripts/noe/bug_21562_noe_replicate_fail.py Modified: trunk/test_suite/system_tests/noe.py Modified: trunk/test_suite/system_tests/noe.py URL: http://svn.gna.org/viewcvs/relax/trunk/test_suite/system_tests/noe.py?rev=22083&r1=22082&r2=22083&view=diff ============================================================================== --- trunk/test_suite/system_tests/noe.py (original) +++ trunk/test_suite/system_tests/noe.py Fri Jan 31 10:36:17 2014 @@ -41,6 +41,41 @@ # Create a temporary file. ds.tmpfile = mktemp() + + + def test_bug_21562_noe_replicate_fail(self): + """Catch U{bug #21562<https://gna.org/bugs/?21562>}, the failure of the NOE analysis when replicated spectra are used.""" + + # Execute the script. + self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'noe'+sep+'bug_21562_noe_replicate_fail.py') + + # Open the NOE output file. + file = open(ds.tmpfile) + lines = file.readlines() + file.close() + + # How the file should look like. + data = [ + "# Parameter description: The NOE.\n", + "#\n", + "# mol_name res_num res_name spin_num spin_name value error \n", + "2AT7_fmf_mol1 12 PHE 150 N 0.803029108487728 0.0199040298831904 \n", + "2AT7_fmf_mol1 13 ASN 170 N 0.829415981681132 0.0339996453012768 \n", + "2AT7_fmf_mol1 14 LYS 184 N 0.755789564728523 0.0250941717735858 \n" + ] + + # Printout of the real and generated data. + print("\n\nThe real data:") + for i in range(len(lines)): + print(repr(data[i])) + print("\nThe generated data:") + for i in range(len(lines)): + print(repr(lines[i])) + print("\n") + + # Check each line. + for i in range(len(lines)): + self.assertEqual(data[i], lines[i]) def test_noe_analysis(self): Added: trunk/test_suite/system_tests/scripts/noe/bug_21562_noe_replicate_fail.py URL: http://svn.gna.org/viewcvs/relax/trunk/test_suite/system_tests/scripts/noe/bug_21562_noe_replicate_fail.py?rev=22083&view=auto ============================================================================== --- trunk/test_suite/system_tests/scripts/noe/bug_21562_noe_replicate_fail.py (added) +++ trunk/test_suite/system_tests/scripts/noe/bug_21562_noe_replicate_fail.py Fri Jan 31 10:36:17 2014 @@ -1,0 +1,53 @@ +"""Script for demonstrating bug #21562, the failure of the NOE analysis when replicated spectra are used.""" + +# Python module imports. +from os import sep + +# relax module imports. +from data_store import Relax_data_store; ds = Relax_data_store() +from status import Status; status = Status() + + +# Create the NOE data pipe. +pipe.create('NOE fail', 'noe') + +# The path to the data files. +path_struct = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures' +path_lists = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'peak_lists'+sep+'bug_21562' + +# Load the structure. +structure.read_pdb(file='2AT7_fmf.pdb', dir=path_struct) + +# Load the sequence. +structure.load_spins(spin_id='@N', mol_name_target=None, ave_pos=True) + +# Set up the reference spectra. +spectrum.read_intensities(file='n_np4_hs_ph65_02mm_noe1.list', dir=path_lists, spectrum_id='no1', dim=1, int_method='height', int_col=None, spin_id_col=None, mol_name_col=1, res_num_col=2, res_name_col=3, spin_num_col=4, spin_name_col=5, sep=None, spin_id=None, ncproc=None) +noe.spectrum_type(spectrum_type='ref', spectrum_id='no1') +spectrum.read_intensities(file='n_np4_hs_ph65_02mm_noe2.list', dir=path_lists, spectrum_id='no2', dim=1, int_method='height', int_col=None, spin_id_col=None, mol_name_col=1, res_num_col=2, res_name_col=3, spin_num_col=4, spin_name_col=5, sep=None, spin_id=None, ncproc=None) +spectrum.replicated(spectrum_ids=['no2', 'no1']) +noe.spectrum_type(spectrum_type='ref', spectrum_id='no2') + +# Set up the saturated spectra. +spectrum.read_intensities(file='y_np4_hs_ph65_02mm_noe1.list', dir=path_lists, spectrum_id='yes1', dim=1, int_method='height', int_col=None, spin_id_col=None, mol_name_col=1, res_num_col=2, res_name_col=3, spin_num_col=4, spin_name_col=5, sep=None, spin_id=None, ncproc=None) +noe.spectrum_type(spectrum_type='sat', spectrum_id='yes1') +spectrum.read_intensities(file='y_np4_hs_ph65_02mm_noe2.list', dir=path_lists, spectrum_id='yes2', dim=1, int_method='height', int_col=None, spin_id_col=None, mol_name_col=1, res_num_col=2, res_name_col=3, spin_num_col=4, spin_name_col=5, sep=None, spin_id=None, ncproc=None) +spectrum.replicated(spectrum_ids=['yes2', 'yes1']) +noe.spectrum_type(spectrum_type='sat', spectrum_id='yes2') + +# The error analysis. +spectrum.error_analysis(subset=None) + +# Calculate the NOEs. +calc(verbosity=1) + +# Save the NOEs. +value.write(param='noe', file=ds.tmpfile, dir=None, scaling=1.0, comment=None, bc=False, force=True) + +# Write the results. +results.write(file='devnull', dir=None, compress_type=1, force=True) + +# Create grace files. +grace.write(x_data_type='res_num', y_data_type='ref', spin_id=None, plot_data='value', file='devnull', dir=None, force=True, norm=False) +grace.write(x_data_type='res_num', y_data_type='sat', spin_id=None, plot_data='value', file='devnull', dir=None, force=True, norm=False) +grace.write(x_data_type='res_num', y_data_type='noe', spin_id=None, plot_data='value', file='devnull', dir=None, force=True, norm=False)