Author: bugman Date: Fri Oct 24 18:20:21 2008 New Revision: 7969 URL: http://svn.gna.org/viewcvs/relax?rev=7969&view=rev Log: Merged revisions 7952,7961-7963,7965-7968 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/1.3 ........ r7952 | bugman | 2008-10-23 17:39:25 +0200 (Thu, 23 Oct 2008) | 9 lines Fix for bug #12487 (https://gna.org/bugs/index.php?12487). This bug was reported by Tyler Reddy (TREDDY at dal dot ca). The problem was that missing XH bond vector data was being manifested as the spin.xh_vect object being set to None. The overfit_deselect() function which is responsible for deselecting unsuitable spins prior to optimisation was only checking if the object existed, not if it was None! ........ r7961 | bugman | 2008-10-24 13:44:28 +0200 (Fri, 24 Oct 2008) | 3 lines Added a check to the atom_loop() to make sure structural data is loaded. ........ r7962 | bugman | 2008-10-24 13:56:38 +0200 (Fri, 24 Oct 2008) | 3 lines Added a check for empty PDB files in the internal structural object. ........ r7963 | bugman | 2008-10-24 14:22:44 +0200 (Fri, 24 Oct 2008) | 3 lines Added another spin to try to catch a program bug (unsuccessfully). ........ r7965 | semor | 2008-10-24 15:41:46 +0200 (Fri, 24 Oct 2008) | 5 lines Introduced verifications for the '-t' and '-l' options not to erase the python script used. This should fix bug 12498 (http://gna.org/bugs/?12498). ........ r7966 | bugman | 2008-10-24 16:14:19 +0200 (Fri, 24 Oct 2008) | 3 lines Created a system test using Tyler Reddy's bug report - bug #12487 (https://gna.org/bugs/?12487). ........ r7967 | semor | 2008-10-24 16:19:17 +0200 (Fri, 24 Oct 2008) | 7 lines Modified the '-l' and '-t' options so they check for an existing file and don't overwrite it. This was proposed by Edward in a post at: https://mail.gna.org/public/relax-devel/2008-10/msg00087.html (Message ID: 7f080ed10810240648p19b83da1x4c8990acf1834c5b@xxxxxxxxxxxxxx) ........ r7968 | semor | 2008-10-24 17:55:21 +0200 (Fri, 24 Oct 2008) | 7 lines Still improved the detection of existing files not to be overwritten when logging or teeing. This follows a post by Edward at: https://mail.gna.org/public/relax-devel/2008-10/msg00091.html (Message ID: 7f080ed10810240816o30acc1ddlbaa131bc5a9ea1ff@xxxxxxxxxxxxxx) ........ Added: branches/spectral_errors/test_suite/shared_data/results_files/tylers_peptide_trunc.bz2 - copied unchanged from r7968, 1.3/test_suite/shared_data/results_files/tylers_peptide_trunc.bz2 branches/spectral_errors/test_suite/shared_data/structures/tylers_peptide_trunc.pdb - copied unchanged from r7968, 1.3/test_suite/shared_data/structures/tylers_peptide_trunc.pdb branches/spectral_errors/test_suite/system_tests/scripts/tylers_peptide.py - copied unchanged from r7968, 1.3/test_suite/system_tests/scripts/tylers_peptide.py Modified: branches/spectral_errors/ (props changed) branches/spectral_errors/generic_fns/structure/internal.py branches/spectral_errors/relax branches/spectral_errors/specific_fns/model_free/main.py branches/spectral_errors/test_suite/system_tests/model_free.py branches/spectral_errors/test_suite/unit_tests/_generic_fns/test_mol_res_spin.py Propchange: branches/spectral_errors/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Fri Oct 24 18:20:21 2008 @@ -1,1 +1,1 @@ -/1.3:1-7948 +/1.3:1-7968 Modified: branches/spectral_errors/generic_fns/structure/internal.py URL: http://svn.gna.org/viewcvs/relax/branches/spectral_errors/generic_fns/structure/internal.py?rev=7969&r1=7968&r2=7969&view=diff ============================================================================== --- branches/spectral_errors/generic_fns/structure/internal.py (original) +++ branches/spectral_errors/generic_fns/structure/internal.py Fri Oct 24 18:20:21 2008 @@ -35,7 +35,7 @@ from api_base import Base_struct_API from generic_fns import pipes, relax_re from generic_fns.mol_res_spin import Selection -from relax_errors import RelaxError +from relax_errors import RelaxError, RelaxNoPdbError from relax_io import open_read_file from relax_warnings import RelaxWarning @@ -321,6 +321,10 @@ file = open_read_file(file_path) lines = file.readlines() file.close() + + # Check for empty files. + if lines == []: + raise RelaxError, "The PDB file is empty." # Init. model = None @@ -645,6 +649,10 @@ element name (str), and atomic position (array of len 3). """ + # Check that the structure is loaded. + if not len(self.structural_data): + raise RelaxNoPdbError + # Generate the selection object. sel_obj = Selection(atom_id) Modified: branches/spectral_errors/relax URL: http://svn.gna.org/viewcvs/relax/branches/spectral_errors/relax?rev=7969&r1=7968&r2=7969&view=diff ============================================================================== --- branches/spectral_errors/relax (original) +++ branches/spectral_errors/relax Fri Oct 24 18:20:21 2008 @@ -202,6 +202,10 @@ # The log file. log_file = options.log + + # Fail if the file already exists. + if access(log_file, F_OK): + parser.error("the log file " + `log_file` + " already exists") else: log_file = None @@ -213,6 +217,10 @@ # The tee file. tee_file = options.tee + + # Fail if the file already exists. + if access(tee_file, F_OK): + parser.error("the tee file " + `tee_file` + " already exists") else: tee_file = None Modified: branches/spectral_errors/specific_fns/model_free/main.py URL: http://svn.gna.org/viewcvs/relax/branches/spectral_errors/specific_fns/model_free/main.py?rev=7969&r1=7968&r2=7969&view=diff ============================================================================== --- branches/spectral_errors/specific_fns/model_free/main.py (original) +++ branches/spectral_errors/specific_fns/model_free/main.py Fri Oct 24 18:20:21 2008 @@ -1969,6 +1969,8 @@ # Test for structural data if required. elif need_vect and not hasattr(spin, 'xh_vect'): + spin.select = False + elif need_vect and spin.xh_vect == None: spin.select = False Modified: branches/spectral_errors/test_suite/system_tests/model_free.py URL: http://svn.gna.org/viewcvs/relax/branches/spectral_errors/test_suite/system_tests/model_free.py?rev=7969&r1=7968&r2=7969&view=diff ============================================================================== --- branches/spectral_errors/test_suite/system_tests/model_free.py (original) +++ branches/spectral_errors/test_suite/system_tests/model_free.py Fri Oct 24 18:20:21 2008 @@ -989,6 +989,13 @@ self.assertEqual(cdp.mol[0].res[1].spin[0].r, NH_BOND_LENGTH) + def test_tylers_peptide(self): + """Try a component of model-free analysis on Tyler Reddy's peptide data (truncated).""" + + # Execute the script. + self.relax.interpreter.run(script_file=sys.path[-1] + '/test_suite/system_tests/scripts/tylers_peptide.py') + + def test_write_results(self): """Writing of model-free results using the user function results.write().""" Modified: branches/spectral_errors/test_suite/unit_tests/_generic_fns/test_mol_res_spin.py URL: http://svn.gna.org/viewcvs/relax/branches/spectral_errors/test_suite/unit_tests/_generic_fns/test_mol_res_spin.py?rev=7969&r1=7968&r2=7969&view=diff ============================================================================== --- branches/spectral_errors/test_suite/unit_tests/_generic_fns/test_mol_res_spin.py (original) +++ branches/spectral_errors/test_suite/unit_tests/_generic_fns/test_mol_res_spin.py Fri Oct 24 18:20:21 2008 @@ -67,6 +67,7 @@ cdp.mol[1].res[1].spin[0].name = 'C8' cdp.mol[1].res[0].spin.add_item(spin_name='N5') cdp.mol[1].res[1].spin.add_item(spin_name='N5') + cdp.mol[1].res[1].spin.add_item(spin_name='2H', spin_num=132) # Deselect a number of spins. cdp.mol[0].res[0].spin[0].select = 0 @@ -487,8 +488,8 @@ """ # Test the number of spins counted. - self.assertEqual(mol_res_spin.count_spins(), 3) - self.assertEqual(mol_res_spin.count_spins(skip_desel=False), 7) + self.assertEqual(mol_res_spin.count_spins(), 4) + self.assertEqual(mol_res_spin.count_spins(skip_desel=False), 8) self.assertEqual(mol_res_spin.count_spins(selection='@N5'), 1) self.assertEqual(mol_res_spin.count_spins(selection='@N5', skip_desel=False), 2) @@ -1194,6 +1195,7 @@ spin2 = mol_res_spin.return_spin(selection=':2&:Glu') spin3 = mol_res_spin.return_spin(selection=':4&:Pro', pipe='orig') spin4 = mol_res_spin.return_spin(selection='#RNA:-5@N5', pipe='orig') + spin5 = mol_res_spin.return_spin(selection=':-4@2H', pipe='orig') # Test the data of spin 1. self.assertNotEqual(spin1, None) @@ -1214,6 +1216,11 @@ self.assertNotEqual(spin4, None) self.assertEqual(spin4.num, None) self.assertEqual(spin4.name, 'N5') + + # Test the data of the RNA res -4, spin 2H. + self.assertNotEqual(spin5, None) + self.assertEqual(spin5.num, 132) + self.assertEqual(spin5.name, '2H') def test_return_spin_pipe_fail(self): @@ -1347,8 +1354,8 @@ """ # Spin data. - select = [0, 1, 0, 0, 1, 1, 0] - name = ['NH', 'NH', None, 'C8', 'N5', 'C8', 'N5'] + select = [0, 1, 0, 0, 1, 1, 0, 1] + name = ['NH', 'NH', None, 'C8', 'N5', 'C8', 'N5', '2H'] # Loop over the spins. i = 0 @@ -1363,7 +1370,7 @@ i = i + 1 # Test loop length. - self.assertEqual(i, 7) + self.assertEqual(i, 8) def test_spin_loop_single_spin(self):