Hi Tim,
For repetitive analyses, an approach I've taken as a non-Python programmer is to put the analysis commands in a separate cxc file, with names instead of direct atom specifications, e.g. analysis.cxc could be a text file containing several commands such as:
hbonds blort1 restrict blort2 color black
contacts blort1 restrict blort2 distanceOnly 3.6 reveal true select true; sel up
[...etc.]
...and then interactively you could keep giving different atomspecs those names and repeating the analysis, e.g. commands such as:
name blort1 #1/A,B
name blort2 #1/V
open analysis.cxc
[...maybe save or rename results files or do some other manual intervention..]
name blort1 [different-atom-spec1]
name blort2 [different-atom-spec2]
open analysis.cxc
[...etc.]
That is how I personally tend to use the "name" command: for text substitution, not involving selection.
<https://rbvi.ucsf.edu/chimerax/docs/user/commands/name.html>
This approach is not a complete automation since it does not uniquely generate output file names. Only the forEachFile option for opening a cxc file would generate unique output filenames but it only does so per single input structure, not when you have multiple different analyses within a single input structure.
<https://rbvi.ucsf.edu/chimerax/docs/user/commands/open.html#forEachFile>
I hope this helps,
Elaine
-----
Elaine C. Meng, Ph.D.
UCSF Chimera(X) team
Resource for Biocomputing, Visualization, and Informatics
Department of Pharmaceutical Chemistry
University of California, San Francisco
On Feb 1, 2026, at 5:24 PM, Elaine Meng via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
Hi Tim,
See answers interleaved below:
On Feb 1, 2026, at 11:07 AM, Timothy Springer via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
Hi, I want to do select zone and hbonds commands for about 10 objects. Is there a way to do each with a single command, similar to using mm to align multiple objects to the same target?
are there do loops or foreachobject commands?
No. I can't think of how to do it with just commands -- you may need Python, but others would have to advise on that.
hbonds #1/V restrict #1/A-B color black
hbonds #2/V restrict #2/A-B color black
select zone #1/V 3.6 #1/A,B residues true; name frozen inter_vcam_a4b1a sel
show sel atoms
select zone #1/A,B 3.6 #1/V residues true; name frozen inter_vcam_a4b1b sel
show sel atoms
for zones, can one get contacts on both sides in a single command?
Yes, if you just use "contacts" instead of "select zone."
Example: contacts #1/A,B restrict #1/V distanceOnly 3.6 reveal true select true; sel up
... where the latter promotes the selection from the contacting atoms to their whole residues.
See clashes/contacts help: <https://rbvi.ucsf.edu/chimerax/docs/user/commands/clashes.html>
I hope this helps,
Elaine
-----
Elaine C. Meng, Ph.D.
UCSF Chimera(X) team
Resource for Biocomputing, Visualization, and Informatics
Department of Pharmaceutical Chemistry
University of California, San Francisco
_______________________________________________
ChimeraX-users mailing list -- chimerax-users@cgl.ucsf.edu
To unsubscribe send an email to chimerax-users-leave@cgl.ucsf.edu
Archives: https://mail.cgl.ucsf.edu/mailman/archives/list/chimerax-users@cgl.ucsf.edu/