Author: tlinnet Date: Thu Dec 5 22:48:16 2013 New Revision: 21800 URL: http://svn.gna.org/viewcvs/relax?rev=21800&view=rev Log: Extended reading of sparky files, to include residue names. Work in progress for Support Request #3044, (https://gna.org/support/index.php?3044) - Load spins from SPARKY list. Modified: trunk/lib/spectrum/sparky.py Modified: trunk/lib/spectrum/sparky.py URL: http://svn.gna.org/viewcvs/relax/trunk/lib/spectrum/sparky.py?rev=21800&r1=21799&r2=21800&view=diff ============================================================================== --- trunk/lib/spectrum/sparky.py (original) +++ trunk/lib/spectrum/sparky.py Thu Dec 5 22:48:16 2013 @@ -130,6 +130,12 @@ except: raise RelaxError("Improperly formatted Sparky file, cannot process the assignment '%s'." % line[0]) + # The residue name. + try: + res_name = row1[-4] + except: + raise RelaxError("Improperly formatted Sparky file, cannot process the assignment '%s' for residue name." % line[0]) + # Chemical shifts. w1 = None w2 = None @@ -165,13 +171,13 @@ # Add the assignment to the peak list object. if dim == 1: - peak_list.add(res_nums=[res_num], spin_names=[name1], shifts=[w1], intensity=intensity) + peak_list.add(res_nums=[res_num], res_names=[res_name], spin_names=[name1], shifts=[w1], intensity=intensity) elif dim == 2: - peak_list.add(res_nums=[res_num, res_num], spin_names=[name1, name2], shifts=[w1, w2], intensity=intensity) + peak_list.add(res_nums=[res_num, res_num], res_names=[res_name, res_name], spin_names=[name1, name2], shifts=[w1, w2], intensity=intensity) elif dim == 3: - peak_list.add(res_nums=[res_num, res_num, res_num], spin_names=[name1, name2, name3], shifts=[w1, w2, w3], intensity=intensity) + peak_list.add(res_nums=[res_num, res_num, res_num], res_names=[res_name, res_name, res_name], spin_names=[name1, name2, name3], shifts=[w1, w2, w3], intensity=intensity) elif dim == 4: - peak_list.add(res_nums=[res_num, res_num, res_num, res_num], spin_names=[name1, name2, name3, name4], shifts=[w1, w2, w3, w4], intensity=intensity) + peak_list.add(res_nums=[res_num, res_num, res_num, res_num], res_names=[res_name, res_name, res_name, res_name], spin_names=[name1, name2, name3, name4], shifts=[w1, w2, w3, w4], intensity=intensity) 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):