Author: tlinnet
Date: Fri Dec  6 12:09:56 2013
New Revision: 21825

URL: http://svn.gna.org/viewcvs/relax?rev=21825&view=rev
Log:
Fixed for reading spins from a NMRPipe SeriesTab formatted file, where 
dimension 2 misses residue number and residue name.

Work in progress for Support Request #3044, 
(https://gna.org/support/index.php?3044) - Load spins from SPARKY list.

Modified:
    trunk/lib/spectrum/nmrpipe.py

Modified: trunk/lib/spectrum/nmrpipe.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/lib/spectrum/nmrpipe.py?rev=21825&r1=21824&r2=21825&view=diff
==============================================================================
--- trunk/lib/spectrum/nmrpipe.py (original)
+++ trunk/lib/spectrum/nmrpipe.py Fri Dec  6 12:09:56 2013
@@ -109,25 +109,32 @@
         row2 = re.split('([a-zA-Z]+)', assign2)
         name2 = row2[-2] + row2[-1]
 
-        # Get the residue number.
+        # Get the residue number for dimension 1.
         try:
             res_num1 = int(row1[-3])
+        except:
+            raise RelaxError("Improperly formatted NMRPipe SeriesTab file, 
cannot process the residue number for dimension 1 in assignment: %s." % line[0])
+
+        # Get the residue number for dimension 2.
+        try:
             res_num2 = int(row2[-3])
         except:
-            raise RelaxError("Improperly formatted NMRPipe SeriesTab file, 
cannot process the assignment '%s'." % line[0])
+            # We cannot always expect dimension 2 to have residue number.
+            warn(RelaxWarning("Improperly formatted NMRPipe SeriesTab file, 
cannot process the residue number for dimension 2 in assignment: %s. Setting 
residue number to None." % line[0]))
+            res_num2 = None
 
         # The residue name for dimension 1.
         try:
             res_name1 = row1[-4]
         except:
-            warn(RelaxWarning("Improperly formatted NMRPipe SeriesTab file, 
cannot process the assignment '%s' for residue name dimension 1. Setting 
residue name to None." % line[0]))
+            warn(RelaxWarning("Improperly formatted NMRPipe SeriesTab file, 
cannot process the residue name for dimension 1 in assignment: %s." % line[0]))
             res_name1 = None
 
         # The residue name for dimension 2.
         try:
             res_name2 = row2[-4]
         except:
-            raise warn(RelaxWarning("Improperly formatted NMRPipe SeriesTab 
file, cannot process the assignment '%s' for residue name dimension 2.\nSetting 
residue name to None." % line[0]))
+            warn(RelaxWarning("Improperly formatted NMRPipe SeriesTab file, 
cannot process the residue name for dimension 2 in assignment: %s. Setting 
residue name to None." % line[0]))
             res_name2 = None
 
         # Get the intensities.


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

This is the relax-commits mailing list
relax-commits@gna.org

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

Reply via email to