[MMTK] replaceResidue

Talipov, Marat marat.talipov at marquette.edu
Fri Jun 17 15:38:25 UTC 2011


Dear Konrad,

First of all, thank you for reply!

On Jun 16, 2011, at 2:04 AM, Konrad Hinsen wrote:

> On 15 Jun 2011, at 00:14, Talipov, Marat wrote:
> 
>> My idea is to store the residue coordinates in a Z-matrix format in the database and use them
>> to calculate the Cartesian coordinates using positions of the backbone atoms (say, CA,C,N) as a reference.
>> 
>> However, I'm not sure what is the best place to keep Z-matrix coordinates of residues. I thought about XXX_sidechain file, but I got an error "name 'ZMatrix' is not defined".
> 
> That's easy to fix: add the line
> 
> 	from MMTK.ConfigIO import ZMatrix
> 
> to your XXX_sidechain file. Those files are in fact Python scripts which are executed after an implicit "from MMTK.GroupEnvironment import *". MMTK.GroupEnvironment does not contain ZMatrix (MMTK.MoleculeEnvironment does), so that's why you need to add the import yourself.
> 

However, this leads to another error (the command, the stack, and files with modified residue are given at the end of the letter). 
Could you please take a look on it?


Sincerely yours,
Marat




PS:

In [2]: a = Residue('alz')

/Users/talipovmr/q-research/mmtk/Groups/alz
/Users/talipovmr/q-research/mmtk/Groups/alz_sidechain
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/MMTK/Database/Atoms/c
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/MMTK/Database/Atoms/h
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

/Users/talipovmr/q-research/mmtk/<ipython console> in <module>()

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/MMTK/Proteins.py in __init__(self, name, model)
     49         """
     50         if name is not None:
---> 51             blueprint = _residueBlueprint(name, model)
     52             ChemicalObjects.Group.__init__(self, blueprint)
     53             self.model = model

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/MMTK/Proteins.py in _residueBlueprint(name, model)
    202         elif model == 'calpha':
    203             name = name + '_calpha'
--> 204         blueprint = Database.BlueprintGroup(name)
    205         _residue_blueprints[(name, model)] = blueprint
    206     return blueprint

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/MMTK/Database.py in __init__(self, type, memo)
    452 class BlueprintGroup(BlueprintObject):
    453     def __init__(self, type, memo = None):
--> 454         BlueprintObject.__init__(self, type, group_types, memo)
    455     object_list = 'groups'
    456 

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/MMTK/Database.py in __init__(self, original, database, memo)
    422     def __init__(self, original, database, memo):
    423         if isinstance(original, str):
--> 424             original = database.findType(original)
    425             self.type = original
    426         elif hasattr(original, 'is_blueprint'):

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/MMTK/Database.py in findType(self, name)
     89         if not self.types.has_key(name):
     90             filename = databasePath(name, self.directory, False)
---> 91             self.types[name] = self.type_constructor(filename, name)
     92         return self.types[name]
     93 

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/MMTK/Database.py in __init__(self, filename, database_name)
    265                                     GroupEnvironment,
    266                                     ('atoms', 'groups', 'bonds',
--> 267                                      'chain_links'))
    268         for g in self.groups:
    269             self.atoms = self.atoms + g.atoms

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/MMTK/Database.py in __init__(self, filename, database_name, module, instancevars)
    104         file_text = Utility.readURL(filename)
    105         newvars = {}
--> 106         exec file_text in vars(module), newvars
    107         for name, value in newvars.items():
    108             setattr(self, name, value)

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/MMTK/GroupEnvironment.pyc in <module>()

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/MMTK/Database.py in __init__(self, type, memo)
    452 class BlueprintGroup(BlueprintObject):
    453     def __init__(self, type, memo = None):
--> 454         BlueprintObject.__init__(self, type, group_types, memo)
    455     object_list = 'groups'
    456 

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/MMTK/Database.py in __init__(self, original, database, memo)
    422     def __init__(self, original, database, memo):
    423         if isinstance(original, str):
--> 424             original = database.findType(original)
    425             self.type = original
    426         elif hasattr(original, 'is_blueprint'):

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/MMTK/Database.py in findType(self, name)
     89         if not self.types.has_key(name):
     90             filename = databasePath(name, self.directory, False)
---> 91             self.types[name] = self.type_constructor(filename, name)
     92         return self.types[name]
     93 

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/MMTK/Database.py in __init__(self, filename, database_name)
    269             self.atoms = self.atoms + g.atoms
    270             self.bonds = self.bonds + g.bonds
--> 271         self.setReferences()
    272 
    273     def _restoreId(self):

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/MMTK/Database.py in setReferences(self)
    133                 setattr(self, attr[0],
    134                         Utility.substitute(getattr(self, attr[0]),
--> 135                                            self.atoms, atom_refs))
    136 
    137     # Type objects are singletons, they are never copied


/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/MMTK/Utility.pyc in substitute(obj, *exchange)
     85     if hasattr(obj, '_substitute'):
     86         for attr in vars(obj).keys():
---> 87             setattr(obj, attr, substitute(getattr(obj, attr), exchange))
     88         return obj
     89     try:

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/MMTK/Utility.pyc in substitute(obj, *exchange)
     88         return obj
     89     try:
---> 90         return exchange[obj]
     91     except KeyError:
     92         return obj

TypeError: unhashable type: 'dictproxy'





Files content:
---alz---
sidechain = Group('alz_sidechain')
peptide = Group('peptide')
bonds = [Bond(peptide.C_alpha, sidechain.C_beta), ]
symbol = 'Alz'
amber_charge = {sidechain.H_beta_3: 0.0603, sidechain.C_beta: -0.1825, peptide.N: -0.4157, peptide.H: 0.2719, peptide.C: 0.5973, peptide.C_alpha: 0.0337, sidechain.H_beta_1: 0.0603, sidechain.H_beta_2: 0.0603, peptide.O: -0.5679, peptide.H_alpha: 0.0823, }
name = 'alanine-Z'
chain_links = [peptide.N, peptide.C]
------


--- alz_sidechain ---
C_beta = Atom('c')
H_beta_3 = Atom('h')
H_beta_2 = Atom('h')
H_beta_1 = Atom('h')
bonds = [Bond(H_beta_1, C_beta), Bond(H_beta_2, C_beta), Bond(H_beta_3, C_beta), ]
pdbmap = [('ALA', {'2HB': H_beta_2, '3HB': H_beta_3, 'CB': C_beta, '1HB': H_beta_1, }, ), ]
pdb_alternative = {'HB2': '2HB', 'HB3': '3HB', 'HB1': '1HB', }
amber_atom_type = {H_beta_3: 'HC', C_beta: 'CT', H_beta_2: 'HC', H_beta_1: 'HC', }
name = 'alz_sidechain'
from MMTK.ConfigIO import ZMatrix
"""
configurations = {'default': ZMatrix([ 
                        [C_beta],
                        [H_beta_1, C_beta, 1.1*Ang],
                        [H_beta_2, C_beta, 1.1*Ang, H_beta_1, 110*deg],
                        [H_beta_3, C_beta, 1.1*Ang, H_beta_1, 110*deg,H_beta_2, 120*deg],
                    ])
                 }
"""
-------------




More information about the mmtk mailing list