[chimerax-users] using variables in command files

Tom Goddard goddard at sonic.net
Fri Jun 24 12:09:06 PDT 2022


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 at 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 at cgl.ucsf.edu
> Manage subscription:
> https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users
> 




More information about the ChimeraX-users mailing list