Author: bugman Date: Sun Nov 4 19:50:28 2007 New Revision: 3445 URL: http://svn.gna.org/viewcvs/relax?rev=3445&view=rev Log: Implemented the molecule.rename() user function. Modified: 1.3/prompt/molecule.py Modified: 1.3/prompt/molecule.py URL: http://svn.gna.org/viewcvs/relax/1.3/prompt/molecule.py?rev=3445&r1=3444&r2=3445&view=diff ============================================================================== --- 1.3/prompt/molecule.py (original) +++ 1.3/prompt/molecule.py Sun Nov 4 19:50:28 2007 @@ -203,6 +203,51 @@ molecule.display(mol_id=mol_id) + def rename(self, mol_id=None, new_name=None): + """Function for renaming an existent molecule. + + Keyword Arguments + ~~~~~~~~~~~~~~~~~ + + mol_id: The molecule identification string corresponding to one or more residues. + + new_name: The new name. + + + Description + ~~~~~~~~~~~ + + This function simply allows molecules to be renamed. + + + Examples + ~~~~~~~~ + + To rename the molecule 'Ap4Aase' to 'Inhib Ap4Aase', type: + + relax> molecule.rename('#Ap4Aase', 'Inhib Ap4Aase') + relax> molecule.rename(mol_id='#Ap4Aase', new_name='Inhib Ap4Aase') + """ + + # Function intro text. + if self.__relax__.interpreter.intro: + text = sys.ps3 + "molecule.rename(" + text = text + ", mol_id=" + `mol_id` + text = text + ", new_name=" + `new_name` + ")" + print text + + # Residue identification string. + if type(mol_id) != int: + raise RelaxIntError, ('molecule identification string', mol_id) + + # New molecule name. + if type(new_name) != str: + raise RelaxStrError, ('new molecule name', new_name) + + # Execute the functional code. + molecule.create(mol_num=mol_num, new_name=new_name) + + # Docstring modification. ######################### @@ -211,5 +256,5 @@ copy.__doc__ = copy.__doc__ + "\n\n" + id_string_doc + "\n" delete.__doc__ = delete.__doc__ + "\n\n" + id_string_doc + "\n" display.__doc__ = display.__doc__ + "\n\n" + id_string_doc + "\n" - #rename.__doc__ = rename.__doc__ + "\n\n" + id_string_doc + "\n" + rename.__doc__ = rename.__doc__ + "\n\n" + id_string_doc + "\n" #renumber.__doc__ = renumber.__doc__ + "\n\n" + id_string_doc + "\n"