[Back to Charlie's software][Older version of PDB-mode]
PDB mode for Xemacs - Version: April 2002
Description

pdb-mode is an emacs-lisp minor mode for Emacs to perform a number of useful editing functions on Protein DataBank (PDB) formatted files. XEmacs and/or GNU Emacs are available for most computing platforms. A full description of the PDB format can be found here.

pdb-mode is known to work with XEmacs versions 20.4 and 21.1 and Emacs 20.4.

(c) 1997, 2000-2002 Charlie Bond  C.S.Bond@dundee.ac.uk
(c) 2000 David Love

If you have any good ideas for improvements, or spot any bugs, let me know and I will try to implement/fix them. If you have any customisations which could be included, let me know.

Thanks to Dave Love for sorting out some of the old code and providing some new code, particularly in making things work in GNU Emacs and demonstrating how lisp ought to be written.

Disclaimer
I am not a programmer and this elisp code is certainly not bug proof. It is provided in good faith but with no warranties whatsoever. If, for any reason, you feel that you cannot take responsibility for any damage the use of this code might cause to your hardware, software, data or sanity, then do not install it. See the top of pdb-mode.el for GNU General Public License terms.
Installation
To use pdb-mode.el,  download it and put it somewhere. Add the following lines to your ~/.emacs file (or get your sysadmin to add it to the site-start.el), fire up (x)emacs and visit a PDB file (with suffix .pdb).

   (load-file "/{path-to}/pdb-mode.el")
   (setq auto-mode-alist
       (cons (cons "pdb$" 'pdb-mode)
              auto-mode-alist ) )
   (autoload 'pdb-mode "PDB")

Usage

The PDB mode functions are accessible from the PDB menu on the menu bar and also the right-mouse-click menu (CTRL-right-mouse in GNU Emacs).

For keystroke-fans, type M-x hyper-apropos RET pdb RET to get a list of the function names and descriptions..

Most functions require a region to be selected in which the function will operate..

To use the pdb-view function, rasmol must be installed and in the user's path..

If rasmol is not found by typing 'rasmol' in a shell, you must set the pdb-rasmol-name variable with its location/name in your .emacs (or site-start.el) (e.g. on a windows machine):.


(setq pdb-rasmol-name "\"c:/Program Files/Rasmol/rw32b2a.exe\"")

Fontification can be turned on from the menu. This highlights columns to make editing ATOM/HETATM records easier. As this is accompanied by a performance hit, you probably want to turn it off when scooting quickly through a file.

Tab stops are set up to match the PDB specification. Use CTRL-Tab to jump to next column start.

Function name Action Required input
Select ...
pdb-select-chain Select a set of atoms based on chain ID.  Chain ID *NOTE CTRL-middlemouse performs this function*
pdb-select-residue Select the current residue. *NOTE CTRL-Meta-middlemouse performs this function*
pdb-select-zone Select a zone of residues Start and end residues (and chain if necessary)
Navigate
pdb-forward-residue Jump to start of next residue. *NOTE CTRL-pagedown performs this function.*
pdb-back-residue Jump to start of previous residue. *NOTE CTRL-pageup performs this function.*
pdb-forward-chain Jump to start of next chain. *NOTE CTRL-Meta-pagedown performs this function.*
pdb-back-chain Jump to start of previous chain. *NOTE CTRL-Meta-pageup performs this function.*
Change value
pdb-change-alternate Change the alternate conformer character New conformer letter
pdb-change-bfactor Change the B-factor New B-factor
pdb-change-chain Change the chain ID New chain ID
pdb-change-frac2orth Convert coordinates from fractional to orthogonal (standard orthogonalisation only) If CRYST1 card present, then the values from this are used, otherwise cell prompted for
pdb-change-mutate Mutate the current residue to new type (standard conformer from protin dictionary) New residue type
pdb-change-occu Change the occupancy New occupancy
pdb-change-orth2frac Convert coordinates from orthogonal to fractional (standard orthogonalisation only) If CRYST1 card present, then the values from this are used, otherwise cell prompted for
pdb-change-residue Change the residue number New residue number
pdb-change-segid Change the SEGID New SEGID
pdb-change-type Change the residue type New residue type
Increment values
pdb-increment-bfactor Add a number to the B-factor Number to be added (-ve to subtract)
pdb-increment-centroid Move coordinates to a new centroid x, y and z of new centroid
pdb-increment-euler Rotate molecule by given Euler triplet (CCP4 convention) Alpha, beta & gamma
pdb-increment-matrix Rotate molecule by given 3x3 matrix 9 matrix elements (reading across matrix)
pdb-increment-residue Add a number to residue number Number to be added (-ve to subtract)
pdb-increment-xyz Add a vector to the coordinates Three numbers, space delimited
pdb-scale-bfactor Multiply B-factor by given factor Scale factor
pdb-scale-xyz Multiply x,y,z by given factor(s) One or three numbers (x*f1, y*f1, z*f1 or x*f1, y*f2, z*f3)
Renumber
pdb-renumber-atoms Renumber selected atoms with consecutive numbers Start number
pdb-renumber-waters Renumber selected atoms with consecutive residue numbers Start number
Tidy Up
pdb-tidy-alter Remove all alternate conformers except the one labelled A -
pdb-tidy-amino Remove all non-protein atoms -
pdb-tidy-atom2hetatm Replace ATOM with HETATM -
pdb-tidy-ca Remove all but CA records -
pdb-tidy-dehydrogenate Remove all hydrogens -
pdb-tidy-end Add END after last coordinate record -
pdb-tidy-hetatm2atom Replace HETATM with ATOM -
pdb-tidy-polyalanine Reduce to polyALA -
pdb-tidy-xyz Delete all not ATOM/HETAM records -
New ...
pdb-new-base Insert new DNA base. Positioned with P at the origin, and geometry from the protin dictionary. Single letter sequence
pdb-new-dnaseq Insert new sequence of DNA bases. All bases are positioned with P at the origin, and geometry from the protin dictionary. Starting residue number and single letter sequence.
pdb-new-hicup Insert new HETGROUP from HICUP. This requires net connection and knowledge (estimate?) of the necessary 3-letter residue code. A number of common examples can be found in the PDB-mode menu. Three letter code.
pdb-new-pdb Open PDB entry in new buffer. This requires net connection to oca.ebi.ac.uk. PDB code (e.g. 1HH1).
pdb-new-prodrg Submit highlighted atoms to PRODRG server to get a variety of topology/coordinate files in a new buffer. Highlighted region.
pdb-new-residue Insert new residue. Positioned with CA at the origin, and geometry from the protin dictionary. Single letter aminoacid code.
pdb-new-sequence Insert new residues. All residues are positioned with CA at the origin, and geometry from the protin dictionary. Starting residue number and single letter sequence.
Miscellaneous
pdb-view Open selection in rasmol -
pdb-data-cell Set unit cell. This will change the CRYST1 card in the file to reflect the new values Three cell lengths and three angles
pdb-data-spacegroup Set space group. When pdb-data-cell is next invoked, the space group in the CRYST1 card is set to new value. New space group (this is not checked against a list of valid values, so be careful).
Subroutines and other stuff the user doesn't need to know about.
pdb-ebi-sentinel
pdb-hicup-sentinel
pdb-prodrg-sentinel
pdb-view-sentinel
Sentinels for external processes -
pdb-sub-angle, pdb-sub-anglerad, pdb-sub-cross, pdb-sub-dihedral, pdb-sub-dot, pdb-sub-frac2orth, pdb-sub-len, pdb-sub-matxmat, pdb-sub-orth2frac, pdb-sub-rot2mat, pdb-sub-vecxmat Some maths functions -
pdb-sub-change, pdb-sub-change2, pdb-sub-defineregion, pdb-sub-markregion, pdb-sub-selectlocal, pdb-sub-pad Some formatting, value-changing functions -
pdb-sub-mouse-cmmouse2, pdb-sub-mouse-cmouse2, pdb-sub-geturl, pdb-sub-posturl Mouse bindings and net connection functions. -
Copyright (C) 2002 Charlie Bond C.S.Bond@dundee.ac.uk