Author: bugman Date: Fri Oct 9 20:25:00 2009 New Revision: 9712 URL: http://svn.gna.org/viewcvs/relax?rev=9712&view=rev Log: Created the user function bmrb.software_select(). This currently doesn't do anything. Modified: branches/bmrb/generic_fns/bmrb.py branches/bmrb/prompt/bmrb.py branches/bmrb/test_suite/system_tests/scripts/bmrb_rw.py Modified: branches/bmrb/generic_fns/bmrb.py URL: http://svn.gna.org/viewcvs/relax/branches/bmrb/generic_fns/bmrb.py?rev=9712&r1=9711&r2=9712&view=diff ============================================================================== --- branches/bmrb/generic_fns/bmrb.py (original) +++ branches/bmrb/generic_fns/bmrb.py Fri Oct 9 20:25:00 2009 @@ -72,6 +72,32 @@ read_function(file_path, version=version) +def software_select(name, version=None): + """Select by name the software used in the analysis. + + @param name: The name of the software program. + @type name: str + @keyword version: The program version. + @type version: str + """ + + # NMRPipe. + if name == 'NMRPipe': + pass + + # Sparky. + elif name == 'Sparky': + # Check if the version information has been supplied. + if not version: + raise RelaxError("The Sparky version number has not been supplied.") + + # The data. + + # Unknown program. + else: + raise RelaxError("The software '%s' is unknown. Please use the user function for manually specifying software details instead." % name) + + def write(file=None, directory=None, version='3.1', force=False): """Create a BMRB NMR-STAR formatted file.""" Modified: branches/bmrb/prompt/bmrb.py URL: http://svn.gna.org/viewcvs/relax/branches/bmrb/prompt/bmrb.py?rev=9712&r1=9711&r2=9712&view=diff ============================================================================== --- branches/bmrb/prompt/bmrb.py (original) +++ branches/bmrb/prompt/bmrb.py Fri Oct 9 20:25:00 2009 @@ -84,6 +84,54 @@ bmrb.read(file=file, directory=dir, version=version) + def software_select(self, name=None, version=None): + """Select the software used in the analysis. + + Keyword Arguments + ~~~~~~~~~~~~~~~~~ + + name: The name of the software program utilised. + + + Description + ~~~~~~~~~~~ + + Rather than specifying all the information directly, this user function allows the software + packaged used in the analysis to be selected by name. The programs currently supported are: + + 'NMRPipe' - http://spin.niddk.nih.gov/NMRPipe/ + 'Sparky' - http://www.cgl.ucsf.edu/home/sparky/ + + More can be added if all relevant information (program name, description, website, original + citation, purpose, etc.) is emailed to relax-users@xxxxxxxx + + Note that relax is automatically added to the BMRB file. + + + Examples + ~~~~~~~~ + + For BMRB deposition, to say that both NMRPipe and Sparky were used prior to relax, type: + + relax> bmrb.software_select('NMRPipe') + relax> bmrb.software_select('Sparky', version='3.113') + """ + + # Function intro text. + if self.__relax__.interpreter.intro: + text = sys.ps3 + "bmrb.software_select(" + text = text + "name=" + repr(name) + text = text + ", version=" + repr(version) + ")" + print(text) + + # The argument checks. + check.is_str(name, 'program name') + check.is_str(version, 'version', can_be_none=True) + + # Execute the functional code. + bmrb.software_select(name=name, version=version) + + def write(self, file=None, dir='pipe_name', version='3.1', force=False): """Write the results to a BMRB NMR-STAR formatted file. Modified: branches/bmrb/test_suite/system_tests/scripts/bmrb_rw.py URL: http://svn.gna.org/viewcvs/relax/branches/bmrb/test_suite/system_tests/scripts/bmrb_rw.py?rev=9712&r1=9711&r2=9712&view=diff ============================================================================== --- branches/bmrb/test_suite/system_tests/scripts/bmrb_rw.py (original) +++ branches/bmrb/test_suite/system_tests/scripts/bmrb_rw.py Fri Oct 9 20:25:00 2009 @@ -33,6 +33,10 @@ # Display the data (as a test). relax_data.display(ri_label='R1', frq_label='800') +# Set up all the BMRB information. +bmrb.software_select('NMRPipe') +bmrb.software_select('Sparky', version='3.106') + # Write, then read the data to a new data pipe. bmrb.write(file=ds.tmpfile, dir=None, version=ds.version, force=True) pipe.create(pipe_name='new', pipe_type='mf')