Author: bugman Date: Wed Feb 13 16:44:09 2013 New Revision: 18466 URL: http://svn.gna.org/viewcvs/relax?rev=18466&view=rev Log: Merged revisions 18462-18465 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk ........ r18462 | bugman | 2013-02-13 16:05:19 +0100 (Wed, 13 Feb 2013) | 3 lines Created the Mol_res_spin.test_metadata_molecule_rename system test to demonstrate a spin ID metadata bug. ........ r18463 | bugman | 2013-02-13 16:25:36 +0100 (Wed, 13 Feb 2013) | 14 lines Reverted r18462 as the Mol_res_spin.test_metadata_molecule_rename system test logic is rubbish. The command used was: svn merge -r18462:r18461 . ..... r18462 | bugman | 2013-02-13 16:05:19 +0100 (Wed, 13 Feb 2013) | 3 lines Changed paths: M /trunk/test_suite/system_tests/mol_res_spin.py Created the Mol_res_spin.test_metadata_molecule_rename system test to demonstrate a spin ID metadata bug. ..... ........ r18464 | bugman | 2013-02-13 16:41:21 +0100 (Wed, 13 Feb 2013) | 6 lines Created the Structure.test_load_spins_mol_cat system test. This will be used to test a new 'mol_name_target' argument to the structure.load_spins user function. ........ r18465 | bugman | 2013-02-13 16:42:50 +0100 (Wed, 13 Feb 2013) | 6 lines Added the mol_name_target argument to the structure.load_spins user function. This allows spins from different molecules to be placed together in the same molecule container in the relax data store. ........ Modified: branches/frame_order_testing/ (props changed) branches/frame_order_testing/generic_fns/structure/main.py branches/frame_order_testing/test_suite/system_tests/structure.py branches/frame_order_testing/user_functions/structure.py Propchange: branches/frame_order_testing/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Wed Feb 13 16:44:09 2013 @@ -1,1 +1,1 @@ -/trunk:1-18459 +/trunk:1-18465 Modified: branches/frame_order_testing/generic_fns/structure/main.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/generic_fns/structure/main.py?rev=18466&r1=18465&r2=18466&view=diff ============================================================================== --- branches/frame_order_testing/generic_fns/structure/main.py (original) +++ branches/frame_order_testing/generic_fns/structure/main.py Wed Feb 13 16:44:09 2013 @@ -322,13 +322,15 @@ write_data(out=sys.stdout, headings=["Spin_ID", "Position"], data=data) -def load_spins(spin_id=None, str_id=None, ave_pos=False): +def load_spins(spin_id=None, str_id=None, mol_name_target=None, ave_pos=False): """Load the spins from the structural object into the relax data store. @keyword spin_id: The molecule, residue, and spin identifier string. @type spin_id: str @keyword str_id: The structure identifier. This can be the file name, model number, or structure number. @type str_id: int or str + @keyword mol_name: The name of target molecule container, overriding the name of the loaded structures + @type mol_name: str or None @keyword ave_pos: A flag specifying if the average atom position or the atom position from all loaded structures is loaded into the SpinContainer. @type ave_pos: bool """ @@ -352,6 +354,10 @@ # Loop over all atoms of the spin_id selection. for mol_name, res_num, res_name, atom_num, atom_name, element, pos in cdp.structure.atom_loop(atom_id=spin_id, str_id=str_id, mol_name_flag=True, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, element_flag=True, pos_flag=True, ave=ave_pos): + # Override the molecule name. + if mol_name_target: + mol_name = mol_name_target + # Remove the '+' regular expression character from the mol, res, and spin names! if mol_name and search('\+', mol_name): mol_name = mol_name.replace('+', '') @@ -371,12 +377,25 @@ except RelaxError: spin_cont = return_spin(id) +<<<<<<< .working # Append all the spin ID info for printing later. mol_names.append(mol_name) res_nums.append(res_num) res_names.append(res_name) spin_nums.append(atom_num) spin_names.append(atom_name) +======= + # Append all the spin ID info for the first model for printing later. + if model_index == 0: + if mol_name_target: + mol_names.append(mol_name_target) + else: + mol_names.append(mol_name) + res_nums.append(res_num) + res_names.append(res_name) + spin_nums.append(atom_num) + spin_names.append(atom_name) +>>>>>>> .merge-right.r18465 # Position vector. spin_cont.pos = pos Modified: branches/frame_order_testing/test_suite/system_tests/structure.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/test_suite/system_tests/structure.py?rev=18466&r1=18465&r2=18466&view=diff ============================================================================== --- branches/frame_order_testing/test_suite/system_tests/structure.py (original) +++ branches/frame_order_testing/test_suite/system_tests/structure.py Wed Feb 13 16:44:09 2013 @@ -184,6 +184,33 @@ self.assertAlmostEqual(cdp.structure.displacements._rotation_axis[models[i]][models[j]][k], rot_axis[i][j][k]) + def test_load_spins_mol_cat(self): + """Test the loading of spins from different molecules into one molecule container.""" + + # Path of the files. + path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'+sep+'lactose' + + # Read the PDBs. + self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_1.pdb', dir=path, set_mol_name='L1', parser='internal') + self.interpreter.structure.read_pdb(file='lactose_MCMM4_S1_2.pdb', dir=path, set_mol_name='L2', parser='internal') + + # Load a few protons. + self.interpreter.structure.load_spins('#L1:900@C1', mol_name_target='Lactose') + self.interpreter.structure.load_spins('#L2:900@C2', mol_name_target='Lactose') + + # Check the spin data. + self.assertEqual(len(cdp.mol), 1) + self.assertEqual(cdp.mol[0].name, 'Lactose') + self.assertEqual(len(cdp.mol[0].res), 1) + self.assertEqual(cdp.mol[0].res[0].name, 'UNK') + self.assertEqual(cdp.mol[0].res[0].num, 900) + self.assertEqual(len(cdp.mol[0].res[0].spin), 2) + self.assertEqual(cdp.mol[0].res[0].spin[0].name, 'C1') + self.assertEqual(cdp.mol[0].res[0].spin[0].num, 1) + self.assertEqual(cdp.mol[0].res[0].spin[1].name, 'C2') + self.assertEqual(cdp.mol[0].res[0].spin[1].num, 2) + + def test_load_internal_results(self): """Load the PDB file using the information in a results file (using the internal structural object).""" Modified: branches/frame_order_testing/user_functions/structure.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/user_functions/structure.py?rev=18466&r1=18465&r2=18466&view=diff ============================================================================== --- branches/frame_order_testing/user_functions/structure.py (original) +++ branches/frame_order_testing/user_functions/structure.py Wed Feb 13 16:44:09 2013 @@ -428,6 +428,12 @@ desc = "The spin identification string for the selective loading of certain spins into the relax data store.", wiz_combo_choices = ["@N", "@C", "@H", "@O", "@P", "@NE1", "@HE1", ":A@C2", ":A@C8", ":G@N1", ":G@C8", ":C@C5", ":C@C5", ":U@N3", ":U@C5", ":U@C6"], can_be_none = True +) +uf.add_keyarg( + name = "mol_name_target", + py_type = "str", + desc_short = "target molecule name", + desc = "The name of target molecule container, overriding the name of the loaded structures." ) uf.add_keyarg( name = "ave_pos",