[Back to Charlie's software]

PDB mode for Xemacs - Version: May 2001

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, 2001 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.
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.
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 Xemacs 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")
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 (XEmacs only). 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)
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-name Change the atom name New name
pdb-change-occu Change the occupancy  New occupancy
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-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-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-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 -
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.
pdb-view Open selection in rasmol -