Author: bugman Date: Wed Mar 14 09:30:56 2007 New Revision: 3188 URL: http://svn.gna.org/viewcvs/relax?rev=3188&view=rev Log: Added initial support for the residue user function class. The file 'prompt/residue.py' was copied from 'prompt/sequence.py' and the function 'add()' renamed to 'create' (generating the 'residue.create()' user function). All the other sequence user functions still remain unchanged. Added: 1.3/prompt/residue.py - copied, changed from r3177, 1.3/prompt/sequence.py Modified: 1.3/prompt/interpreter.py Modified: 1.3/prompt/interpreter.py URL: http://svn.gna.org/viewcvs/relax/1.3/prompt/interpreter.py?rev=3188&r1=3187&r2=3188&view=diff ============================================================================== --- 1.3/prompt/interpreter.py (original) +++ 1.3/prompt/interpreter.py Wed Mar 14 09:30:56 2007 @@ -1,6 +1,6 @@ ############################################################################### # # -# Copyright (C) 2003-2005 Edward d'Auvergne # +# Copyright (C) 2003-2007 Edward d'Auvergne # # # # This file is part of the program relax. # # # @@ -60,6 +60,7 @@ from monte_carlo import Monte_carlo from noe import Noe from palmer import Palmer +from residue import Residue from structure import Structure from pymol import Pymol from relax_data import Relax_data @@ -118,6 +119,7 @@ self._Monte_carlo = Monte_carlo(relax) self._Noe = Noe(relax) self._Palmer = Palmer(relax) + self._Residue = Residue(relax) self._Structure = Structure(relax) self._Pymol = Pymol(relax) self._Relax_data = Relax_data(relax) @@ -180,6 +182,7 @@ pymol = self._Pymol relax_data = self._Relax_data relax_fit = self._Relax_fit + residue = self._Residue results = self._Results pipe = self._Pipe select = self._Select Copied: 1.3/prompt/residue.py (from r3177, 1.3/prompt/sequence.py) URL: http://svn.gna.org/viewcvs/relax/1.3/prompt/residue.py?p2=1.3/prompt/residue.py&p1=1.3/prompt/sequence.py&r1=3177&r2=3188&rev=3188&view=diff ============================================================================== --- 1.3/prompt/sequence.py (original) +++ 1.3/prompt/residue.py Wed Mar 14 09:30:56 2007 @@ -1,6 +1,6 @@ ############################################################################### # # -# Copyright (C) 2003, 2004 Edward d'Auvergne # +# Copyright (C) 2007 Edward d'Auvergne # # # # This file is part of the program relax. # # # @@ -26,11 +26,11 @@ from relax_errors import RelaxBinError, RelaxIntError, RelaxNoneStrError, RelaxStrError -class Sequence: +class Residue: def __init__(self, relax): # Help. self.__relax_help__ = \ - """Class for manipulating sequence data.""" + """Class for manipulating the residue data.""" # Add the generic help string. self.__relax_help__ = self.__relax_help__ + "\n" + help.relax_class_help @@ -39,53 +39,44 @@ self.__relax__ = relax - def add(self, run=None, res_num=None, res_name=None, select=1): - """Function for adding a residue onto the sequence. - - Keyword Arguments - ~~~~~~~~~~~~~~~~~ - - run: The name of the run. + def create(self, res_num=None, res_name=None): + """Function for creating a new residue. + + Keyword Arguments + ~~~~~~~~~~~~~~~~~ res_num: The residue number. res_name: The name of the residue. - select: A flag specifying if the residue should be selected. - - - Description - ~~~~~~~~~~~ - - Using this function a new sequence can be generated without having to load the sequence from - a file. However if the sequence already exists, the new residue will be added to the end. - The same residue number cannot be used more than once. + + Description + ~~~~~~~~~~~ + + Using this function a new sequence can be generated without using the sequence user + functions. However if the sequence already exists, the new residue will be added to the end + of the residue list (the residue numbers of this list need not be sequential). The same + residue number cannot be used more than once. A corresponding single spin system will be + created for this residue. The spin system number and name or additional spin systems can be + added later if desired. Examples ~~~~~~~~ - The following sequence of commands will generate the sequence 1 ALA, 2 GLY, 3 LYS and assign - it to the run 'm3': - - relax> run = 'm3' - relax> sequence.add(run, 1, 'ALA') - relax> sequence.add(run, 2, 'GLY') - relax> sequence.add(run, 3, 'LYS') - """ - - # Function intro text. - if self.__relax__.interpreter.intro: - text = sys.ps3 + "sequence.add(" - text = text + "run=" + `run` + The following sequence of commands will generate the sequence 1 ALA, 2 GLY, 3 LYS: + + relax> residue.create(1, 'ALA') + relax> residue.create(2, 'GLY') + relax> residue.create(3, 'LYS') + """ + + # Function intro text. + if self.__relax__.interpreter.intro: + text = sys.ps3 + "residue.create(" text = text + ", res_num=" + `res_num` - text = text + ", res_name=" + `res_name` - text = text + ", select=" + `select` + ")" - print text - - # The run argument. - if type(run) != str: - raise RelaxStrError, ('run', run) + text = text + ", res_name=" + `res_name` + ")" + print text # Residue number. if type(res_num) != int: @@ -95,12 +86,8 @@ if type(res_name) != str: raise RelaxStrError, ('residue name', res_name) - # Select flag. - if type(select) != int or (select != 0 and select != 1): - raise RelaxBinError, ('select', select) - - # Execute the functional code. - self.__relax__.generic.sequence.add(run=run, res_num=res_num, res_name=res_name, select=select) + # Execute the functional code. + residue.create(res_num=res_num, res_name=res_name) def copy(self, run1=None, run2=None):