Hi, I'm trying to cycle through the various protonation states of a Histidine residue (HIE,HIP,HID). I have resn and the residue number stored as 'curr_state' and 'i' respectively. My first shot at a function looked basically like this (the real function has a a doc string and some gunk to set up curr_state and i):
cmd.remove('(hydro and neighbor %s/ND1,NE2)' % i) if curr_state == 'HIE': cmd.alter('%s/' % i,'resn="HID"') elif curr_state == 'HID': cmd.alter('%s/' % i,'resn="HIP"') elif curr_state == 'HIP': cmd.alter('%s/' % i,'resn="HIE"') cmd.h_add('(%s/)'%i) cmd.sort() After I run this, it looks like nothing has changed. I can use something like iterate (114/),print resn to see that the resn has in fact changed, but the hydrogens end up right where they were when I started. I've tried progressively more complex things, like this: cmd.remove('(hydro and neighbor %s/ND1,NE2)' % i) if curr_state == 'HIE': print "Changing HIE to HID" cmd.alter('%s/' % i,'resn="HID"') cmd.alter('%s/ND1' % i,'formal_charge=1.0') cmd.h_add('%s/ND1' % i) cmd.alter('%s/NE2' % i,'formal_charge=0.0') cmd.iterate('%s/ND1,NE2'%i,'print formal_charge,partial_charge') elif curr_state == 'HID': print "Changing HID to HIP" cmd.alter('%s/' % i,'resn="HIP"') cmd.alter('%s/ND1' % i,'formal_charge=1.0') cmd.h_add('%s/ND1' % i) cmd.alter('%s/NE2' % i,'formal_charge=1.0') cmd.h_add('%s/NE2' % i) cmd.iterate('%s/ND1,NE2'%i,'print formal_charge,partial_charge') elif curr_state == 'HIP': print "Changing HIP to HIE" cmd.alter('%s/' % i,'resn="HIE"') cmd.alter('%s/ND1' % i,'formal_charge=0.0') cmd.alter('%s/NE2' % i,'formal_charge=1.0') cmd.h_add('%s/NE2' % i) cmd.iterate('%s/ND1,NE2'%i,'print formal_charge,partial_charge') cmd.sort() But I think I may just be on the wrong track. The last snippet *appears* to work for NE2 (and not for ND1), but I think that's just because the his was an HIE to begin with. Any hints? Thanks, -michael -- This isn't a democracy;| _ |Michael Lerner it's a cheer-ocracy. | ASCII ribbon campaign ( ) | Michigan -Torrence, Bring It On| - against HTML email X | Biophysics | / \ | mler...@umich