mailRe: r21949 - in /trunk: lib/spectrum/sparky.py test_suite/system_tests/peak_lists.py


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

Header


Content

Posted by Edward d'Auvergne on December 12, 2013 - 11:26:
Hi Troels,

What do you think about the 3D and 4D lists, especially the code such
as "res_nums=[res_num1, res_num2, res_num1, res_num1]"?  This seems to
be a little counter to the algorithm you have implemented.  Maybe you
need to nest this so that if you get an residue number for the second
dimension, then you should try to get the residue number for the 3rd
and 4th dimensions, if 'dim' is set to that.  It is probably safe to
assume two formats.  One where the residue name and number is only
located in the first part, and the other where the residue name and
number is found in each part for each dimension.  But I don't have
enough experience with 3D and 4D sparky peak lists to tell.  Actually,
according to the Sparky manual you can have 'C30CA-Q31N-H':

http://www.cgl.ucsf.edu/home/sparky/manual/images/assignlist.gif

That really complicates things!  That format is repeated here:

http://www.nmr2.buffalo.edu/nesg.wiki/Sparky#Figure_5:_Sparky_peak_list

From these, maybe the res_num and res_name should be set to the 2nd
dimension for the 3rd and 4th dimensions.  Here is an example where
the 3rd dimension matches the 1st:

http://pine.nmrfam.wisc.edu/ADAPT-NMR/sparky_peak_list.htm

That has a peak list which could be copied (duplicated below).  But
this has the residue number and name in the 3rd dimension to show
this.  So if the information is missing in the Nth dimension, it
should probably match the dimension N-1.  What do you think?

Regards,

Edward


P. S.  For reference, here are the peak lists from
http://pine.nmrfam.wisc.edu/ADAPT-NMR/sparky_peak_list.htm, just in
case that link disappears:


a)     Non-assigned peak list

Assignment     w1       w2        w3
   ?-?-?     7.826    32.039    116.080
   ?-?-?     9.324    29.130    116.029
   ?-?-?     8.868    36.809    127.984
   ?-?-?     8.372    58.423    118.945
   ?-?-?     8.111    28.686    120.113
   ?-?-?     8.136    32.232    119.999
   ?-?-?     9.072    52.226    118.013
   ?-?-?     6.581    40.419    111.959
   ?-?-?     7.826    59.383    116.080

b)    Assigned  peak list

           Assignment         w1         w2         w3
       C16H-K15CB-C16N      7.826     32.039    116.080
        N10H-E9CB-N10N      9.324     29.130    116.029
          V7H-K6CB-V7N      8.868     36.809    127.984
       C24H-Q23CA-C24N      8.372     58.423    118.945
       K44H-E43CB-K44N      8.111     28.686    120.113
       L30H-K29CB-L30N      8.136     32.232    119.999
       E43H-D42CA-E43N      9.072     52.226    118.013
       K32H-D31CB-K32N      6.581     40.419    111.959
       C16H-K15CA-C16N      7.826     59.383    116.080



On 12 December 2013 11:02,  <tlinnet@xxxxxxxxxxxxx> wrote:
Author: tlinnet
Date: Thu Dec 12 11:02:00 2013
New Revision: 21949

URL: http://svn.gna.org/viewcvs/relax?rev=21949&view=rev
Log:
Implemented to read spins from a SPARKY list, when no intensity column is 
present.

Addition to Support Request #3044, (https://gna.org/support/index.php?3044) 
- Load spins from SPARKY list.

Modified:
    trunk/lib/spectrum/sparky.py
    trunk/test_suite/system_tests/peak_lists.py

Modified: trunk/lib/spectrum/sparky.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/lib/spectrum/sparky.py?rev=21949&r1=21948&r2=21949&view=diff
==============================================================================
--- trunk/lib/spectrum/sparky.py (original)
+++ trunk/lib/spectrum/sparky.py Thu Dec 12 11:02:00 2013
@@ -204,15 +204,29 @@
             except ValueError:
                 raise RelaxError("The peak intensity value from the line 
%s is invalid." % line)

-        # Add the assignment to the peak list object.
-        if dim == 1:
-            peak_list.add(res_nums=[res_num1], res_names=[res_name1], 
spin_names=[name1], shifts=[w1], intensity=intensity)
-        elif dim == 2:
-            peak_list.add(res_nums=[res_num1, res_num2], 
res_names=[res_name1, res_name2], spin_names=[name1, name2], shifts=[w1, 
w2], intensity=intensity)
-        elif dim == 3:
-            peak_list.add(res_nums=[res_num1, res_num2, res_num1], 
res_names=[res_name1, res_name2, res_name1], spin_names=[name1, name2, 
name3], shifts=[w1, w2, w3], intensity=intensity)
-        elif dim == 4:
-            peak_list.add(res_nums=[res_num1, res_num2, res_num1, 
res_num1], res_names=[res_name1, res_name2, res_name1, res_name1], 
spin_names=[name1, name2, name3, name4], shifts=[w1, w2, w3, w4], 
intensity=intensity)
+            # Add the assignment to the peak list object.
+            if dim == 1:
+                peak_list.add(res_nums=[res_num1], res_names=[res_name1], 
spin_names=[name1], shifts=[w1], intensity=intensity)
+            elif dim == 2:
+                peak_list.add(res_nums=[res_num1, res_num2], 
res_names=[res_name1, res_name2], spin_names=[name1, name2], shifts=[w1, 
w2], intensity=intensity)
+            elif dim == 3:
+                peak_list.add(res_nums=[res_num1, res_num2, res_num1], 
res_names=[res_name1, res_name2, res_name1], spin_names=[name1, name2, 
name3], shifts=[w1, w2, w3], intensity=intensity)
+            elif dim == 4:
+                peak_list.add(res_nums=[res_num1, res_num2, res_num1, 
res_num1], res_names=[res_name1, res_name2, res_name1, res_name1], 
spin_names=[name1, name2, name3, name4], shifts=[w1, w2, w3, w4], 
intensity=intensity)
+
+        # If no intensity column, for example when reading spins from a 
spectrum list.
+        elif int_col == None:
+            warn(RelaxWarning(("The peak intensity value from the line %s 
is invalid. The return value will be without intensity." % line)))
+
+            # Add the assignment to the peak list object.
+            if dim == 1:
+                peak_list.add(res_nums=[res_num1], res_names=[res_name1], 
spin_names=[name1], shifts=[w1])
+            elif dim == 2:
+                peak_list.add(res_nums=[res_num1, res_num2], 
res_names=[res_name1, res_name2], spin_names=[name1, name2], shifts=[w1, 
w2])
+            elif dim == 3:
+                peak_list.add(res_nums=[res_num1, res_num2, res_num1], 
res_names=[res_name1, res_name2, res_name1], spin_names=[name1, name2, 
name3], shifts=[w1, w2, w3])
+            elif dim == 4:
+                peak_list.add(res_nums=[res_num1, res_num2, res_num1, 
res_num1], res_names=[res_name1, res_name2, res_name1, res_name1], 
spin_names=[name1, name2, name3, name4], shifts=[w1, w2, w3, w4])


 def write_list(file_prefix=None, dir=None, res_names=None, res_nums=None, 
atom1_names=None, atom2_names=None, w1=None, w2=None, data_height=None, 
force=True):

Modified: trunk/test_suite/system_tests/peak_lists.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/test_suite/system_tests/peak_lists.py?rev=21949&r1=21948&r2=21949&view=diff
==============================================================================
--- trunk/test_suite/system_tests/peak_lists.py (original)
+++ trunk/test_suite/system_tests/peak_lists.py Thu Dec 12 11:02:00 2013
@@ -456,6 +456,76 @@
         # Read the spins from peak list.
         self.interpreter.spectrum.read_spins(file="sparky2dim.list", 
dir=status.install_path + 
sep+'test_suite'+sep+'shared_data'+sep+'peak_lists', dim=1)
         self.interpreter.spectrum.read_spins(file="sparky2dim.list", 
dir=status.install_path + 
sep+'test_suite'+sep+'shared_data'+sep+'peak_lists', dim=2)
+
+        # Test some of the sequence.
+        self.assertEqual(len(cdp.mol), 1)
+        self.assertEqual(cdp.mol[0].name, None)
+        self.assertEqual(len(cdp.mol[0].res), 7)
+
+        # 1st residue.
+        self.assertEqual(cdp.mol[0].res[0].num, 62)
+        self.assertEqual(cdp.mol[0].res[0].name, 'W')
+        self.assertEqual(len(cdp.mol[0].res[0].spin), 2)
+        self.assertEqual(cdp.mol[0].res[0].spin[0].num, None)
+        self.assertEqual(cdp.mol[0].res[0].spin[0].name, 'NE1')
+        self.assertEqual(cdp.mol[0].res[0].spin[1].num, None)
+        self.assertEqual(cdp.mol[0].res[0].spin[1].name, 'HE1')
+
+        # 2nd residue.
+        self.assertEqual(cdp.mol[0].res[1].num, 10)
+        self.assertEqual(cdp.mol[0].res[1].name, 'L')
+        self.assertEqual(len(cdp.mol[0].res[1].spin), 2)
+        self.assertEqual(cdp.mol[0].res[1].spin[0].num, None)
+        self.assertEqual(cdp.mol[0].res[1].spin[0].name, 'N')
+        self.assertEqual(cdp.mol[0].res[1].spin[1].num, None)
+        self.assertEqual(cdp.mol[0].res[1].spin[1].name, 'HN')
+
+        # 3rd residue.
+        self.assertEqual(cdp.mol[0].res[2].num, 6)
+        self.assertEqual(cdp.mol[0].res[2].name, 'V')
+        self.assertEqual(len(cdp.mol[0].res[2].spin), 2)
+        self.assertEqual(cdp.mol[0].res[2].spin[0].num, None)
+        self.assertEqual(cdp.mol[0].res[2].spin[0].name, 'N')
+        self.assertEqual(cdp.mol[0].res[2].spin[1].num, None)
+        self.assertEqual(cdp.mol[0].res[2].spin[1].name, 'HN')
+
+        # 4th residue.
+        self.assertEqual(cdp.mol[0].res[3].num, 2)
+        self.assertEqual(cdp.mol[0].res[3].name, 'T')
+        self.assertEqual(len(cdp.mol[0].res[3].spin), 2)
+        self.assertEqual(cdp.mol[0].res[3].spin[0].num, None)
+        self.assertEqual(cdp.mol[0].res[3].spin[0].name, 'N')
+        self.assertEqual(cdp.mol[0].res[3].spin[1].num, None)
+        self.assertEqual(cdp.mol[0].res[3].spin[1].name, 'HN')
+
+        # 5th residue.
+        self.assertEqual(cdp.mol[0].res[4].num, 3)
+        self.assertEqual(cdp.mol[0].res[4].name, 'K')
+        self.assertEqual(len(cdp.mol[0].res[4].spin), 1)
+        self.assertEqual(cdp.mol[0].res[4].spin[0].num, None)
+        self.assertEqual(cdp.mol[0].res[4].spin[0].name, 'N')
+
+        # 6th residue.
+        self.assertEqual(cdp.mol[0].res[5].num, 4)
+        self.assertEqual(cdp.mol[0].res[5].name, 'A')
+        self.assertEqual(len(cdp.mol[0].res[5].spin), 1)
+        self.assertEqual(cdp.mol[0].res[5].spin[0].num, None)
+        self.assertEqual(cdp.mol[0].res[5].spin[0].name, 'N')
+
+        # 7th residue.
+        self.assertEqual(cdp.mol[0].res[6].num, 5)
+        self.assertEqual(cdp.mol[0].res[6].name, 'V')
+        self.assertEqual(len(cdp.mol[0].res[6].spin), 1)
+        self.assertEqual(cdp.mol[0].res[6].spin[0].num, None)
+        self.assertEqual(cdp.mol[0].res[6].spin[0].name, 'N')
+
+
+    def test_read_spins_peak_list_sparky_with_no_int_col(self):
+        """Test the reading of spins from a Sparky peak list with no 
intensity column."""
+
+        # Read the spins from peak list.
+        self.interpreter.spectrum.read_spins(file="sparky_wo_int.list", 
dir=status.install_path + 
sep+'test_suite'+sep+'shared_data'+sep+'peak_lists', dim=1)
+        self.interpreter.spectrum.read_spins(file="sparky_wo_int.list", 
dir=status.install_path + 
sep+'test_suite'+sep+'shared_data'+sep+'peak_lists', dim=2)

         # Test some of the sequence.
         self.assertEqual(len(cdp.mol), 1)


_______________________________________________
relax (http://www.nmr-relax.com)

This is the relax-commits mailing list
relax-commits@xxxxxxx

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits



Related Messages


Powered by MHonArc, Updated Fri Dec 13 14:40:10 2013