I am writing a function in python to get rms_cur for a peripheral area of a pair of proteins after aligning on a core area. Because my proteins are homologs and not exact matches, I am running align with 0 cycles first, to create an alignment object to pass to rms_cur. I am having trouble with the "object=" argument to cmd.align, which if I understand right is just a name to which align will assign an object it creates so I can use it later (a way to get an object as output). This works fine at the pymol command line, and I get an object named my_align that I can use:
align mobile and periph_sel, target and periph_sel, cycles=0, transform=0, object=my_align
Then I write a python function with the following code:
# align only on core residues cmd.align('%s and %s'%(mobile, core_sel), '%s and %s'%(target, core_sel)) # without moving proteins, create an alignment object of matching atoms in peripheral areas cmd.align('%s and %s'%(mobile, periph_sel), '%s and %s'%(target, periph_sel), cycles=0, transform=0, object=my_align) # use that alignment to get the rms_cur of the peripheral areas my_rms = cmd.rms_cur('%s and %s'%(mobile, my_align), '%s and %s'%(target, my_align), matchmaker=-1)
When I run the function in pymol, python complains the object is not defined:
cmd.align('%s and %s'%(mobile, periph_sel), '%s and %s'%(target, periph_sel), cycles=0, transform=0, object=my_align) NameError: name 'my_align' is not defined
How can I use the "object=" argument of align from python so that pymol creates the object and I can then use it from my python code?