Author: bugman Date: Tue Jul 8 21:24:29 2008 New Revision: 6845 URL: http://svn.gna.org/viewcvs/relax?rev=6845&view=rev Log: Converted the rdc.read() user function from the relax_data.read() code. Modified: branches/rdc_analysis/prompt/rdc.py Modified: branches/rdc_analysis/prompt/rdc.py URL: http://svn.gna.org/viewcvs/relax/branches/rdc_analysis/prompt/rdc.py?rev=6845&r1=6844&r2=6845&view=diff ============================================================================== --- branches/rdc_analysis/prompt/rdc.py (original) +++ branches/rdc_analysis/prompt/rdc.py Tue Jul 8 21:24:29 2008 @@ -229,17 +229,13 @@ relax_data.display(ri_label=ri_label, frq_label=frq_label) - def read(self, ri_label=None, frq_label=None, frq=None, file=None, dir=None, mol_name_col=None, res_num_col=0, res_name_col=1, spin_num_col=None, spin_name_col=None, data_col=2, error_col=3, sep=None): + def read(self, id=None, file=None, dir=None, mol_name_col=None, res_num_col=0, res_name_col=1, spin_num_col=None, spin_name_col=None, data_col=2, error_col=3, sep=None): """Function for reading R1, R2, or NOE relaxation data from a file. Keyword Arguments ~~~~~~~~~~~~~~~~~ - ri_label: The relaxation data type, ie 'R1', 'R2', or 'NOE'. - - frq_label: The field strength label. - - frq: The spectrometer frequency in Hz. + id: The RDC identification string. file: The name of the file containing the relaxation data. @@ -260,47 +256,21 @@ error_col: The experimental error column (the default is 3). sep: The column separator (the default is white space). - - - Description - ~~~~~~~~~~~ - - The frequency label argument can be anything as long as data collected at the same field - strength have the same label. Examples ~~~~~~~~ - The following commands will read the protein NOE relaxation data collected at 600 MHz out of - a file called 'noe.600.out' where the residue numbers, residue names, data, errors are in - the first, second, third, and forth columns respectively. - - relax> relax_data.read('NOE', '600', 599.7 * 1e6, 'noe.600.out') - relax> relax_data.read(ri_label='NOE', frq_label='600', frq=600.0 * 1e6, file='noe.600.out') - - - The following commands will read the R2 data out of the file 'r2.out' where the residue - numbers, residue names, data, errors are in the second, third, fifth, and sixth columns - respectively. The columns are separated by commas. - - relax> relax_data.read('R2', '800 MHz', 8.0 * 1e8, 'r2.out', 1, 2, 4, 5, ',') - relax> relax_data.read(ri_label='R2', frq_label='800 MHz', frq=8.0*1e8, file='r2.out', - res_num_col=1, res_name_col=2, data_col=4, error_col=5, sep=',') - - - The following commands will read the R1 data out of the file 'r1.out' where the columns are - separated by the symbol '%' - - relax> relax_data.read('R1', '300', 300.1 * 1e6, 'r1.out', sep='%') - """ - - # Function intro text. - if self.__relax__.interpreter.intro: - text = sys.ps3 + "relax_data.read(" - text = text + "ri_label=" + `ri_label` - text = text + ", frq_label=" + `frq_label` - text = text + ", frq=" + `frq` + The following commands will read the RDC data out of the file 'Tb.txt' where the columns are + separated by the symbol ',', and store the RDCs under the identifier 'Tb'. + + relax> relax_data.read('Tb', 'Tb.txt', sep=',') + """ + + # Function intro text. + if self.__relax__.interpreter.intro: + text = sys.ps3 + "rdc.read(" + text = text + "id=" + `id` text = text + ", file=" + `file` text = text + ", dir=" + `dir` text = text + ", mol_name_col=" + `mol_name_col` @@ -313,17 +283,9 @@ text = text + ", sep=" + `sep` + ")" print text - # Relaxation data type. - if type(ri_label) != str: - raise RelaxStrError, ('relaxation label', ri_label) - - # Frequency label. - if type(frq_label) != str: - raise RelaxStrError, ('frequency label', frq_label) - - # Frequency. - if type(frq) != float: - raise RelaxFloatError, ('frequency', frq) + # Id string. + if type(id) != str: + raise RelaxStrError, ('identification string', id) # The file name. if type(file) != str: @@ -366,7 +328,7 @@ raise RelaxNoneStrError, ('column separator', sep) # Execute the functional code. - relax_data.read(ri_label=ri_label, frq_label=frq_label, frq=frq, 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, data_col=data_col, error_col=error_col, sep=sep) + rdc.read(id=id, 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, data_col=data_col, error_col=error_col, sep=sep) def write(self, ri_label=None, frq_label=None, file=None, dir=None, force=False):