mailr12620 - /1.3/test_suite/shared_data/pdc_files/convert_data_noe.py


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

Header


Content

Posted by edward on February 24, 2011 - 12:48:
Author: bugman
Date: Thu Feb 24 12:48:03 2011
New Revision: 12620

URL: http://svn.gna.org/viewcvs/relax?rev=12620&view=rev
Log:
The PDC NOE conversion script is now taking the data directly from the PDC 
file.


Modified:
    1.3/test_suite/shared_data/pdc_files/convert_data_noe.py

Modified: 1.3/test_suite/shared_data/pdc_files/convert_data_noe.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/test_suite/shared_data/pdc_files/convert_data_noe.py?rev=12620&r1=12619&r2=12620&view=diff
==============================================================================
--- 1.3/test_suite/shared_data/pdc_files/convert_data_noe.py (original)
+++ 1.3/test_suite/shared_data/pdc_files/convert_data_noe.py Thu Feb 24 
12:48:03 2011
@@ -1,84 +1,60 @@
 #! /usr/bin/env python
 
-# The PDC data.
-data = [
-['Gln',  2,     122.508,       8.898,     0.694,   0.00027],
-['Ile',  3,     114.800,       8.280,     0.706,   0.00030],
-['Phe',  4,     118.172,       8.565,     0.755,   0.00032],
-['Val',  5,     120.902,       9.256,     0.736,   0.00029],
-['Lys',  6,     127.647,       8.914,     0.726,   0.00029],
-['Thr',  7,     115.121,       8.703,     0.739,   0.00027],
-['Leu',  8,     120.902,       9.061,     0.690,   0.00032],
-['Thr',  9,     105.486,       7.596,     0.607,   0.00031],
-['Gly', 10,     108.858,       7.784,     0.582,   0.00019],
-['Lys', 11,     121.545,       7.230,     0.548,   0.00022],
-['Thr', 12,     120.260,       8.589,     0.660,   0.00022],
-['Ile', 13,     127.326,       9.508,     0.746,   0.00033],
-['Thr', 14,     121.223,       8.679,     0.759,   0.00025],
-['Leu', 15,     124.756,       8.695,     0.776,   0.00031],
-['Glu', 16,     122.131,       8.081,     0.763,   0.00019],
-['Val', 17,     117.209,       8.898,     0.716,   0.00028],
-['Glu', 18,     118.975,       8.630,     0.695,   0.00025],
-['Ser', 20,     103.077,       6.994,     0.720,   0.00026],
-['Asp', 21,     123.472,       8.003,     0.756,   0.00020],
-['Thr', 22,     108.697,       7.832,     0.704,   0.00029],
-['Ile', 23,     120.902,       8.483,     0.695,   0.00039],
-['Asn', 25,     121.063,       7.889,     0.737,   0.00035],
-['Val', 26,     122.026,       8.076,     0.667,   0.00016],
-['Lys', 27,     118.654,       8.516,     0.760,   0.00036],
-['Ala', 28,     123.151,       7.946,     0.752,   0.00034],
-['Lys', 29,     119.778,       7.824,     0.746,   0.00040],
-['Thr', 30,     120.902,       8.247,     0.734,   0.00030],
-['Gln', 31,     123.151,       8.516,     0.740,   0.00022],
-['Asp', 32,     119.457,       7.979,     0.736,   0.00028],
-['Lys', 33,     115.121,       7.393,     0.766,   0.00031],
-['Glu', 34,     113.997,       8.687,     0.731,   0.00026],
-['Gly', 35,     108.537,       8.459,     0.778,   0.00025],
-['Ile', 36,     119.939,       6.124,     0.791,   0.00026],
-['Asp', 39,     113.194,       8.483,     0.769,   0.00027],
-['Gln', 40,     116.566,       7.784,     0.758,   0.00029],
-['Gln', 41,     117.690,       7.434,     0.769,   0.00033],
-['Arg', 42,     122.669,       8.467,     0.755,   0.00034],
-['Leu', 43,     124.114,       8.776,     0.761,   0.00037],
-['Ile', 44,     122.026,       9.085,     0.750,   0.00038],
-['Phe', 45,     124.756,       8.809,     0.777,   0.00039],
-['Ala', 46,     132.465,       8.931,     0.749,   0.00055],
-['Gly', 47,     102.113,       8.052,     0.752,   0.00029],
-['Lys', 48,     121.705,       7.946,     0.709,   0.00030],
-['Gln', 49,     122.669,       8.589,     0.619,   0.00025],
-['Leu', 50,     125.399,       8.516,     0.727,   0.00041],
-['Glu', 51,     122.829,       8.337,     0.724,   0.00038],
-['Asp', 52,     119.939,       8.109,     0.779,   0.00033],
-['Arg', 54,     118.975,       7.426,     0.781,   0.00038],
-['Thr', 55,     108.537,       8.792,     0.762,   0.00034],
-['Leu', 56,     117.690,       8.109,     0.769,   0.00033],
-['Ser', 57,     113.194,       8.434,     0.787,   0.00028],
-['Asp', 58,     124.114,       7.897,     0.735,   0.00028],
-['Tyr', 59,     115.442,       7.222,     0.742,   0.00028],
-['Asn', 60,     115.603,       8.109,     0.768,   0.00024],
-['Ile', 61,     118.493,       7.206,     0.737,   0.00036],
-['Gln', 62,     124.596,       7.572,     0.605,   0.00029],
-['Lys', 63,     120.260,       8.434,     0.796,   0.00027],
-['Glu', 64,     114.318,       9.272,     0.717,   0.00034],
-['Ser', 65,     114.639,       7.629,     0.722,   0.00029],
-['Thr', 66,     117.048,       8.670,     0.695,   0.00024],
-['Leu', 67,     127.486,       9.378,     0.758,   0.00033],
-['His', 68,     119.136,       9.191,     0.729,   0.00040],
-['Leu', 69,     123.632,       8.255,     0.666,   0.00027],
-['Val', 70,     126.362,       9.134,     0.734,   0.00038],
-['Leu', 71,     122.829,       8.052,     0.727,   0.00027],
-['Arg', 72,     123.472,       8.557,     0.620,   0.00021],
-['Leu', 73,     124.114,       8.288,     0.340,   0.00017],
-['Arg', 74,     121.545,       8.378,     0.165,   0.00020],
-['Gly', 75,     110.624,       8.426,    -0.432,   0.00028],
-['Gly', 76,     114.639,       7.889,     -1.30,   0.00032]]
+from string import split, strip
 
+
+# The file data.
+file = open('testNOE.txt')
+lines = file.readlines()
+file.close()
+
+# Get the data.
+data = []
+in_data = False
+index = 0
+for line in lines:
+    # Split the line.
+    row = split(line, "\t")
+
+    # Strip the rubbish.
+    for j in range(len(row)):
+        row[j] = strip(row[j])
+
+    # Empty line.
+    if len(row) == 0:
+        continue
+
+    # The section.
+    if row[0] == 'SECTION:' and row[1] == 'results':
+        in_data = True
+        continue
+
+    # Not in the data section.
+    if not in_data:
+        continue
+
+    # The header line.
+    if row[0] == 'Peak name':
+        continue
+
+    # The residue name and number.
+    res_name, res_num = split(row[0])
+
+    # The values.
+    data.append([])
+    data[index].append(res_name)
+    data[index].append(int(res_num[1:-1]))
+    data[index].append(float(row[3]))
+    data[index].append(float(row[4]))
+
+    # Increment the residue index.
+    index += 1
 
 noe = []
 noe_err = []
 for i in range(len(data)):
-    noe.append(data[i][4])
-    noe_err.append(data[i][5])
+    noe.append(data[i][2])
+    noe_err.append(data[i][3])
 
 print("\nnoe = %s" % noe)
 print("\nnoe_err = %s" % noe_err)




Related Messages


Powered by MHonArc, Updated Thu Feb 24 13:00:02 2011