mailr26179 - in /branches/frame_order_cleanup: ./ specific_analyses/relax_disp/ test_suite/shared_data/dispersion/HWebb_KTeilum_...


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on October 07, 2014 - 14:22:
Author: bugman
Date: Tue Oct  7 14:22:36 2014
New Revision: 26179

URL: http://svn.gna.org/viewcvs/relax?rev=26179&view=rev
Log:
Merged revisions 26143-26147 via svnmerge from 
svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk

........
  r26143 | tlinnet | 2014-10-03 18:30:33 +0200 (Fri, 03 Oct 2014) | 8 lines
  
  Added example CPMG data, which could possible be send for BMRB submission.
  
  The data is un-published CPMG data, related to the paper:
   - Webb H, Tynan-Connolly BM, Lee GM, Farrell D, O'Meara F, Soendergaard 
CR, Teilum K, Hewage C, McIntosh LP, Nielsen JE
   - Remeasuring HEWL pK(a) values by NMR spectroscopy: methods, analysis, 
accuracy, and implications for theoretical pK(a) calculations.
   - (2011), Proteins: Struct, Funct, Bioinf 79(3):685-702, DOI 
10.1002/prot.22886
  
  task #7858 (https://gna.org/task/?7858): Make it possible to submit CPMG 
experiments for BMRB
........
  r26144 | tlinnet | 2014-10-03 18:30:36 +0200 (Fri, 03 Oct 2014) | 3 lines
  
  Added systemtest Relax_disp.test_bmrb_sub_cpmg() to try calling the bmrb 
functions in relax.
  
  task #7858 (https://gna.org/task/?7858): Make it possible to submit CPMG 
experiments for BMRB
........
  r26145 | tlinnet | 2014-10-03 18:30:38 +0200 (Fri, 03 Oct 2014) | 3 lines
  
  Implemented the initial part of the API, to collect data for BMRB 
submission.
  
  task #7858 (https://gna.org/task/?7858): Make it possible to submit CPMG 
experiments for BMRB
........
  r26146 | tlinnet | 2014-10-03 18:30:40 +0200 (Fri, 03 Oct 2014) | 7 lines
  
  Inserted a "RelaxImplementError" when trying to call bmrb_write from a 
relaxation dispersion analysis.
  
  To implement the fucntion, it would require a re-write of the relax_data 
bmrb_write(star) function, and proper handling of cdp.ri_ids.
  It was also not readily possible to find examples of submitted CPMG data in 
the BMRB database.
  This makes it hard to develop, and even ensure that BMRB would accept the 
format.
  
  task #7858 (https://gna.org/task/?7858): Make it possible to submit CPMG 
experiments for BMRB
........
  r26147 | tlinnet | 2014-10-03 18:30:41 +0200 (Fri, 03 Oct 2014) | 5 lines
  
  Removed the systemtest Relax_disp.test_bmrb_sub_cpmg() to be tested in the 
test-suite.
  
  This test will not be implemented, as it requires a large re-write of data 
structures.
  
  task #7858 (https://gna.org/task/?7858): Make it possible to submit CPMG 
experiments for BMRB
........

Added:
    
branches/frame_order_cleanup/test_suite/shared_data/dispersion/HWebb_KTeilum_Proteins_Struct_Funct_Bioinf_2011/
      - copied from r26147, 
trunk/test_suite/shared_data/dispersion/HWebb_KTeilum_Proteins_Struct_Funct_Bioinf_2011/
Modified:
    branches/frame_order_cleanup/   (props changed)
    branches/frame_order_cleanup/specific_analyses/relax_disp/api.py
    branches/frame_order_cleanup/test_suite/system_tests/relax_disp.py

Propchange: branches/frame_order_cleanup/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Oct  7 14:22:36 2014
@@ -1 +1 @@
-/trunk:1-26139,26142
+/trunk:1-26139,26142-26147

Modified: branches/frame_order_cleanup/specific_analyses/relax_disp/api.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/specific_analyses/relax_disp/api.py?rev=26179&r1=26178&r2=26179&view=diff
==============================================================================
--- branches/frame_order_cleanup/specific_analyses/relax_disp/api.py    
(original)
+++ branches/frame_order_cleanup/specific_analyses/relax_disp/api.py    Tue 
Oct  7 14:22:36 2014
@@ -25,8 +25,11 @@
 """The relaxation dispersion API object."""
 
 # Python module imports.
+import bmrblib
 from copy import deepcopy
+from numpy import int32, zeros
 from re import match, search
+import string
 import sys
 from types import MethodType
 
@@ -36,9 +39,11 @@
 from lib.errors import RelaxError, RelaxImplementError
 from lib.text.sectioning import subsection
 from multi import Processor_box
-from pipe_control import pipes, sequence
-from pipe_control.mol_res_spin import check_mol_res_spin_data, return_spin, 
spin_loop
+from pipe_control import pipes, relax_data, sequence
+from pipe_control.exp_info import bmrb_write_citations, bmrb_write_methods, 
bmrb_write_software
+from pipe_control.mol_res_spin import bmrb_write_entity, 
check_mol_res_spin_data, get_molecule_names, return_spin, spin_loop
 from pipe_control.pipes import check_pipe
+from pipe_control.spectrometer import check_spectrometer_setup
 from pipe_control.sequence import return_attached_protons
 from specific_analyses.api_base import API_base
 from specific_analyses.api_common import API_common
@@ -120,6 +125,121 @@
 
                 # Yield the spin container and ID.
                 yield spin, spin_id
+
+
+    def bmrb_write(self, file_path, version=None):
+        """Write the model-free results to a BMRB NMR-STAR v3.1 formatted 
file.
+
+        @param file_path:   The full file path.
+        @type file_path:    str
+        @keyword version:   The BMRB NMR-STAR dictionary format to output to.
+        @type version:      str
+        """
+
+        # This function is not yet implemented, as it would require a 
re-write of the relax_data bmrb_write(star) function, and proper handling of 
cdp.ri_ids.
+        # It was also not readily possible to find examples of submitted 
CPMG data in the BMRB database.
+
+        # Not implemented.
+        raise RelaxImplementError('bmrb_write')
+
+        # Checks.
+        check_spectrometer_setup(escalate=2)
+
+        # Alias the current data pipe.
+        cdp = pipes.get_pipe()
+
+        # Initialise the NMR-STAR data object.
+        star = 
bmrblib.create_nmr_star('relax_relaxation_dispersion_results', file_path, 
version)
+
+        # Initialise the spin specific data lists.
+        mol_name_list = []
+        res_num_list = []
+        res_name_list = []
+        atom_name_list = []
+
+        isotope_list = []
+        element_list = []
+
+        chi2_list = []
+        model_list = []
+
+        # Store the spin specific data in lists for later use.
+        for spin, mol_name, res_num, res_name, spin_id in 
spin_loop(full_info=True, return_id=True):
+            # Skip the protons.
+            if spin.name == 'H' or (hasattr(spin, 'element') and 
spin.element == 'H'):
+                warn(RelaxWarning("Skipping the proton spin '%s'." % 
spin_id))
+                continue
+
+            # Check the data for None (not allowed in BMRB!).
+            if res_num == None:
+                raise RelaxError("For the BMRB, the residue of spin '%s' 
must be numbered." % spin_id)
+            if res_name == None:
+                raise RelaxError("For the BMRB, the residue of spin '%s' 
must be named." % spin_id)
+            if spin.name == None:
+                raise RelaxError("For the BMRB, the spin '%s' must be 
named." % spin_id)
+            if not hasattr(spin, 'isotope') or spin.isotope == None:
+                raise RelaxError("For the BMRB, the spin isotope type of 
'%s' must be specified." % spin_id)
+            if not hasattr(spin, 'element') or spin.element == None:
+                raise RelaxError("For the BMRB, the spin element type of 
'%s' must be specified.  Please use the spin user function for setting the 
element type." % spin_id)
+
+            # The molecule/residue/spin info.
+            mol_name_list.append(mol_name)
+            res_num_list.append(res_num)
+            res_name_list.append(res_name)
+            atom_name_list.append(spin.name)
+
+            # The nuclear isotope.
+            if hasattr(spin, 'isotope'):
+                
isotope_list.append(int(spin.isotope.strip(string.ascii_letters)))
+            else:
+                isotope_list.append(None)
+
+            # The element.
+            if hasattr(spin, 'element'):
+                element_list.append(spin.element)
+            else:
+                element_list.append(None)
+
+            # Opt stats.
+            if hasattr(spin, 'chi2'):
+                chi2_list.append(spin.chi2)
+            else:
+                chi2_list.append(None)
+
+            # Model-free model.
+            model_list.append(spin.model)
+
+        # Convert the molecule names into the entity IDs.
+        entity_ids = zeros(len(mol_name_list), int32)
+        mol_names = get_molecule_names()
+        for i in range(len(mol_name_list)):
+            for j in range(len(mol_names)):
+                if mol_name_list[i] == mol_names[j]:
+                    entity_ids[i] = j+1
+
+
+        # Create Supergroup 2 : The citations.
+        ######################################
+
+        # Generate the citations saveframe.
+        bmrb_write_citations(star)
+
+
+        # Create Supergroup 3 : The molecular assembly saveframes.
+        ##########################################################
+
+        # Generate the entity saveframe.
+        bmrb_write_entity(star)
+
+
+        # Create Supergroup 4:  The experimental descriptions saveframes.
+        #################################################################
+
+        # Generate the method saveframes.
+        bmrb_write_methods(star)
+
+        # Generate the software saveframe.
+        software_ids, software_labels = bmrb_write_software(star)
 
 
     def calculate(self, spin_id=None, scaling_matrix=None, verbosity=1, 
sim_index=None):

Modified: branches/frame_order_cleanup/test_suite/system_tests/relax_disp.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/test_suite/system_tests/relax_disp.py?rev=26179&r1=26178&r2=26179&view=diff
==============================================================================
--- branches/frame_order_cleanup/test_suite/system_tests/relax_disp.py  
(original)
+++ branches/frame_order_cleanup/test_suite/system_tests/relax_disp.py  Tue 
Oct  7 14:22:36 2014
@@ -1223,6 +1223,43 @@
         self.assertAlmostEqual(cdp.mol[0].res[0].spin[0].dw, dw_ppm, 6)
         self.assertAlmostEqual(cdp.mol[0].res[0].spin[0].pA, 1-pb, 6)
         self.assertAlmostEqual(cdp.mol[0].res[0].spin[0].kex, kex, 2)
+
+
+    def x_test_bmrb_sub_cpmg(self):
+        """U{Task #7858: <https://gna.org/task/?7858>} Make it possible to 
submit CPMG experiments for BMRB.
+        This uses CPMG data from:
+
+            Webb H, Tynan-Connolly BM, Lee GM, Farrell D, O'Meara F, 
Soendergaard CR, Teilum K, Hewage C, McIntosh LP, Nielsen JE
+            Remeasuring HEWL pK(a) values by NMR spectroscopy: methods, 
analysis, accuracy, and implications for theoretical pK(a) calculations.
+            (2011), Proteins: Struct, Funct, Bioinf 79(3):685-702, DOI 
10.1002/prot.22886
+        """
+
+        # Define path to data 
+        prev_data_path = status.install_path + 
sep+'test_suite'+sep+'shared_data'+sep+'dispersion'+sep+'HWebb_KTeilum_Proteins_Struct_Funct_Bioinf_2011'
+
+        # Read data.
+        self.interpreter.results.read(prev_data_path + sep + 
'FT_-_CR72_-_min_-_128_-_free_spins')
+
+        # Set element
+        self.interpreter.spin.element(element='N', spin_id=':*@N', 
force=False)
+        #self.interpreter.spin.isotope(isotope='15N', spin_id=':*@N', 
force=False)
+        # Rename molecule from None to 'HEWL'
+        self.interpreter.molecule.name(mol_id=None, name='HEWL', force=True)
+        self.interpreter.molecule.type(mol_id='#HEWL', type='protein', 
force=False)
+
+        for cur_spin, mol_name, resi, resn, spin_id in 
spin_loop(full_info=True, return_id=True, skip_desel=True):
+            print(spin_id)
+            if resn == 'C':
+                print(resi, resn)
+
+        # Select the thiol state of the system.
+        # 'all disulfide bound', 'all free', 'all other bound', 'disulfide 
and other bound', 'free and disulfide bound', 'free and other bound', 'free 
disulfide and other bound', 'not available', 'not present', 'not reported', 
'unknown'
+        self.interpreter.bmrb.thiol_state(state='not reported')
+
+        # relax_data.temp_calibration(ri_id=None, method=None)
+
+        # Call display of bmrb.
+        self.interpreter.bmrb.display()
 
 
     def test_bug_21081_disp_cluster_fail(self):




Related Messages


Powered by MHonArc, Updated Tue Oct 07 14:40:02 2014