
Awesome, thanks! On Sat, 25 Jun 2022 at 00:45, Tom Goddard <goddard@sonic.net> wrote:
Hi Pranav,
I improved the ChimeraX runscript command so it can pass arguments to a ChimeraX command file (.cxc suffix) replacing $1, $2, $3 ... in the commands with the given arguments. This will be in tomorrow's daily builds. For example,
run radcolor.cxc mymap.mrc mymap.png
where the radcolor.cxc text file contains
# Color map radially and save an image open $1 color radial palette rainbow save $2 height 512 width 512 transparentBackground true
Thanks suggesting the idea.
Tom
On Jun 24, 2022, at 12:09 PM, Tom Goddard via ChimeraX-users < chimerax-users@cgl.ucsf.edu> wrote:
Hi Pranav,
Currently ChimeraX does not have a way to substitute argument values into a *.cxc file except for the open command "foreach" option which allows substituting the file name in for $file. For simple series of commands you could define an alias, for example,
alias radcolor open $1 ; color radial palette rainbow ; save $2 height 512 width 512 transparentBackground true
This defines the radcolor command that you can use like
radcolor mymap.mrc image.png
Here's the documentation for the "alias" command
https://www.cgl.ucsf.edu/chimerax/docs/user/commands/alias.html
The other mechanism for handing arguments to a script is the "runscript" command which passes arguments to Python scripts only. I could imagine runscript being enhanced so that it works with a *.cxc command script and substitutes arguments in for $1, $2, $3, ... occurring in the script.
https://www.cgl.ucsf.edu/chimerax/docs/user/commands/runscript.html
Tom
On Jun 24, 2022, at 5:57 AM, Pranav Shah via ChimeraX-users <
chimerax-users@cgl.ucsf.edu> wrote:
Hi Team, Is it possible for one to declare a variable in a command file that can then be passed to via the chimeraX command line interface. A minimal example of something I would like to do is - command.cxc open $file color radial palette rainbow save $outfile.png height 512 width 512 transparentBackground True
In the chimeraX command line window I would then like to run open command.cxc infile.mrc outfile.png Best, Pranav -- Pranav Shah Postdoctoral Research Fellow.
Division of Structural Biology, Wellcome Trust Centre for Human Genetics, University of Oxford, Roosevelt Drive, Oxford OX3 7BN, UK _______________________________________________ ChimeraX-users mailing list ChimeraX-users@cgl.ucsf.edu Manage subscription: https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users
_______________________________________________ ChimeraX-users mailing list ChimeraX-users@cgl.ucsf.edu Manage subscription: https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users
-- Best, Pranav -- Pranav Shah Postdoctoral Research Fellow.
Division of Structural Biology, Wellcome Trust Centre for Human Genetics, University of Oxford, Roosevelt Drive, Oxford OX3 7BN, UK