Author: bugman Date: Sun Feb 22 15:31:48 2009 New Revision: 8852 URL: http://svn.gna.org/viewcvs/relax?rev=8852&view=rev Log: Started to implement different NMR-STAR version support. There are obvious design issues here, preventing this from working! Added: branches/bmrb/bmrblib/kinetics/heteronucl_NOEs_v3_1.py - copied, changed from r8849, branches/bmrb/bmrblib/kinetics/heteronucl_NOEs.py branches/bmrb/bmrblib/nmr_star_dict_v3_1.py - copied, changed from r8848, branches/bmrb/bmrblib/nmr_star_dict.py Modified: branches/bmrb/bmrblib/kinetics/heteronucl_NOEs.py branches/bmrb/specific_fns/model_free/bmrb.py Modified: branches/bmrb/bmrblib/kinetics/heteronucl_NOEs.py URL: http://svn.gna.org/viewcvs/relax/branches/bmrb/bmrblib/kinetics/heteronucl_NOEs.py?rev=8852&r1=8851&r2=8852&view=diff ============================================================================== --- branches/bmrb/bmrblib/kinetics/heteronucl_NOEs.py (original) +++ branches/bmrb/bmrblib/kinetics/heteronucl_NOEs.py Sun Feb 22 15:31:48 2009 @@ -51,6 +51,12 @@ # The number of relaxation data sets. self.r1_inc = 0 + + self.add_tag_categories() + + + def add_tag_categories(self): + """Create the v3.1 tag categories.""" # The tag category objects. self.heteronuclNOElist = HeteronuclNOEList(self) Copied: branches/bmrb/bmrblib/kinetics/heteronucl_NOEs_v3_1.py (from r8849, branches/bmrb/bmrblib/kinetics/heteronucl_NOEs.py) URL: http://svn.gna.org/viewcvs/relax/branches/bmrb/bmrblib/kinetics/heteronucl_NOEs_v3_1.py?p2=branches/bmrb/bmrblib/kinetics/heteronucl_NOEs_v3_1.py&p1=branches/bmrb/bmrblib/kinetics/heteronucl_NOEs.py&r1=8849&r2=8852&rev=8852&view=diff ============================================================================== --- branches/bmrb/bmrblib/kinetics/heteronucl_NOEs.py (original) +++ branches/bmrb/bmrblib/kinetics/heteronucl_NOEs_v3_1.py Sun Feb 22 15:31:48 2009 @@ -27,137 +27,54 @@ """ # relax module imports. -from bmrblib.tag_category import TagCategory -from pystarlib.SaveFrame import SaveFrame -from pystarlib.TagTable import TagTable +from bmrblib.kinetics.heteronucl_NOEs import HeteronuclNOESaveframe, HeteronuclNOEList, HeteronuclNOEExperiment, HeteronuclNOESoftware, HeteronuclNOE -class HeteronuclNOESaveframe: - """The Heteronuclear NOE data saveframe class.""" - - # Saveframe variables. - label = 'NOE' +class HeteronuclNOESaveframe_v3_1(HeteronuclNOESaveframe): + """The v3.1 Heteronuclear NOE data saveframe class.""" - def __init__(self, datanodes): - """Initialise the class, placing the pystarlib data nodes into the namespace. + def add_tag_categories(self): + """Create the v3.1 tag categories.""" - @param datanodes: The pystarlib data nodes object. - @type datanodes: list + # The tag category objects. + self.heteronuclNOElist = HeteronuclNOEList_v3_1(self) + self.heteronuclNOEexperiment = HeteronuclNOEExperiment_v3_1(self) + self.heteronuclNOEsoftware = HeteronuclNOESoftware_v3_1(self) + self.heteronuclNOE = HeteronuclNOE_v3_1(self) + + +class HeteronuclNOEList_v3_1(HeteronuclNOEList): + """v3.1 HeteronuclNOEList tag category.""" + + # Tag names for the relaxation data. + SfCategory = 'Sf_category' + SampleConditionListLabel = 'Sample_condition_list_label' + SpectrometerFrequency1H = 'Spectrometer_frequency_1H' + + + def __init__(self, sf): + """Initialise the v3.1 specific tag category. + + @param sf: The saveframe object. + @type sf: saveframe instance """ - # Place the data nodes into the namespace. - self.datanodes = datanodes - - # The number of relaxation data sets. - self.r1_inc = 0 - - # The tag category objects. - self.heteronuclNOElist = HeteronuclNOEList(self) - self.heteronuclNOEexperiment = HeteronuclNOEExperiment(self) - self.heteronuclNOEsoftware = HeteronuclNOESoftware(self) - self.heteronuclNOE = HeteronuclNOE(self) + # Execute the base class __init__() method. + TagCategory.__init__(self, sf, tag_category_label='_Heteronucl_T2_list') - def add(self, frq=None, res_nums=None, res_names=None, atom_names=None, data=None, errors=None): - """Add relaxation data to the data nodes. - - @keyword frq: The spectrometer proton frequency, in Hz. - @type frq: float - @keyword res_nums: The residue number list. - @type res_nums: list of int - @keyword res_names: The residue name list. - @type res_names: list of str - @keyword atom_names: The atom name list. - @type atom_names: list of str - @keyword data: The relaxation data. - @type data: list of float - @keyword errors: The errors associated with the relaxation data. - @type errors: list of float - """ - - # Place the args into the namespace. - self.frq = frq - self.res_nums = res_nums - self.res_names = res_names - self.atom_names = atom_names - self.data = data - self.errors = errors - - # Set up the R1 specific variables. - self.r1_inc = self.r1_inc + 1 - ri_inc = self.r1_inc - - # Initialise the save frame. - self.frame = SaveFrame(title='heteronuclear_'+self.label+'_list_'+`ri_inc`) - - # Create the tag categories. - self.heteronuclNOElist.create() - self.heteronuclNOEexperiment.create() - self.heteronuclNOEsoftware.create() - self.heteronuclNOE.create() - - # Add the saveframe to the data nodes. - self.datanodes.append(self.frame) - - -class HeteronuclNOEList(TagCategory): - """Base class for the HeteronuclNOEList tag category.""" - - # Tag names for the relaxation data. - SfCategory = '_Saveframe_category' - SampleConditionListLabel = '_Sample_conditions_label' - SpectrometerFrequency1H = '_Spectrometer_frequency_1H' - - # Class variables. - coherence = 'Nz' - - - def create(self): - """Create the HeteronuclNOEList tag category.""" - - # The save frame category. - self.sf.frame.tagtables.append(TagTable(free=True, tagnames=[self.create_tag_label(self.SfCategory)], tagvalues=[[self.sf.label+'_relaxation']])) - - # Sample info. - self.sf.frame.tagtables.append(TagTable(free=True, tagnames=[self.create_tag_label(self.SampleConditionListLabel)], tagvalues=[['$conditions_1']])) - - # NMR info. - self.sf.frame.tagtables.append(TagTable(free=True, tagnames=[self.create_tag_label(self.SpectrometerFrequency1H)], tagvalues=[[str(self.sf.frq/1e6)]])) - - -class HeteronuclNOEExperiment(TagCategory): - """Base class for the HeteronuclNOEExperiment tag category.""" +class HeteronuclNOEExperiment_v3_1(HeteronuclNOEExperiment): + """v3.1 HeteronuclNOEExperiment tag category.""" # Tag names for experiment setup. SampleLabel = '_Sample_label' - def create(self, frame=None): - """Create the HeteronuclNOEExperiment tag category.""" - - # Sample info. - self.sf.frame.tagtables.append(TagTable(free=True, tagnames=[self.create_tag_label(self.SampleLabel)], tagvalues=[['$sample_1']])) +class HeteronuclNOESoftware_v3_1(HeteronuclNOESoftware): + """v3.1 HeteronuclNOESoftware tag category.""" -class HeteronuclNOESoftware(TagCategory): - """Base class for the HeteronuclNOESoftware tag category.""" +class HeteronuclNOE_v3_1(HeteronuclNOE): + """v3.1 HeteronuclNOE tag category.""" - def create(self): - """Create the HeteronuclNOESoftware tag category.""" - - -class HeteronuclNOE(TagCategory): - """Base class for the HeteronuclNOE tag category.""" - - def create(self): - """Create the HeteronuclNOE tag category.""" - - # The relaxation tag names. - tag_names = ['_Residue_seq_code', '_Residue_label', '_Atom_name', '_'+self.sf.label+'_value', '_'+self.sf.label+'_value_error'] - - # Add the data. - table = TagTable(tagnames=tag_names, tagvalues=[self.sf.res_nums, self.sf.res_names, self.sf.atom_names, self.sf.data, self.sf.errors]) - - # Add the tagtable to the save frame. - self.sf.frame.tagtables.append(table) Copied: branches/bmrb/bmrblib/nmr_star_dict_v3_1.py (from r8848, branches/bmrb/bmrblib/nmr_star_dict.py) URL: http://svn.gna.org/viewcvs/relax/branches/bmrb/bmrblib/nmr_star_dict_v3_1.py?p2=branches/bmrb/bmrblib/nmr_star_dict_v3_1.py&p1=branches/bmrb/bmrblib/nmr_star_dict.py&r1=8848&r2=8852&rev=8852&view=diff ============================================================================== --- branches/bmrb/bmrblib/nmr_star_dict.py (original) +++ branches/bmrb/bmrblib/nmr_star_dict_v3_1.py Sun Feb 22 15:31:48 2009 @@ -21,47 +21,18 @@ ############################################################################### # Module docstring. -"""The base classes for the NMR-STAR dictionary support within relax. +"""The NMR-STAR dictionary API for version 3.1. -The most up to date NMR-STAR dictionary relax uses is the v3.1 version documented at +The v3.1 NMR-STAR dictionary is documented at http://www.bmrb.wisc.edu/dictionary/3.1html/SuperGroupPage.html. """ # relax module imports. -from bmrblib.kinetics import heteronucl_NOEs, heteronucl_T1_relaxation, heteronucl_T2_relaxation -from pystarlib.File import File +from bmrblib.kinetics.heteronucl_NOEs_v3_1 import HeteronuclNOESaveframe_v3_1 as HeteronuclNOESaveframe +#from bmrblib.kinetics.heteronucl_T1_relaxation_v3_1 import HeteronuclT1Saveframe_v3_1 as HeteronuclT1Saveframe +#from bmrblib.kinetics.heteronucl_T2_relaxation_v3_1 import HeteronuclT2Saveframe_v3_1 as HeteronuclT2Saveframe +from bmrblib.nmr_star_dict import NMR_STAR -class NMR_STAR: - """The base object for the NMR-STAR dictionary.""" - - def __init__(self, title, file_path): - """Initialise the NMR-STAR dictionary object. - - @param title: The title of the NMR-STAR data. - @type title: str - @param file_path: The full file path. - @type file_path: str - """ - - # Initialise the pystarlib File object. - self.data = File(title=title, filename=file_path) - - # Initialise the objects of this class. - self.heteronucl_T1_relaxation = heteronucl_T1_relaxation.HeteronuclT1Saveframe(self.data.datanodes) - self.heteronucl_T2_relaxation = heteronucl_T2_relaxation.HeteronuclT2Saveframe(self.data.datanodes) - self.heteronucl_NOEs = heteronucl_NOEs.HeteronuclNOESaveframe(self.data.datanodes) - - - def read(self): - """Read the data from a BMRB NMR-STAR formatted file.""" - - # Read the contents of the STAR formatted file. - self.data.read() - - - def write(self): - """Write the data to a BMRB NMR-STAR formatted file.""" - - # Write the contents to the STAR formatted file. - self.data.write() +class NMR_STAR_v3_1(NMR_STAR): + """The v3.1 NMR-STAR dictionary.""" Modified: branches/bmrb/specific_fns/model_free/bmrb.py URL: http://svn.gna.org/viewcvs/relax/branches/bmrb/specific_fns/model_free/bmrb.py?rev=8852&r1=8851&r2=8852&view=diff ============================================================================== --- branches/bmrb/specific_fns/model_free/bmrb.py (original) +++ branches/bmrb/specific_fns/model_free/bmrb.py Sun Feb 22 15:31:48 2009 @@ -21,7 +21,7 @@ ############################################################################### # relax module imports. -from bmrblib.nmr_star_dict import NMR_STAR +from bmrblib.nmr_star_dict_v3_1 import NMR_STAR_v3_1 from generic_fns.mol_res_spin import spin_loop from generic_fns.pipes import get_pipe @@ -37,7 +37,7 @@ """ # Initialise the NMR-STAR data object. - star = NMR_STAR('relax_model_free_results', file_path) + star = NMR_STAR_v3_1('relax_model_free_results', file_path) # Read the contents of the STAR formatted file. star.read() @@ -51,7 +51,7 @@ """ # Initialise the NMR-STAR data object. - star = NMR_STAR('relax_model_free_results', file_path) + star = NMR_STAR_v3_1('relax_model_free_results', file_path) # Get the current data pipe. cdp = get_pipe()