Difference between revisions of "Modeling and Editing Structures"

From PyMOLWiki
Jump to navigation Jump to search
Line 142: Line 142:
 
   
 
   
 
==Adding hydrogen bonds==
 
==Adding hydrogen bonds==
See 'displaying biochemical properties'.
+
:''See [[Displaying_Biochemical_Properties#Hydrogen_bonds_and_Polar_Contacts|Displaying biochemical properties]].''
  
 
 
==Protonating ligands==
 
==Protonating ligands==
 
If your ligands come in with valid valencies and formal charges, PyMOL's h_add command can protonate ligands. (NOTE that there is a minor technical hiccup with SD-files which are loaded by default as immutable "discrete" objects.) Suffice it to say that in order to make changes to the chemical structure, an object must be loaded with the "discrete" flag set to zero.
 
If your ligands come in with valid valencies and formal charges, PyMOL's h_add command can protonate ligands. (NOTE that there is a minor technical hiccup with SD-files which are loaded by default as immutable "discrete" objects.) Suffice it to say that in order to make changes to the chemical structure, an object must be loaded with the "discrete" flag set to zero.

Revision as of 13:33, 16 May 2009

Modeling in PyMOL

Saving with transformed coordinates

Here is a simple script that saves the molecule with coordinates from the current orientation. (invoke it with 'run save_transformed.py' and type the new save_transformed.py command thereafter).

# Adds the command save_transformed
# Usage: save_transformed object, file
def save_transformed(object,file):
    m = cmd.get_view(0)
    ttt = [m[0], m[1], m[2], 0.0,
           m[3], m[4], m[5], 0.0,
           m[6], m[7], m[8], 0.0,
           0.0,   0.0,  0.0, 1.0]
    cmd.transform_object(object,ttt)
    cmd.save(file,object)

cmd.extend('save_transformed',save_transformed)


Translate or rotate individual objects

There is a "translate" function similar to "rotate", the docs for these don't exist yet, because the implementation isn't finished. However, feel free to use them in the following forms:

translate vector,object-name,state
   (vector needs to be something like [x,y,z])

   translate [1,0,0],pept

rotate axis,angle,object-name,state
   (axis can be either the letter x,y,z or a 3D vector [x,y,z])
   rotate x,90,pept
   rotate [1,1,1],10,pept

Moving one segment relative to the rest

This means moving two parts of one object into different directions. The easiest way to do this is to split the objects and then use the rotate command.

load 1FJ1.pdb

# split PDB file

create anti=(chain F) 
create fab=(chain A,B)

# delete original object
delete 1FJ1

# color objects
color green,fab
color pink,anti

# color interface
select inter = (byres ((fab within 5 of anti)\
   or (anti within 5 of fab)))

color yellow,inter

# splay apart
orient
origin fab
rotate y,60,fab
origin anti
rotate y,-60, anti

# zoom interface region
zoom inter
show sph,inter
disable inter

Split states to objects

There is also a new command in the 0.95 series:

   split_states object-name

which will spread a PDB "biological unit" (or any multi-state object -- including SD files) over a series of independent objects. This makes it possible to interact with such objects more naturally than with "all_states = 1".


Altering secondary structures

Examples:

 alter A/10:34/, ss='H'
 alter A/35:40/, ss='L'
 alter A/41:60/, ss='S'

Altering van der Waals radii

Example:

alter (elem Fe),vdw=1.8
rebuild

(The value for Fe is wrecked in PyMOL at the moment, so running the above line might be a good idea).


Altering atom coordinates

Example:

alter_state 1,(pdb1cse),x=x-10.0

The latter section can contain formulae involving at least the xyz coordinates, lots of constants and the (+-*/) operators.


Deleting bonds

Select the bond using Ctrl-right-click, then either

unbond pk1,pk2

or hit Ctrl-D.


Converting D- to L- amino acids

The inversion function was changed in version 0.95 to take advantage of multiple picked atoms. To invert a center, Ctrl-middle-click to pick the center atom as pk1 and two stationary atoms as pk2 and pk3. Then type Ctrl-E to invert.


Adding disulfide bonds

You can use the Cmd bond command to attach them:

bond 24/sg,26/sg
bond 56/sg,99/sg
unpick

(unpick will hide the bond baton which gets displayed.) Additionally, the residue names can be changed for bonded cysteines:

alter cys/,name='CYX'

or for specific residues

alter 24+26+56+99/,name='CYX'


Adding hydrogen bonds

See Displaying biochemical properties.

Protonating ligands

If your ligands come in with valid valencies and formal charges, PyMOL's h_add command can protonate ligands. (NOTE that there is a minor technical hiccup with SD-files which are loaded by default as immutable "discrete" objects.) Suffice it to say that in order to make changes to the chemical structure, an object must be loaded with the "discrete" flag set to zero. Unfortunately, much of the molecular editing stuff remains to be documented. Here's an example sequence, but I'm not sure it will help to much...as indicated in the manual, this is immature functionality with some major gaps. Attach in particular is very limited...

# show valences
set valence=0.05

# load cysteine fragment
fragment cys

# remove hydrogens
remove (hydro)

# edit gamma S
edit cys////sg

# add hydrogen
attach H,1,1

# add planer, trivalent nitrogen onto C terminus
edit cys////C
attach N,3,3

# edit that nitrogen
edit (elem N and neighbor cys////C)

# attach a tetrahedral methyl (note random position)
attach C,4,4

# here's an example of adding a whole residue from the library
edit cys////N
editor.attach_amino_acid("pk1","ace")

# now restore missing hydrogens (note that the names are off...)
h_add


Superposition of two molecules

Using pair_fit requires that you specify a set of paired atoms in each structure. Fortunately, you no longer have to specify each pair separately, so long as the ordering is the same in each selection (almost always true).

pair_fit ( trna10 and resid 10:15 and name P ), ( ref4 and resid 10:15 and name P )

Another example:

pair_fit prot1///11-26/CA, prot2///34-49/CA

would superimpose prot1 on prot2 using C-alphas from residues 11-26 in prot1 and 34-49 in prot2.

Manual superposition of two molecules

You can also align to structures using mouse rotation/translation. For this, you need to protect those molecules you don't want to move with (action menu -> movement -> protect) in the selection menu.

Protect one object, deprotect the other, grab the deprotected object and move with Shift-Mouse. Don't forget to switch to Mouse Editing mode.


Adding and using your own fragments

Pymol has some build-in fragments (amino acids and simple functional groups). You can add your own fragments, eg. sugars, in this way:

Create the molecule you want to use as a fragment. Save it as a .pkl file in <pymol_path>/data/chempy/fragments.

How to use the fragment:

Pick the atom (ctrl-middle) where you want to add the fragment. This will usually be a hydrogen atom (which will be removed). Then use the command:

editor.attach_fragment('pk1','my_fragment_name',11,0)

where my_fragment_name is the name of the pkl-file (w/o .pkl extension) and 11 is the number of the connecting (hydrogen) atom in the fragment. To determine this number, press '[L]abel' -> 'atom identifiers' -> 'index' and choose the hydrogen atom you want.

If you want a hotkey for your fragment, you can probably put it in <pymol_path>/modules/pmg_tk/skins/normal/__init__.py, but I haven't tried this.