Author: bugman Date: Sun Nov 18 21:07:36 2007 New Revision: 3565 URL: http://svn.gna.org/viewcvs/relax?rev=3565&view=rev Log: Implemented the spin.rename() user function. Modified: 1.3/prompt/spin.py Modified: 1.3/prompt/spin.py URL: http://svn.gna.org/viewcvs/relax/1.3/prompt/spin.py?rev=3565&r1=3564&r2=3565&view=diff ============================================================================== --- 1.3/prompt/spin.py (original) +++ 1.3/prompt/spin.py Sun Nov 18 21:07:36 2007 @@ -222,13 +222,13 @@ spin.display(spin_id=spin_id) - def rename(self, res_id=None, new_name=None): - """Function for renaming an existent residue(s). - - Keyword Arguments - ~~~~~~~~~~~~~~~~~ - - res_id: The residue identification string corresponding to one or more residues. + def rename(self, spin_id=None, new_name=None): + """Function for renaming an existent spin(s). + + Keyword Arguments + ~~~~~~~~~~~~~~~~~ + + spin_id: The spin identification string corresponding to one or more spins. new_name: The new name. @@ -236,41 +236,37 @@ Description ~~~~~~~~~~~ - This function simply allows residues to be renamed. + This function simply allows spins to be renamed. Examples ~~~~~~~~ - The following sequence of commands will rename the sequence {1 ALA, 2 GLY, 3 LYS} to {1 XXX, - 2 XXX, 3 XXX}: - - relax> residue.rename(':1', 'XXX') - relax> residue.rename(':2', 'XXX') - relax> residue.rename(':3', 'XXX') - - Alternatively: - - relax> residue.rename(':1,2,3', 'XXX') - """ - - # Function intro text. - if self.__relax__.interpreter.intro: - text = sys.ps3 + "residue.rename(" - text = text + ", res_id=" + `res_id` + The following sequence of commands will rename the sequence {1 C1, 2 C2, 3 C3} to {1 C11, + 2 C12, 3 C13}: + + relax> spin.rename('@1', 'C11') + relax> spin.rename('@2', 'C12') + relax> spin.rename('@3', 'C13') + """ + + # Function intro text. + if self.__relax__.interpreter.intro: + text = sys.ps3 + "spin.rename(" + text = text + ", spin_id=" + `spin_id` text = text + ", new_name=" + `new_name` + ")" print text - # Residue identification string. - if type(res_id) != int: - raise RelaxIntError, ('residue identification string', res_id) - - # New residue name. + # Spin identification string. + if type(spin_id) != int: + raise RelaxIntError, ('spin identification string', spin_id) + + # New spin name. if type(new_name) != str: - raise RelaxStrError, ('new residue name', new_name) - - # Execute the functional code. - residue.create(res_num=res_num, new_name=new_name) + raise RelaxStrError, ('new spin name', new_name) + + # Execute the functional code. + spin.create(spin_num=spin_num, new_name=new_name) def renumber(self, res_id=None, new_number=None):