Author: bugman Date: Wed Mar 14 09:37:58 2007 New Revision: 3190 URL: http://svn.gna.org/viewcvs/relax?rev=3190&view=rev Log: Converted the Residue.create() method into a function of the 'generic_fns.residue' module. Modified: 1.3/generic_fns/residue.py Modified: 1.3/generic_fns/residue.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/residue.py?rev=3190&r1=3189&r2=3190&view=diff ============================================================================== --- 1.3/generic_fns/residue.py (original) +++ 1.3/generic_fns/residue.py Wed Mar 14 09:37:58 2007 @@ -30,35 +30,35 @@ +def create(self, res_num=None, res_name=None): + """Function for adding a residue into the relax data store.""" + + # Initialise the sequence data if no sequence currently exists. + if not relax_data_store.res.has_key(run): + # Add the run to 'relax_data_store.res'. + relax_data_store.res.add_list(run) + + # Test if the residue number already exists. + for i in xrange(len(relax_data_store.res[run])): + if relax_data_store.res[run][i].num == res_num: + raise RelaxError, "The residue number '" + `res_num` + "' already exists in the sequence." + + # Residue index. + index = len(relax_data_store.res[run]) + + # Append a data container. + relax_data_store.res[run].add_item() + + # Insert the data. + relax_data_store.res[run][index].num = res_num + relax_data_store.res[run][index].name = res_name + + class Residue: def __init__(self, relax): """Class containing functions specific to amino-acid sequence.""" self.relax = relax - - - def create(self, res_num=None, res_name=None): - """Function for adding a residue into the relax data store.""" - - # Initialise the sequence data if no sequence currently exists. - if not relax_data_store.res.has_key(run): - # Add the run to 'relax_data_store.res'. - relax_data_store.res.add_list(run) - - # Test if the residue number already exists. - for i in xrange(len(relax_data_store.res[run])): - if relax_data_store.res[run][i].num == res_num: - raise RelaxError, "The residue number '" + `res_num` + "' already exists in the sequence." - - # Residue index. - index = len(relax_data_store.res[run]) - - # Append a data container. - relax_data_store.res[run].add_item() - - # Insert the data. - relax_data_store.res[run][index].num = res_num - relax_data_store.res[run][index].name = res_name def copy(self, run1=None, run2=None):