Author: bugman Date: Thu Dec 11 11:15:46 2008 New Revision: 8190 URL: http://svn.gna.org/viewcvs/relax?rev=8190&view=rev Log: Merged revisions 8186-8189 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/1.3 ........ r8186 | bugman | 2008-12-10 18:46:37 +0100 (Wed, 10 Dec 2008) | 3 lines Added tests of structure.load_spins() to all the structure system tests. ........ r8187 | bugman | 2008-12-11 10:33:32 +0100 (Thu, 11 Dec 2008) | 10 lines Partial fix for bug #12735 (https://gna.org/bugs/index.php?12735). The problem fixed here is that of the missing molecule container. This was caused by the weirdness of the Scientific python PDB reader splitting one modified lactose molecule into 2 molecules. The lactose part was unnamed, while the modifier was named after the residues 'UNK'. The generic_fns.mol_res_spin.return_molecule() function was having problems with this concept of the first molecule unnamed and the second named. This is now fixed and the unnamed molecule can be retrieved. ........ r8188 | bugman | 2008-12-11 10:53:22 +0100 (Thu, 11 Dec 2008) | 8 lines Another partial fix for bug #12735 (https://gna.org/bugs/index.php?12735). This problem was trigged by the internal reader (where the problem lies) together with the gromacs_phthalic_acid.pdb file. The issue was that the __fill_object_from_pdb() was operating on all structures currently loaded into relax. Hence with the 2 models of this PDB file, the first molecule had all the atoms of the first and second PDB models combined. ........ r8189 | bugman | 2008-12-11 11:14:00 +0100 (Thu, 11 Dec 2008) | 9 lines Final fixes for bug #12735 (https://gna.org/bugs/index.php?12735). The last problem was again triggered by the Scientific python PDB reader weirdness. Residues ending in '+' were being treated by the PDB reader as a different molecule. But then the molecule names LYS+, ARG+, etc. were causing problems as '+' was being treated as regular expression when matching molecule names. Therefore the '+' character has been stripped from all molecule, residue, and atom names. ........ Modified: branches/ave_noe/ (props changed) branches/ave_noe/generic_fns/mol_res_spin.py branches/ave_noe/generic_fns/structure/internal.py branches/ave_noe/generic_fns/structure/main.py branches/ave_noe/test_suite/system_tests/structure.py Propchange: branches/ave_noe/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Thu Dec 11 11:15:46 2008 @@ -1,1 +1,1 @@ -/1.3:1-8184 +/1.3:1-8189 Modified: branches/ave_noe/generic_fns/mol_res_spin.py URL: http://svn.gna.org/viewcvs/relax/branches/ave_noe/generic_fns/mol_res_spin.py?rev=8190&r1=8189&r2=8190&view=diff ============================================================================== --- branches/ave_noe/generic_fns/mol_res_spin.py (original) +++ branches/ave_noe/generic_fns/mol_res_spin.py Thu Dec 11 11:15:46 2008 @@ -1601,6 +1601,10 @@ for mol in dp.mol: # Skip the molecule if there is no match to the selection. if mol not in select_obj: + continue + + # Skip named molecules if the selection is None. + if selection == None and mol.name != None: continue # Store the molecule container. Modified: branches/ave_noe/generic_fns/structure/internal.py URL: http://svn.gna.org/viewcvs/relax/branches/ave_noe/generic_fns/structure/internal.py?rev=8190&r1=8189&r2=8190&view=diff ============================================================================== --- branches/ave_noe/generic_fns/structure/internal.py (original) +++ branches/ave_noe/generic_fns/structure/internal.py Thu Dec 11 11:15:46 2008 @@ -904,6 +904,7 @@ print "Loading all structures from the PDB file." # Loop over all models in the PDB file. + i = 0 for model_num, records in self.__parse_models(file_path): # Only load the desired model. if model != None and model != model_num: @@ -917,7 +918,10 @@ self.add_struct(name=name, model=model_num, file=file, path=path, str=Structure_container(), struct_index=struct_index) # Fill the structural data object. - self.__fill_object_from_pdb(records, struct_index=struct_index) + self.__fill_object_from_pdb(records, struct_index=i) + + # Increment the structure index. + i = i + 1 # Loading worked. return True Modified: branches/ave_noe/generic_fns/structure/main.py URL: http://svn.gna.org/viewcvs/relax/branches/ave_noe/generic_fns/structure/main.py?rev=8190&r1=8189&r2=8190&view=diff ============================================================================== --- branches/ave_noe/generic_fns/structure/main.py (original) +++ branches/ave_noe/generic_fns/structure/main.py Thu Dec 11 11:15:46 2008 @@ -25,6 +25,7 @@ from numpy import dot, float64, ndarray, zeros from os import F_OK, access from re import search +from string import replace import sys from warnings import warn @@ -70,6 +71,15 @@ # 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): + + # Remove the '+' regular expression character from the mol, res, and spin names! + if mol_name and search('\+', mol_name): + mol_name = replace(mol_name, '+', '') + if res_name and search('\+', res_name): + res_name = replace(res_name, '+', '') + if atom_name and search('\+', atom_name): + atom_name = replace(atom_name, '+', '') + # Initialise the identification string. id = '' @@ -81,9 +91,9 @@ # The container. mol_cont = return_molecule(id) - # The is only one molecule and it is unnamed. - elif cdp.mol[0].name == None and len(cdp.mol) == 1: - mol_cont = cdp.mol[0] + # Get the unnamed molecule, assuming there is only one. + else: + mol_cont = return_molecule() # Add the molecule if it doesn't exist. if mol_cont == None: Modified: branches/ave_noe/test_suite/system_tests/structure.py URL: http://svn.gna.org/viewcvs/relax/branches/ave_noe/test_suite/system_tests/structure.py?rev=8190&r1=8189&r2=8190&view=diff ============================================================================== --- branches/ave_noe/test_suite/system_tests/structure.py (original) +++ branches/ave_noe/test_suite/system_tests/structure.py Thu Dec 11 11:15:46 2008 @@ -139,6 +139,12 @@ # Read the PDB. self.relax.interpreter._Structure.read_pdb(file='1F35_N_H_molmol.pdb', dir=path, parser='internal') + # Try loading a few protons. + self.relax.interpreter._Structure.load_spins('@*H*') + + # And now all the rest of the atoms. + self.relax.interpreter._Structure.load_spins() + def test_read_pdb_internal2(self): """Load the 'Ap4Aase_res1-12.pdb' PDB file (using the internal structural object PDB reader).""" @@ -149,6 +155,12 @@ # Read the PDB. self.relax.interpreter._Structure.read_pdb(file='Ap4Aase_res1-12.pdb', dir=path, parser='internal') + # Try loading a few protons. + self.relax.interpreter._Structure.load_spins('@*H*') + + # And now all the rest of the atoms. + self.relax.interpreter._Structure.load_spins() + def test_read_pdb_internal3(self): """Load the 'gromacs_phthalic_acid.pdb' PDB file (using the internal structural object PDB reader).""" @@ -159,6 +171,12 @@ # Read the PDB. self.relax.interpreter._Structure.read_pdb(file='gromacs_phthalic_acid.pdb', dir=path, parser='internal') + # Try loading a few protons. + self.relax.interpreter._Structure.load_spins('@*H*') + + # And now all the rest of the atoms. + self.relax.interpreter._Structure.load_spins() + def test_read_pdb_internal4(self): """Load the 'tylers_peptide_trunc.pdb' PDB file (using the internal structural object PDB reader).""" @@ -169,6 +187,12 @@ # Read the PDB. self.relax.interpreter._Structure.read_pdb(file='tylers_peptide_trunc.pdb', dir=path, parser='internal') + # Try loading a few protons. + self.relax.interpreter._Structure.load_spins('@*H*') + + # And now all the rest of the atoms. + self.relax.interpreter._Structure.load_spins() + def test_read_pdb_internal5(self): """Load the 'lactose_MCMM4_S1_1.pdb' PDB file (using the internal structural object PDB reader).""" @@ -179,6 +203,12 @@ # Read the PDB. self.relax.interpreter._Structure.read_pdb(file='lactose_MCMM4_S1_1.pdb', dir=path, parser='internal') + # Try loading a few protons. + self.relax.interpreter._Structure.load_spins('@*H*') + + # And now all the rest of the atoms. + self.relax.interpreter._Structure.load_spins() + def test_read_pdb_scientific1(self): """Load the '1F35_N_H_molmol.pdb' PDB file (using the Scientific python structural object PDB reader).""" @@ -189,6 +219,12 @@ # Read the PDB. self.relax.interpreter._Structure.read_pdb(file='1F35_N_H_molmol.pdb', dir=path, parser='scientific') + # Try loading a few protons. + self.relax.interpreter._Structure.load_spins('@*H*') + + # And now all the rest of the atoms. + self.relax.interpreter._Structure.load_spins() + def test_read_pdb_scientific2(self): """Load the 'Ap4Aase_res1-12.pdb' PDB file (using the Scientific python structural object PDB reader).""" @@ -199,6 +235,12 @@ # Read the PDB. self.relax.interpreter._Structure.read_pdb(file='Ap4Aase_res1-12.pdb', dir=path, parser='scientific') + # Try loading a few protons. + self.relax.interpreter._Structure.load_spins('@*H*') + + # And now all the rest of the atoms. + self.relax.interpreter._Structure.load_spins() + def test_read_pdb_scientific3(self): """Load the 'gromacs_phthalic_acid.pdb' PDB file (using the Scientific python structural object PDB reader).""" @@ -209,6 +251,12 @@ # Read the PDB. self.relax.interpreter._Structure.read_pdb(file='gromacs_phthalic_acid.pdb', dir=path, parser='scientific') + # Try loading a few protons. + self.relax.interpreter._Structure.load_spins('@*H*') + + # And now all the rest of the atoms. + self.relax.interpreter._Structure.load_spins() + def test_read_pdb_scientific4(self): """Load the 'tylers_peptide_trunc.pdb' PDB file (using the Scientific python structural object PDB reader).""" @@ -219,6 +267,12 @@ # Read the PDB. self.relax.interpreter._Structure.read_pdb(file='tylers_peptide_trunc.pdb', dir=path, parser='scientific') + # Try loading a few protons. + self.relax.interpreter._Structure.load_spins('@*H*') + + # And now all the rest of the atoms. + self.relax.interpreter._Structure.load_spins() + def test_read_pdb_scientific5(self): """Load the 'lactose_MCMM4_S1_1.pdb' PDB file (using the Scientific python structural object PDB reader).""" @@ -229,5 +283,8 @@ # Read the PDB. self.relax.interpreter._Structure.read_pdb(file='lactose_MCMM4_S1_1.pdb', dir=path, parser='scientific') - - + # Try loading a few protons. + self.relax.interpreter._Structure.load_spins('@*H*') + + # And now all the rest of the atoms. + self.relax.interpreter._Structure.load_spins()