[MMTK] Using MMTK

khinsen at cea.fr khinsen at cea.fr
Tue Jul 19 15:19:05 CEST 2005


On 18.07.2005, at 22:31, Matias Saavedra wrote:

> I have been looking in the mailing list and the
> documentation, but i can't find a way to modify
> (mutate) a residue. Could you tell me where can i find
> that information?, Or give a short code example?

Here is a simple example that changes everything to glycine. It leaves  
the H atoms undefined when the original residue is proline. I guess one  
can fix that  with a special treatment for the peptide group in  
proline, but I don't have the time at the moment.



from MMTK import *
from MMTK.Proteins import Protein, Residue

def mutateResidue(residue, new_residue_type, atom_mapping):
     if hasattr(residue.peptide, 'H_3'):
	new_residue_type += '_nt'
     elif hasattr(residue.peptide, 'O_2'):
	new_residue_type += '_ct'
     print "Changing %s into %s" % (residue.type.name, new_residue_type)
     new_residue = Residue(new_residue_type, residue.model)
     for g in ['peptide', 'sidechain']:
	g_old = getattr(residue, g)
	g_new = getattr(new_residue, g)
	atoms = map(lambda a: a.name, getattr(g_new, 'atoms'))
	for a in atoms:
	    an = getattr(g_new, a)
	    ao = None
	    try:
		ao = getattr(g_old, a)
	    except AttributeError:
		if g == 'sidechain':
		    try:
			a = atom_mapping[a]
			ao = getattr(g_old, a)
		    except KeyError:
			pass
	    if ao:
		an.setPosition(ao.position())
	    else:
		print "No mapping for atom %s.%s" % (g, a)
     return new_residue

protein = Protein('insulin')

for chain in protein:
     for residue in chain:
	new_residue = mutateResidue(residue,
				    'glycine', {'H_alpha_3': 'C_beta'})
	chain.replaceResidue(residue, new_residue)


> I want to transform every residue to alanin... so for
> most of them, i just need to erase everything after
> the Cb (beta-carbon)... but with glycin i need to
> recalculate the coordinates of the newly added Cb...

Right, that's something you will have to add to the example I have  
given.

> and of course, add this atom to the system. Until now
> i have been using a Biopython script to calculate the
> new coordinates throug a rotation of N atom.

You can use the same approach with MMTK of course.

Konrad.
--
------------------------------------------------------------------------ 
-------
Konrad Hinsen
Laboratoire Leon Brillouin, CEA Saclay,
91191 Gif-sur-Yvette Cedex, France
Tel.: +33-1 69 08 79 25
Fax: +33-1 69 08 82 61
E-Mail: khinsen at cea.fr
------------------------------------------------------------------------ 
-------




More information about the mmtk mailing list