Hi Tomoko,

On Mon, 05 May 2008 18:26:17 +0900, Tomoko Niwa <tmk.n...@gmail.com>
wrote:

> Thanks for kind advices.
> 
> Whatif and PISA worked excellently, but I want to get the list within Pymol.
> 
> 
> By parsing the pymol modules, I found
> 
> hb = cmd.find_pairs("((byres "+sss1+") and n;n)",
>                               "((byres "+sss1+") and n;o)",mode=1,
>                               cutoff=3.7,angle=55,
>                               state1=state,state2=state)
> 
> in util.py. Is it possible to get a list of main-chain hydrogen bonds with
> this function?

Yes it is.  I thought this was a useful idea, so I've just scribbled together
a script to do just that and it is attached.

You can load it the usual way ("run print_hb_list.py") and then run it
with:

   print_hb <selection>

Warning, if you have waters in your selection it will mess it up, so try:

  print_hb 1nzl &! resn hoh

I haven't fixed that part yet.  You may wish to alter the formatting of the
output, but I copied the example in your first e-mail:

 /GLY`56/N  /ASN`181/O  2.86
 /TYR`26/N  /VAL`182/O  2.92
 /ASN`54/N  /THR`183/O  2.95
 /ASN`52/N  /TRP`185/O  2.92
 
In my case the PDB file had no "chain" identifier.

Cheers,
Rob
-- 
Robert L. Campbell, Ph.D.
Senior Research Associate/Adjunct Assistant Professor 
Botterell Hall Rm 644
Department of Biochemistry, Queen's University, 
Kingston, ON K7L 3N6  Canada
Tel: 613-533-6821            Fax: 613-533-2497
<robert.campb...@queensu.ca>    http://pldserver1.biochem.queensu.ca/~rlc
from pymol import cmd

def print_hb(selection):
  hb = cmd.find_pairs("((byres "+selection+") and n;n)","((byres "+selection+") and n;o)",mode=1,cutoff=3.7,angle=55)

  pair1_list = []
  pair2_list = []
  dist_list = []
  for pairs in hb:
    cmd.iterate("%s and ID %s" % (pairs[0][0],pairs[0][1]), 'print "%s/%3s`%s/%s " % (chain,resn,resi,name),')
    cmd.iterate("%s and ID %s" % (pairs[1][0],pairs[1][1]), 'print "%s/%3s`%s/%s " % (chain,resn,resi,name),')
    print "%.2f" % cmd.dist("%s and ID %s" % (pairs[0][0],pairs[0][1]),"%s and ID %s" % (pairs[1][0],pairs[1][1]))

cmd.extend("print_hb",print_hb)

Reply via email to