Dear all,

I received two answers to my question.

Either call the function as part of cmd.do('function') or import it into my 
script and call it that way (see below):

"You need to import the colorbyrmsd.py script within your script, then you can 
call it that way.  For example your script could say:

import colorbyrmsd as cbr

for obj in seleobjs:
  cmd.enable(obj)
  cbr.colorbyrmsd(obj,target)"

Thank you both for your help!
Best regards,

Zuben

________________________________
From: Mooers, Blaine H.M. (HSC) <blaine-moo...@ouhsc.edu>
Sent: Saturday, October 31, 2020 5:59 PM
To: Brown, Zuben <zb2...@cumc.columbia.edu>
Subject: [EXTERNAL] RE: How to iterate commands in pymol

Hi Zuben,

Good question!

ColorByRMSD is described here 
https://urldefense.proofpoint.com/v2/url?u=https-3A__pymolwiki.org_index.php_ColorByRMSD&d=DwIFAg&c=G2MiLlal7SXE3PeSnG8W6_JBU6FcdVjSsBSbw6gcR0U&r=8AY7h2N3TQ7k7n9RDhxT46t0ViqfY3ViGGLPrQZPtGw&m=2AkS9-9GiZXwGwqONju_wOfjSdAj3CjsKQUt50x7cBA&s=r2yosmTOrZ53GB7PLAAUYfXQpvhQKkCSsQkNyawkJR8&e=
 .
The script is under a BSD-2-Clause License.

You have to "run colorbyrmsd.py" to load the colorbyrmd function into memory 
that is in this file.

The Python function colorbyrmsd() has been extended so that it can act like a 
command in the PyMOL macro language.
Such commands can be executed in your Python "for loop" by using the command 
inside of quotes as the argument to cmd.do().
For example,

cmd.do("colorbyrmsd 1ake, 4ake")

I know. It is silly to a convert a Python function to a PML command than call 
this command from Python, but this
approach requires the least amount of effort on your part.

Best regards,

Blaine

Blaine Mooers, Ph.D.
Associate Professor
Department of Biochemistry and Molecular Biology
College of Medicine
University of Oklahoma Health Sciences Center
S.L. Young Biomedical Research Center (BRC) Rm. 466
975 NE 10th Street, BRC 466
Oklahoma City, OK 73104-5419

________________________________________
From: Brown, Zuben [zb2...@cumc.columbia.edu]
Sent: Saturday, October 31, 2020 3:36 PM
To: PyMOL-users@lists.sourceforge.net
Subject: [EXTERNAL] [PyMOL] How to iterate commands in pymol

Hi,

I'd like to iterate using a script in pymol but one of the commands I'd like to 
use does not have an associated cmd.API.
For example, how do I run:

for obj in seleobjs:
cmd.enable(obj)
colorbyrmsd(obj, target)   <--- This third line doesn't work since colorbyrmsd 
does not have a cmd.colorbyrmsd.

Is there a way I can run something like:
cmd.executecommand("colorbyrmsd {0}, target".format(obj))  ?

Best regards,

Zuben
_______________________________________________
PyMOL-users mailing list
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
Unsubscribe: 
https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe

Reply via email to