Author: bugman Date: Thu Nov 22 11:37:47 2007 New Revision: 3813 URL: http://svn.gna.org/viewcvs/relax?rev=3813&view=rev Log: Updated the sequence.write() user function for the new relax design.
Modified: 1.3/prompt/sequence.py Modified: 1.3/prompt/sequence.py URL: http://svn.gna.org/viewcvs/relax/1.3/prompt/sequence.py?rev=3813&r1=3812&r2=3813&view=diff ============================================================================== --- 1.3/prompt/sequence.py (original) +++ 1.3/prompt/sequence.py Thu Nov 22 11:37:47 2007 @@ -180,17 +180,27 @@ sequence.read(file=file, dir=dir, mol_name_col=mol_name_col, res_num_col=res_num_col, res_name_col=res_name_col, spin_num_col=spin_num_col, spin_name_col=spin_name_col, sep=sep) - def write(self, run=None, file=None, dir=None, force=0): - """Function for writing the sequence to a file. + def write(self, file=None, dir=None, mol_name_col=None, res_num_col=0, res_name_col=1, spin_num_col=None, spin_name_col=None, sep=None, force=0): + """Function for writing sequences of molecules, residues, and/or spins to a file. Keyword Arguments ~~~~~~~~~~~~~~~~~ - run: The name of the run. - file: The name of the file. dir: The directory name. + + mol_name_col: The molecule name column (this defaults to no column). + + res_num_col: The residue number column (the default is 0, i.e. the first column). + + res_name_col: The residue name column (the default is 1, i.e. the second column). + + spin_num_col: The spin number column (this defaults to no column). + + spin_name_col: The spin name column (this defaults to no column). + + sep: The column separator (the default is white space). force: A flag which, if set to 1, will cause the file to be overwritten. @@ -204,15 +214,16 @@ # Function intro text. if self.__relax__.interpreter.intro: text = sys.ps3 + "sequence.write(" - text = text + "run=" + `run` - text = text + ", file=" + `file` + text = text + "file=" + `file` text = text + ", dir=" + `dir` + text = text + ", mol_name_col=" + `mol_name_col` + text = text + ", res_num_col=" + `res_num_col` + text = text + ", res_name_col=" + `res_name_col` + text = text + ", spin_num_col=" + `spin_num_col` + text = text + ", spin_name_col=" + `spin_name_col` + text = text + ", sep=" + `sep` text = text + ", force=" + `force` + ")" print text - - # The run argument. - if type(run) != str: - raise RelaxStrError, ('run', run) # File. if type(file) != str: @@ -222,9 +233,33 @@ if dir != None and type(dir) != str: raise RelaxNoneStrError, ('directory name', dir) + # Molecule name column. + if mol_name_col != None and type(mol_name_col) != int: + raise RelaxNoneIntError, ('molecule name column', mol_name_col) + + # Residue number column. + if res_name_col != None and type(res_num_col) != int: + raise RelaxNoneIntError, ('residue number column', res_num_col) + + # Residue name column. + if res_name_col != None and type(res_name_col) != int: + raise RelaxNoneIntError, ('residue name column', res_name_col) + + # Spin number column. + if spin_num_col != None and type(spin_num_col) != int: + raise RelaxNoneIntError, ('spin number column', spin_num_col) + + # Spin name column. + if spin_name_col != None and type(spin_name_col) != int: + raise RelaxNoneIntError, ('spin name column', spin_name_col) + + # Column separator. + if sep != None and type(sep) != str: + raise RelaxNoneStrError, ('column separator', sep) + # The force flag. if type(force) != int or (force != 0 and force != 1): raise RelaxBinError, ('force flag', force) # Execute the functional code. - self.__relax__.generic.sequence.write(run=run, file=file, dir=dir, force=force) + sequence.write(file=file, dir=dir, mol_name_col=mol_name_col, res_num_col=res_num_col, res_name_col=res_name_col, spin_num_col=spin_num_col, spin_name_col=spin_name_col, sep=sep, force=force) _______________________________________________ relax (http://nmr-relax.com) This is the relax-commits mailing list relax-commits@gna.org To unsubscribe from this list, get a password reminder, or change your subscription options, visit the list information page at https://mail.gna.org/listinfo/relax-commits