Hi Troels,

I'm wondering if this change might be dangerous.  I think I have seen
Sparky assignments without the residue name.  Maybe the RelaxError
could be converted to a RelaxWarning and then you set the residue name
to None.  This should be more fail-safe without having to do any
testing.

Regards,

Edward



On 5 December 2013 22:48,  <[email protected]> wrote:
> 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):
>
>
> _______________________________________________
> relax (http://www.nmr-relax.com)
>
> This is the relax-commits mailing list
> [email protected]
>
> 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

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

This is the relax-devel mailing list
[email protected]

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-devel

Reply via email to