like Vorländer,Matthias Kopano reacted to your message:

From: Eric Pettersen <pett@cgl.ucsf.edu>
Sent: Thursday, January 30, 2025 10:34:32 PM
To: Vorländer,Matthias Kopano <matthias.vorlaender@imp.ac.at>
Cc: ChimeraX-users@cgl.ucsf.edu <chimerax-users@cgl.ucsf.edu>
Subject: Re: [chimerax-users] Add help for reusable ChimeraX script that takes command line arguments?
 
Hi Matthias,
The short answer is nope. :-)  The longer answer is that there are two approaches we can think of, one of which is easy but somewhat ugly, and the other is more work but nicer.  They are:

1) [easy, somewhat inelegant]  Put an “echo” command at the beginning of your script that describes the expected arguments.  The message will appear every time you run the script, and you will still get some kind of error from the remainder of the script.

2) [more work, but nicer]  Have runscript execute a trivial Python wrapper program that checks the number of arguments the script was given and puts out a “usage” message if the number isn’t the expected number.  Otherwise the Python wrapper in turn executes “runscript” with the actual command script with the given arguments.

--Eric

Eric Pettersen
UCSF Computer Graphics Lab


On Jan 30, 2025, at 2:41 AM, Vorländer,Matthias Kopano via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:

Hi, 
 
It’s me again 😉  I wondered how I can add a help page to a re-usable ChimeraX script that is run  viarunscript.

I saved the following script in my ChimeraX presets:
 
#Required arguments: first is the uniprot ID, second is the model ID that will be used for mapping!
alphafold fetch $1
#get the missense data
open $1 fromDatabase alpha_missense format amiss
#associate missense data to structure
mutationscores structure $2
#label each residue with matric
mutationscores label #1 amiss height 3
#define a new score called avg by avergaing over all substitution scores
mutationscores define avg fromScore amiss setAttribute true combine mean
#color by avg missense score
color byattribute r:avg $2 target csab palette palette bluered range full
#scale cartoon by acg missense score
cartoon byattribute r:avg #!$2
 
and then defined an alias in my startup commands so I don’t need to type the full path

alias map_missense runscript /Users/matthias.vorlaender/Documents/ChimeraX_presets/map_missense.cxc $1 $2
 
Is there a way to display the expected user inputs when the script is called without arguments?
 
Cheers,
 
Matthias
_______________________________________________
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/