Author: bugman Date: Fri Mar 6 14:46:30 2009 New Revision: 8918 URL: http://svn.gna.org/viewcvs/relax?rev=8918&view=rev Log: All mol/res/spin naming and number user functions now accept the force arg. Modified: 1.3/prompt/molecule.py 1.3/prompt/residue.py 1.3/prompt/spin.py Modified: 1.3/prompt/molecule.py URL: http://svn.gna.org/viewcvs/relax/1.3/prompt/molecule.py?rev=8918&r1=8917&r2=8918&view=diff ============================================================================== --- 1.3/prompt/molecule.py (original) +++ 1.3/prompt/molecule.py Fri Mar 6 14:46:30 2009 @@ -206,7 +206,7 @@ display_molecule(mol_id=mol_id) - def name(self, mol_id=None, name=None): + def name(self, mol_id=None, name=None, force=False): """Function for naming a molecule. Keyword Arguments @@ -215,6 +215,8 @@ mol_id: The molecule identification string corresponding to one or more molecules. name: The new molecule name. + + force: A flag which if True will cause the molecule to be renamed. Description @@ -226,10 +228,10 @@ Examples ~~~~~~~~ - To rename the molecule 'Ap4Aase' to 'Inhib Ap4Aase', type: - - relax> molecule.name('#Ap4Aase', 'Inhib Ap4Aase') - relax> molecule.name(mol_id='#Ap4Aase', name='Inhib Ap4Aase') + To rename the molecule 'Ap4Aase' to 'Inhib Ap4Aase', type one of: + + relax> molecule.name('#Ap4Aase', 'Inhib Ap4Aase', True) + relax> molecule.name(mol_id='#Ap4Aase', name='Inhib Ap4Aase', force=True) This assumes the molecule 'Ap4Aase' already exists. """ @@ -238,7 +240,8 @@ if self.__relax__.interpreter.intro: text = sys.ps3 + "molecule.name(" text = text + "mol_id=" + `mol_id` - text = text + ", name=" + `name` + ")" + text = text + ", name=" + `name` + text = text + ", force=" + `force` + ")" print text # Residue identification string. @@ -249,8 +252,12 @@ if type(name) != str: raise RelaxStrError, ('new molecule name', name) - # Execute the functional code. - name_molecule(mol_id=mol_id, name=name) + # The force flag. + if type(force) != bool: + raise RelaxBoolError, ('force flag', force) + + # Execute the functional code. + name_molecule(mol_id=mol_id, name=name, force=force) Modified: 1.3/prompt/residue.py URL: http://svn.gna.org/viewcvs/relax/1.3/prompt/residue.py?rev=8918&r1=8917&r2=8918&view=diff ============================================================================== --- 1.3/prompt/residue.py (original) +++ 1.3/prompt/residue.py Fri Mar 6 14:46:30 2009 @@ -230,7 +230,7 @@ display_residue(res_id=res_id) - def name(self, res_id=None, name=None): + def name(self, res_id=None, name=None, force=False): """Function for naming residues. Keyword Arguments @@ -239,6 +239,8 @@ res_id: The residue identification string corresponding to one or more residues. name: The new name. + + force: A flag which if True will cause the residue to be renamed. Description @@ -253,20 +255,21 @@ The following sequence of commands will rename the sequence {1 ALA, 2 GLY, 3 LYS} to {1 XXX, 2 XXX, 3 XXX}: - relax> residue.name(':1', 'XXX') - relax> residue.name(':2', 'XXX') - relax> residue.name(':3', 'XXX') + relax> residue.name(':1', 'XXX', force=True) + relax> residue.name(':2', 'XXX', force=True) + relax> residue.name(':3', 'XXX', force=True) Alternatively: - relax> residue.name(':1,2,3', 'XXX') + relax> residue.name(':1,2,3', 'XXX', force=True) """ # Function intro text. if self.__relax__.interpreter.intro: text = sys.ps3 + "residue.name(" text = text + "res_id=" + `res_id` - text = text + ", name=" + `name` + ")" + text = text + ", name=" + `name` + text = text + ", force=" + `force` + ")" print text # Residue identification string. @@ -277,11 +280,15 @@ if type(name) != str: raise RelaxStrError, ('new residue name', name) - # Execute the functional code. - name_residue(res_id=res_id, name=name) - - - def number(self, res_id=None, number=None): + # The force flag. + if type(force) != bool: + raise RelaxBoolError, ('force flag', force) + + # Execute the functional code. + name_residue(res_id=res_id, name=name, force=force) + + + def number(self, res_id=None, number=None, force=False): """Function for numbering residues. Keyword Arguments @@ -290,6 +297,8 @@ res_id: The residue identification string corresponding to a single residue. number: The new residue number. + + force: A flag which if True will cause the residue to be renumbered. Description @@ -305,16 +314,17 @@ The following sequence of commands will renumber the sequence {1 ALA, 2 GLY, 3 LYS} to {101 ALA, 102 GLY, 103 LYS}: - relax> residue.number(':1', 101) - relax> residue.number(':2', 102) - relax> residue.number(':3', 103) + relax> residue.number(':1', 101, force=True) + relax> residue.number(':2', 102, force=True) + relax> residue.number(':3', 103, force=True) """ # Function intro text. if self.__relax__.interpreter.intro: text = sys.ps3 + "residue.number(" text = text + "res_id=" + `res_id` - text = text + ", number=" + `number` + ")" + text = text + ", number=" + `number` + text = text + ", force=" + `force` + ")" print text # Residue identification string. @@ -325,8 +335,12 @@ if type(number) != int: raise RelaxIntError, ('new residue number', number) - # Execute the functional code. - number_residue(res_id=res_id, number=number) + # The force flag. + if type(force) != bool: + raise RelaxBoolError, ('force flag', force) + + # Execute the functional code. + number_residue(res_id=res_id, number=number, force=force) Modified: 1.3/prompt/spin.py URL: http://svn.gna.org/viewcvs/relax/1.3/prompt/spin.py?rev=8918&r1=8917&r2=8918&view=diff ============================================================================== --- 1.3/prompt/spin.py (original) +++ 1.3/prompt/spin.py Fri Mar 6 14:46:30 2009 @@ -225,7 +225,7 @@ display_spin(spin_id=spin_id) - def name(self, spin_id=None, name=None): + def name(self, spin_id=None, name=None, force=False): """Function for naming spins. Keyword Arguments @@ -234,6 +234,8 @@ spin_id: The spin identification string corresponding to one or more spins. name: The new name. + + force: A flag which if True will cause the spin to be renamed. Description @@ -248,16 +250,17 @@ The following sequence of commands will rename the sequence {1 C1, 2 C2, 3 C3} to {1 C11, 2 C12, 3 C13}: - relax> spin.name('@1', 'C11') - relax> spin.name('@2', 'C12') - relax> spin.name('@3', 'C13') + relax> spin.name('@1', 'C11', force=True) + relax> spin.name('@2', 'C12', force=True) + relax> spin.name('@3', 'C13', force=True) """ # Function intro text. if self.__relax__.interpreter.intro: text = sys.ps3 + "spin.name(" text = text + "spin_id=" + `spin_id` - text = text + ", name=" + `name` + ")" + text = text + ", name=" + `name` + text = text + ", force=" + `force` + ")" print text # Spin identification string. @@ -268,11 +271,15 @@ if type(name) != str: raise RelaxStrError, ('new spin name', name) - # Execute the functional code. - name_spin(spin_id=spin_id, name=name) - - - def number(self, spin_id=None, number=None): + # The force flag. + if type(force) != bool: + raise RelaxBoolError, ('force flag', force) + + # Execute the functional code. + name_spin(spin_id=spin_id, name=name, force=force) + + + def number(self, spin_id=None, number=None, force=False): """Function for numbering spins. Keyword Arguments @@ -281,6 +288,8 @@ spin_id: The spin identification string corresponding to a single spin. number: The new spin number. + + force: A flag which if True will cause the spin to be renumbered. Description @@ -296,9 +305,9 @@ The following sequence of commands will renumber the sequence {1 C1, 2 C2, 3 C3} to {-1 C1, -2 C2, -3 C3}: - relax> spin.number('@1', -1) - relax> spin.number('@2', -2) - relax> spin.number('@3', -3) + relax> spin.number('@1', -1, force=True) + relax> spin.number('@2', -2, force=True) + relax> spin.number('@3', -3, force=True) """ @@ -306,7 +315,8 @@ if self.__relax__.interpreter.intro: text = sys.ps3 + "spin.number(" text = text + "spin_id=" + `spin_id` - text = text + ", number=" + `number` + ")" + text = text + ", number=" + `number` + text = text + ", force=" + `force` + ")" print text # Spin identification string. @@ -317,8 +327,12 @@ if number != None and type(number) != int: raise RelaxNoneIntError, ('new spin number', number) - # Execute the functional code. - number_spin(spin_id=spin_id, number=number) + # The force flag. + if type(force) != bool: + raise RelaxBoolError, ('force flag', force) + + # Execute the functional code. + number_spin(spin_id=spin_id, number=number, force=force)