Author: bugman Date: Sun Nov 4 13:57:38 2007 New Revision: 3403 URL: http://svn.gna.org/viewcvs/relax?rev=3403&view=rev Log: Added the residue.rename() user function. Modified: 1.3/prompt/residue.py Modified: 1.3/prompt/residue.py URL: http://svn.gna.org/viewcvs/relax/1.3/prompt/residue.py?rev=3403&r1=3402&r2=3403&view=diff ============================================================================== --- 1.3/prompt/residue.py (original) +++ 1.3/prompt/residue.py Sun Nov 4 13:57:38 2007 @@ -221,6 +221,57 @@ self.__relax__.generic.sequence.display(run=run) + 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. + + new_name: The new name. + + + Description + ~~~~~~~~~~~ + + This function simply allows residues 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` + 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. + 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) + + # Docstring modification. ######################### @@ -228,3 +279,4 @@ # Add the residue identification string description. copy.__doc__ = copy.__doc__ + "\n\n" + id_string_doc + "\n" delete.__doc__ = delete.__doc__ + "\n\n" + id_string_doc + "\n" + rename.__doc__ = rename.__doc__ + "\n\n" + id_string_doc + "\n"