Author: tlinnet Date: Fri Dec 6 19:24:02 2013 New Revision: 21851 URL: http://svn.gna.org/viewcvs/relax?rev=21851&view=rev Log: Implemented reading of chemical shifts from NMRPipe SeriesTab formatted files. 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=21851&r1=21850&r2=21851&view=diff ============================================================================== --- trunk/lib/spectrum/nmrpipe.py (original) +++ trunk/lib/spectrum/nmrpipe.py Fri Dec 6 19:24:02 2013 @@ -80,6 +80,16 @@ # Find index of assignment ASS. ass_i = varsline.index('ASS') + # Chemical shifts preparation. + w1_col = None + w2_col = None + + # Find index of chemical shift Y_PPM which in sparky is w1. + w1_col = varsline.index('Y_PPM') + + # Find index of chemical shift X_PPM which in sparky is w2. + w2_col = varsline.index('X_PPM') + # Make a regular search for Z_A entries. Z_A = re.compile("Z_A*") spectra = list(filter(Z_A.search, varsline)) @@ -160,5 +170,19 @@ except ValueError: raise RelaxError("The peak intensity value %s from the line %s is invalid." % (intensity, line)) + # Chemical shifts. + w1 = None + w2 = None + if w1_col != None: + try: + w1 = float(line[w1_col]) + except ValueError: + raise RelaxError("The chemical shift from the line %s is invalid." % line) + if w2_col != None: + try: + w2 = float(line[w2_col]) + except ValueError: + raise RelaxError("The chemical shift from the line %s is invalid." % line) + # Add the assignment to the peak list object. - peak_list.add(res_nums=[res_num1, res_num2], res_names=[res_name1, res_name2], spin_names=[name1, name2], intensity=intensities, intensity_name=spectra) + peak_list.add(res_nums=[res_num1, res_num2], res_names=[res_name1, res_name2], spin_names=[name1, name2], shifts=[w1, w2], intensity=intensities, intensity_name=spectra)