Author: bugman Date: Mon Dec 20 17:17:50 2010 New Revision: 11921 URL: http://svn.gna.org/viewcvs/relax?rev=11921&view=rev Log: Fix for the molecule.type() user function due to the addition of the type arg to molecule.create(). The molecule.type() user function now uses a different naming of molecules. These are translated to BMRB names when creating BRMB deposition files. Modified: branches/bmrb/generic_fns/mol_res_spin.py branches/bmrb/prompt/molecule.py branches/bmrb/test_suite/system_tests/scripts/bmrb_rw.py Modified: branches/bmrb/generic_fns/mol_res_spin.py URL: http://svn.gna.org/viewcvs/relax/branches/bmrb/generic_fns/mol_res_spin.py?rev=11921&r1=11920&r2=11921&view=diff ============================================================================== --- branches/bmrb/generic_fns/mol_res_spin.py (original) +++ branches/bmrb/generic_fns/mol_res_spin.py Mon Dec 20 17:17:50 2010 @@ -545,8 +545,19 @@ else: mol_type = 'polymer' + # Translate the names. + polymer_type = mol.type + if polymer_type == 'protein': + polymer_type = 'polypeptide(L)' + if polymer_type == 'DNA': + polymer_type = 'polydeoxyribonucleotide' + if polymer_type == 'RNA': + polymer_type = 'polyribonucleotide' + if polymer_type == 'inorganic molecule': + polymer_type = 'other' + # Add the entity. - star.entity.add(mol_name=mol.name, mol_type=mol_type, polymer_type=mol.type, polymer_seq_code=polymer_seq_code,thiol_state=cdp.exp_info.thiol_state, res_nums=res_nums, res_names=res_names) + star.entity.add(mol_name=mol.name, mol_type=mol_type, polymer_type=polymer_type, polymer_seq_code=polymer_seq_code,thiol_state=cdp.exp_info.thiol_state, res_nums=res_nums, res_names=res_names) def copy_molecule(pipe_from=None, mol_from=None, pipe_to=None, mol_to=None): @@ -2710,19 +2721,9 @@ @type force: bool """ - # Check. - allowed = ['organic molecule', - 'DNA/RNA hybrid', - 'polydeoxyribonucleotide', - 'polypeptide(D)', - 'polypeptide(L)', - 'polyribonucleotide', - 'polysaccharide(D)', - 'polysaccharide(L)' - 'other' - ] - if type not in allowed: - raise RelaxError("The molecule type '%s' must be one of %s." % (type, allowed)) + # Check the type. + if type not in ALLOWED_MOL_TYPES: + raise RelaxError("The molecule type '%s' must be one of %s." % (type, ALLOWED_MOL_TYPES)) # Disallow residue and spin selections. select_obj = Selection(mol_id) @@ -2733,7 +2734,7 @@ # Change the molecule types. for mol in molecule_loop(mol_id): - if hasattr(mol, 'type') and not force: + if hasattr(mol, 'type') and mol.type and not force: warn(RelaxWarning("The molecule '%s' already has its type set. Set the force flag to change." % mol_id)) else: mol.type = type Modified: branches/bmrb/prompt/molecule.py URL: http://svn.gna.org/viewcvs/relax/branches/bmrb/prompt/molecule.py?rev=11921&r1=11920&r2=11921&view=diff ============================================================================== --- branches/bmrb/prompt/molecule.py (original) +++ branches/bmrb/prompt/molecule.py Mon Dec 20 17:17:50 2010 @@ -108,7 +108,7 @@ This function will add a new molecule data container to the relax data storage object. The same molecule name cannot be used more than once. The molecule type need not be specified. However if it given, it should be one of 'protein', 'RNA', 'DNA', 'organic molecule', - 'inorganic molecule'. + 'inorganic molecule', 'other'. Examples @@ -234,7 +234,7 @@ def type(self, mol_id=None, type=None, force=False): - """Set the molecule type (mainly used for BMRB submission). + """Set the molecule type. Keyword Arguments ~~~~~~~~~~~~~~~~~ @@ -251,6 +251,7 @@ This function allows the type of the molecule to be specified. It can be one of: + 'protein' 'organic molecule', 'DNA/RNA hybrid', 'polydeoxyribonucleotide', 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=11921&r1=11920&r2=11921&view=diff ============================================================================== --- branches/bmrb/test_suite/system_tests/scripts/bmrb_rw.py (original) +++ branches/bmrb/test_suite/system_tests/scripts/bmrb_rw.py Mon Dec 20 17:17:50 2010 @@ -32,7 +32,7 @@ spin.name(name='N') spin.element(element='N') molecule.name(name='OMP') -molecule.type(type='polypeptide(L)') +molecule.type(type='protein') bmrb.thiol_state(state='reduced') # Display the data (as a test).