[Chimera-users] Find Hbonds in batch

Eric Pettersen pett at cgl.ucsf.edu
Mon May 7 19:30:05 PDT 2007

On May 4, 2007, at 12:45 AM, Stefan Bienert wrote:

> Hello Chimera fans!
> Is there a way to use chimera for finding hydrogen bonds for tons of
> molecules?
> I'm thinking of something like a command line script, which loads a  
> pdb
> file, fetches the hbonds and writes them to a file.
> I got around 1000 pdb files and therefore doing everything manually is
> not an option ;-)

If you don't want to learn/write Python code, the most  
straightforward way to do this I can think of is to loop through your  
files in the Unix shell, calling the no-interface version of Chimera  
for each one.  Something like this (if your shell has csh-like  
syntax, e.g. tcsh):

foreach pdb (*.pdb)
	echo $pdb
	chimera --nogui $pdb hbonds.com
	mv hbonds.out $pdb:r.hbonds

You would want to be in the directory with your "1000 pdb files" in  
order for the "*.pdb" to match.  The "--nogui" arg to Chimera means  
don't bring up the user interface.  The other two args are the PDB  
file to open and then a script to run to write the hbonds.  The "mv"  
command moves the hbond info into a name specific to the PDB file  
(the same name as the PDB file but with ".pdb" changed to  
".hbonds").  The hbonds.com script would be something like:

hbonds savefile hbonds.out batch true

(adding other arguments to taste)

If you are willing to use Python then you have the ability to move  
the loop inside Chimera and thereby only call Chimera once, which  
will be faster but which might run into issues of memory usage.   
Regardless, the H-bond-finding code is not terribly fast (it's  
complex and also written in Python) and will likely takes 10s of  
seconds per structure, so we're talking about several hours to  
process that number of files.


                         Eric Pettersen
                         UCSF Computer Graphics Lab
                         pett at cgl.ucsf.edu

More information about the Chimera-users mailing list