Re: [PyMOL] ribbon view of c-alpha only coordinates

2004-11-02 Thread Lieven Buts
On Monday 01 November 2004 18:05, Cathy Lawson wrote:
 Some PDB files (notably models fitted into EM density) contain only C-alpha
 coordinates.
 When read into Pymol, Ive found that the coordinates appear as a
 constellation of individual atoms, and selecting a ribbon view doesn't
 connect them with lines.

Try set ribbon_trace,1.

-- 
Lieven Buts
Department of Ultrastructure
Vrije Universiteit Brussel



Re: [PyMOL] transformation matrix

2004-10-22 Thread Lieven Buts
On Friday 22 October 2004 02:07, Milton H. Werner, Ph.D. wrote:
 I assume there is a way in pymol to read a DALI rotation/transformation
 matrix so that two dissimilar molecules can be intelligently aligned.
 Can someone tell me how it is done?

I have a simple Python script that extracts the transformation matrices from 
the Dali report file. If someone has a way to use this matrix in PyMol, we'd 
be set:

#!/usr/bin/env python

# Script to extract 3x4 transformation matrices from Dali report files
# Lieven Buts, 22-Oct-2004

import re,sys

dali = open(sys.argv[1],r)

pattern = re.compile(r'^## MATRICES')  # Find section with matrices
line = dali.readline()
while not pattern.match(line):
line = dali.readline()

dummy = dali.readline()

pattern = re.compile(r'^ *$')
line = dali.readline()
while not pattern.match(line): # Read matrices until first empty line
  one = line.split()
  two = dali.readline().split()
  three = dali.readline().split()

  code = one[2]
  matrix = [ one[4],one[5],one[6],one[7],
 two[4],two[5],two[6],two[7],
 three[4],three[5],three[6],three[7] ]
  matrix = tuple(map(float,matrix))

  print code
  print (%8.3f %8.3f %8.3f %8.3f\n * 3) % matrix
  print

  line = dali.readline()


Cheers,

-- 
Lieven Buts
Department of Ultrastructure
Vrije Universiteit Brussel



Re: [PyMOL] unit cell

2004-08-16 Thread Lieven Buts
On Monday 16 August 2004 02:44, Jianghai Zhu wrote:
 In pymol, how do you draw a unit cell? The cell constants are in the
 pdb file and the manual says pymol can display unit cell. I just could
 not figure out how to do it.

load molecule.pdb
show cell,molecule

You may then have to zoom out and/or change the clipping planes to 
show all of the unit cell.

-- 
Lieven Buts
Department of Ultrastructure
Vrije Universiteit Brussel



Re: [PyMOL] Cavity display?

2004-07-23 Thread Lieven Buts
On Friday 23 July 2004 13:41, Dirk Kostrewa wrote:
 I wanted to have a program that can easily calculate cavities in proteins
 to be displayed with pymol (see e-mails below for details).
 Thanks to Gareth and Lari I've got two pointers to such programs:
 I've tried PASS, recommended by Lari and got a surface picture of my
 cavities within literally a few minutes, as Lari already wrote.

The rTools (http://www.rubor.de/bioinf/pymol_rubor.html) also contain a 
fucntion to interface PASS with PyMOL.

-- 
Lieven Buts
Department of Ultrastructure
Vrije Universiteit Brussel



Re: [PyMOL] PyMOL + APBS for easy, accurate electrostatics calculations

2004-07-15 Thread Lieven Buts
On Thursday 15 July 2004 13:30, Daniel Rigden wrote:
 -- begin configuring for MALOC linkage 
 checking for FETK_INCLUDE... yes
 checking for FETK_LIBRARY... yes
 checking maloc/maloc.h usability... yes
 checking maloc/maloc.h presence... yes
 checking for maloc/maloc.h... yes
 checking for maloc_link in -lmaloc... no
 configure: error: MALOC libraries or headers missing:  exiting on error!

 I saw some messages about libraries during compilation of maloc.  I
 don't known if they have anything to do with the apbs compilation
 problem but I added /usr/local/lib/i686-pc-linux to /etc/ld.so.conf and
 did a /sbin/ldconfig and it didn't help.

I went through the following steps:

# unpack maloc tarball
cd maloc
./configure --prefix=/usr/local
make
make install
#This produces some error messages which
# I still have to look into
cd ..
# unpack apbs tarball
cd apbs-0.3.1
export LDFLAGS=-L/usr/local/lib/i686-pc-linux
export FETK_INCLUDE=/usr/local/include
export FETK_LIBRARY=/usr/local/lib
./configure --prefix=/usr/local
make
make install

make install steps were done as root. My LDFLAGS were empty before I 
started. If they are not, you may have to use

export LDFLAGS=${LDFLAGS} -L/usr/local/lib/i686-pc-linux 

instead.


Hope this helps,

-- 
Lieven Buts
Department of Ultrastructure
Vrije Universiteit Brussel



Re: [PyMOL] Question about surface calculation

2004-03-14 Thread Lieven Buts
On Sunday 14 March 2004 06:27, Fred Berkovitch wrote:
 When I type show surface, how is that surface calculated?  Is it a true
 solvent-accessible surface?  Does PyMol take into account heteroatoms
 (e.g., a metal or an Fe-S cluster) in the calculation?

As for the latter question, this is determined by the surface_mode setting.
After set surface_mode,0 (the default) heteroatoms are ignored and the 
surface is generated only for the protein atoms, leaving water molecules and
ligands alone. After set surface_mode,1, all atoms are included for surface
generation. You can also create separate objects to generate exactly the 
surfaces you want.

Cheers,

-- 
Lieven Buts
Department of Ultrastructure
Vrije Universiteit Brussel



Re: [PyMOL] restoring default surface coloring

2004-03-02 Thread Lieven Buts
On Tuesday 02 March 2004 07:56, Matt Franklin wrote:
 [...snip...]  I then realized that I
 had absolutely no idea how to restore the default surface coloring!
 (Except by quitting and restarting...)

 set surface_color, default didn't work, nor did set surface_color,
 atom_color.  All I could get was solid colors.  I'm guessing there's
 some special color name I should be using, but what is it?

You can use something like 
color white,object
to set an object to a fixed color, or the utility command
util.cbag(object)
(note the parentheses and quotes) to color the object by 
atom type and set the carbon atoms to green.
There's cbag for color by atom type, carbons green, cbaw for white 
carbons, cbay for yellow carbons and so on.

Alternatively, you can use the color menu in the internal GUI.

Hope this helps,

-- 
Lieven Buts
Department of Ultrastructure
Vrije Universiteit Brussel



Re: [PyMOL] Select Atom Change View

2004-01-14 Thread Lieven Buts
On Wednesday 14 January 2004 15:54, Douglas Kojetin wrote:
 Is it possible to do the following through the command line ...

 -- select an atom (say the CA of residue 25) and bring the view of the
 molecule within PyMOL so that 25.CA is 'up front' (or closest to the
 viewer's point of view)?

Yes, zoom (resi 25 and name CA) should do the trick. You can specify an 
additional buffer space around the selection (zoom (resi 25 and CA),2 for 
example). If you have multiple chains and molecules, you will have to make 
your selection more specific
(zoom (protein and chain A and resi 25 and name CA) for example). There are 
many abbreviations for long selections. Type help selections for more 
information.

-- 
Lieven Buts
Department of Ultrastructure
Vrije Universiteit Brussel




Re: [PyMOL] make cartoon from carbon atom trace?

2004-01-06 Thread Lieven Buts
On Monday 05 January 2004 23:18, Ann Mullin wrote:
 I have some PDF files which only contain the backbone carbon atoms,
 and I would like to  use PyMOL to show a cartoon representation of the
 backbone.  Any suggestions?

There is a setting called cartoon_trace. By default it is set to zero and 
PyMOL will not connect Calpha atoms when the other atoms are absent. You can 
change the setting in the corresponding menu, or with the command

set cartoon_trace,1

PyMOL should now draw cartoons through the Calpha positions, although it might 
get confused if there are multiple chains in the PDB file and connect the 
last atom of one chain to the first of antoher. In that case it will be 
necessary to create separate objects for the different chains.

There is an analogous setting ribbon_trace for the ribbon representation. In 
this case, separate chains do not appear to get connected.


Best wishes to all for 2004,

-- 
Lieven Buts
Department of Ultrastructure
Vrije Universiteit Brussel




Re: [PyMOL] H-bonds

2004-01-06 Thread Lieven Buts
On Tuesday 06 January 2004 20:06, Sanishvili, Ruslan wrote:
 Is there a way to calculate and display H-bonds within a selected model
 without going through the distance wizard? Selecting the pairs of atoms
 manually via the distance wizard seems very inefficient and even
 dangerous (too subjective for H-bond assignment).

1) The dist command will draw distance lines between all atoms of two 
different selections that are within a a specified cutoff distance from each 
other. A very rough approach for identifying potential hydrogen bonds would 
be something like

dist (protein and elem n,o) , (ligand and elem n,o), 3.5

This will connect all nitrogen and oxygen atoms in objects protein and 
ligand that are within 3.5 A from each other.


2) A more thorough approach would be to use a program designed to identify 
hydrogen bonds using more complete criteria. The rTools for PyMOL (available 
at http://www.rubor.de/bioinf/pymol_rubor.html ) provide an interface to 
the HBExplore program at http://www.imb-jena.de/www_bioc/hbx/hbx.html.
See the rTools documentation for more details.


-- 
Lieven Buts
Department of Ultrastructure
Vrije Universiteit Brussel




Re: [PyMOL] Selecting a lot of residues

2003-12-04 Thread Lieven Buts
On Wednesday 03 December 2003 22:25, Gwendowlyn S. Knapp wrote:
 Maybe I didn't word my question right. I have several proteins (like
 15-20) that i need to do this for and i also have these lists. i was
 wanting to see if there was anyway to have pymol read in that list
 automatically so i didn't have to type in all the residues (ie, about 60
 on each protein).

OK , here's a third possiblity. This little Python script
--
from sys import stdin,stdout

stdout.write(select group,(protein and chain A and resi )

first = 1

for line in stdin.readlines():
if not first: stdout.write(,)
stdout.write( line[:-1] )
first = 0

stdout.write()\n)
--

when used as python make_select.py  list  list.pml will transform a list 
of residues like
5
10
50
51
52
100

into a single-line PyMol command

select group,(protein and chain A and resi 5,10,50,51,52,100)

which can be copied/pasted into PyMol, or read from the file with @list.pml.


-- 
Lieven Buts
Department of Ultrastructure
Vrije Universiteit Brussel




Re: [PyMOL] Selecting a lot of residues

2003-12-03 Thread Lieven Buts
On Wednesday 03 December 2003 22:25, Gwendowlyn S. Knapp wrote:
 Maybe I didn't word my question right. I have several proteins (like
 15-20) that i need to do this for and i also have these lists. i was
 wanting to see if there was anyway to have pymol read in that list
 automatically so i didn't have to type in all the residues (ie, about 60
 on each protein).

I see two possibilities:

1) write a PyMol function to read the residue list and make the appropriate 
selections. I do not have enough experience to do this yet.

2) use an editor or script to transform the residue list into a PyMol select 
command that can be sourced. If the residue list looks like this:

5
10
50
51
52
100

in a file list then a command like 

sed -e s/^/(protein and resi / -e s/$/) or \\\/ list   list.pml

will create a file list.pml like this:

(protein and resi 5) or \
(protein and resi 10) or \
(protein and resi 50) or \
(protein and resi 51) or \
(protein and resi 52) or \
(protein and resi 100) or \

The ^ in the sed command means beginning of the line, the $ means end 
of the line. The backslash at the end of each line indicates that the 
command continues on the next line. There should be no characters after the 
backslash (other than the newline).

Two manual edits transform this into

select group,((protein and resi 5) or \
(protein and resi 10) or \
(protein and resi 50) or \
(protein and resi 51) or \
(protein and resi 52) or \
(protein and resi 100) )

Note the additional parentheses around the complete expression.

This can be executed in PyMol by typing @list.pml and
should select the indicated residues in the molecule protein.


Hope this helps,

-- 
Lieven Buts
Department of Ultrastructure
Vrije Universiteit Brussel




Re: [PyMOL] you know what would be cool?

2003-11-18 Thread Lieven Buts
On Monday 17 November 2003 14:06, Laurence Pearl wrote:
 I should add that I don't  actually know
 how to program in python and have no idea how its 'tuples' work, so
 this is a very FORTRAN-like routine - feel free to improve it.

I have attached a Pythonized version of the code. It uses docstrings
for the functions, try...except blocks to check some of the parameters,
and things like (%8.3f * 17) to save some repetition of format 
specifiers. Python is cool!

I have also changed the script to add two commands to PyMol using
cmd.extend: camtrav first,nframes,selection,zoom,buffer and 
seqfly object,firstres,lastres. Usage examples:

#-
load protein.pdb
run camera_travel.py
mset 1 x150
zoom all
camtrav 1,100,(resi 50),1,4
mplay

# This will zoom in from the complete molecule to residue 50.
#-

#-
load protein.pdb
run camera_travel.py
mset 1 x150
seqfly protein,1,8
mplay

# This will visit the sequence from residue 1 to 8
#-

Finally, I ran into some trouble in a lysozyme structure (PDB 103L). At 
residue 139, cosom becomes slightly larger than 1 (1.0008 or so) and 
acos(cosom) fails. Also, omega and sinom become zero in this case, so 
the divisions by sinom fail. I added some checks to normalize this 
situation and stop the code from crashing, but we should look into 
what's causing this.

-- 
Lieven Buts
Department of Ultrastructure
Vrije Universiteit Brussel# camera_travel - Laurence Pearl, November 2003
# Pythonized by Lieven Buts, November 2003

import cmd
from math import sqrt,acos,sin

def quaternion(view):
 
Returns a quaternion representation of a view matrix.


nxt = [1,2,0]
q = [0.0,0.0,0.0,1.0]

tr = view[0]+view[4]+view[8]

if tr  0.0 :
s = sqrt(tr + 1.0)
qw1 = s / 2.0
s = 0.5 / s
return ( (view[5] - view[7]) * s,
 (view[6] - view[2]) * s,
 (view[1] - view[3]) * s,
 qw1  )
else :
i = 0
if (view[4]  view[0]): i = 1
if (view[8]  view[i+3*i]): i = 2
j = nxt[i]
k = nxt[j]
s = sqrt ((view[i+i*3] - (view[j+j*3] + view[k+k*3])) + 1.0)
q[i] = s * 0.5
if (s != 0.0): s = 0.5 / s
q[3] = (view[k+3*j] - view[j+3*k]) * s
q[j] = (view[j+3*i] + view[i+3*j]) * s
q[k] = (view[k+3*i] + view[i+3*k]) * s
return q


def camera_travel(first,nframes=30,sel='(all)',zflag=0,zlevel=2):

Generate progressive view matrices to move the camera smoothly
from the current view to a view defined by a PyMol selection.

first   - start frame
nframes - duration
sel - atom selection that defines the orientation at the end of the
  sequence
zflag   - flag to indicate whether the final view should be 'zoomed'  
  or not
zlevel  - buffer space for zooming final view (as in cmd.zoom)


try:
first=int(first)
except:
print camera_travel: first frame must be an integer
return -1

try:
nframes=int(nframes)
except:
print camera_travel: number of frames

ff=float(1.0/nframes)

old_view = cmd.get_view(2)

#   print ( view : ( + %8.3f, *17 + %8.3f) ) % (old_view)
#   print oldtran : %8.3f %8.3f %8.3f % (old_view[12], old_view[13], 
old_view[14])

#   do orient operation on selection
cmd.orient(sel,0)

#   if zoom to selection is required add this into view matrix
if zflag:
cmd.zoom(sel,zlevel,0,1)

#   get new view
new_view = cmd.get_view()

#   capture new zoom/clip parameters
ozc1 = new_view[11]
ozc2 = new_view[15]
ozc3 = new_view[16]

#   calculate shift in zoom/clip parameters
dzc1 = (ozc1 - old_view[11]) * ff
dzc2 = (ozc2 - old_view[15]) * ff
dzc3 = (ozc3 - old_view[16]) * ff

ozc1 = old_view[11]
ozc2 = old_view[15]
ozc3 = old_view[16]

#   capture new translation vector component
ox = new_view[12]
oy = new_view[13]
oz = new_view[14]

#   calculate shift vector
dx = ox - old_view[12]
dy = oy - old_view[13]
dz = oz - old_view[14]

dx = dx*ff
dy = dy*ff
dz = dz*ff

ox = old_view[12]
oy = old_view[13]
oz = old_view[14]


#   capture old and new rotation matrix components in quaternion form

#   m[0][0] = v[0]  m[0][1] = v[1]  m[0][2] = v[2]
#   m[1][0] = v[3]  m[1][1] = v[4]  m[1][2] = v[5]
#   m[2][0

Re: [PyMOL] color choices

2003-04-01 Thread Lieven Buts
Jianghai Zhu wrote:
 When I use color command, how many choices do I have for colors? Can I use
 direct rgb value?

The color command uses color names. You can define your own colors
with RGB values using the set_color command:

set_color whatever = [ 1.0, 0.3, 0.7 ]

After that you can use

color whatever, ...

-- 
Lieven Buts
Department of Ultrastructure



Re: [PyMOL] Help! Color by atom/H-bond display/mouse on OSX

2002-07-31 Thread Lieven Buts
Luca Jovine wrote:
 1) Is there any typed command one can use to color a selection by atom
 type (rather than manually doing so by using the internal GUI pop-up menus)?

The util module contains a number of functions that color the atoms
according to type, with different colors for the C atoms. For instance,

  util.cbay three

in a .pml script will color object three by atom type, with the carbon
atoms in yellow (color by atom yellow).

Other functions from ../modules/pymol/util.py are cbag, cbac, cbas,
cbap, cbak, cbaw and cbab (grey (carbon), cyan, salmon, purple, pink, 
white (hydrogen) and slate).
 

-- 
Lieven Buts
Brussels Free University



Re: [PyMOL] molecular sculpting

2002-07-19 Thread Lieven Buts
DeLano, Warren wrote:
 Right now I'm not sure the sculpting feature is more than entertainment, but 
 my expectation is that it will become part of PyMOL's crystallographic model 
 building system in the future.

I agree. I think it has great potential there, as it allows for a more
physical or
intuitive way of manipulating the model than moving individual atoms
or turning
torsion angles.

-- 
Lieven Buts
Brussels Free University



Re: [PyMOL] molecular sculpting

2002-07-18 Thread Lieven Buts
patricia.a.elk...@gsk.com wrote:
 I would like to understand the molecular sculpting possibilities of pymol
 but haven't been able to figure it out yet.  When using the wizard, the
 first request is to click and atom but how to proceed from there?

 I have used the bit of script provided on the web page and deformed
 the benzene ring but have not been clever enough to see the
 possibilities
 from that.

 Could anyone provide just enough of a step-by-step push-this,
 click-that lead into the
 molecular sculpting to get me started?

I don't know about the script or the wizard (yet), but I did try the
sculpting demo in the Demo menu. You can then just drag atoms
by left-clicking them while holding down the control key. The
dragged atom moves, everything it is connected to is dragged along,
and the structure tries to minimize its energy. Great fun!

-- 
Lieven Buts
Department of Ultrastructure
Brussels Free University



Re: [PyMOL] Babel and File Format Conversion

2002-05-21 Thread Lieven Buts
Bob Havlin wrote:
 You probably know about this already, but incorporating the file format
 converter
 named babel
 
 http://www.eyesopen.com/babel.html
 
 would make PyMol universal for nearly all file formats.

The development of Babel is being continued in the OpenBabel
project at http://openbabel.sourceforge.net/.

-- 
Lieven Buts
Brussels Free University



[PyMOL] Creating separate objects from a starting structure

2002-05-08 Thread Lieven Buts
  Hello all,

  I am working with a PDB file that contains a protein molecule
(chain id A) and three different ligands in its binding site (as
chains B, C and D). This file was made by combining three 
superimposed complex structures to illustrate the relationsips 
between the modes of binding of the different ligands. 

I used PyMol and the following script to create an overview
figure: 

[ PyMol script ]-

# Load the PDB file containing all the elements
load combination.pdb

# Separate structure into different objects
# chain A is the protein
create lectin,(A//)
# chains B,C and D contain three different ligands
create one,(B//)
create two,(C//)
create three,(D//)
# delete the original structure
delete combination

# Set view
hide lines,all
zoom one,3
# set orientation,...

# Color atoms according to functon
color white,lectin
# site 1
color green,(/lectin///85,86,106,132,138,220/) 
# site 2
color bluegreen,(/lectin///104,45/)
# Generate van der Waals surface
show surface,lectin

# Ligands in different colors
set stick_radius,0.05
color magenta,one
show sticks,one
color yellow,two
show sticks,two
color red,three
show sticks,three




This works very well. Maybe a wizard could be created to automatically 
split a structure into separate objects for the different chains?



-- 
Lieven Buts
Vrije Universiteit Brussel