Command Line: argument files

Command Line: summary
Command Line: introduction
Command Line: basic usage
Command Line: advanced usage
Command Line: argument files


Argument files

If you want to save a set of arguments to reuse, you can save them in a text file, say argfile.txt, and read them into Jalview with

  jalview --argfile=argfile.txt
  

The argument file has one argument and value per line, still using the double-dash ('--') before the argument name, and separating the argument and value with an equals sign ('=').
Because the argument file is read by the application and not read by the shell, you do not need to escape any values -- all spaces will be read as part of the value until the end of the line.
You can add comments to a line by starting the line with an octothorpe (hash, pound-sign '#').
e.g.
File argfile.txt
--nonews
--nosplash
--open=[nowrap,colour=gecos-flower,showannotations]examples/plantfdx.fa
--features=examples/plantfdx.features
--annotations=examples/plantfdx.annotations
--image=images/alignment.png
--scale=2.5
#--scale=10
# let's see what's happening
#--headless

Because --argfiles takes a filename argument, and multiple --argfiles can be read on the command line, you can also use file globs to specify multiple --argfile values. If you produce an argument file for each set of alignment files that you wish to associate then you can act on all of them with, e.g.

  jalview --argfile=*/argfile.txt --headless
  

You can even read argument files from within argument files, e.g.

  jalview --argfile=argfile*.txt --headless
  
File argfile1.txt
--open=file1.fa
--argfile=myfavouriteformattingargfile.txt
--argfile=mysecondfavouriteimageargfile.txt
File myfavouriteformattingargfile.txt
--wrap
--showannotations
--annotations={dirname}/{basename}.annots
File mysecondfavouriteimageargfile.txt
--image=images/{basename}.png
--width=1920
--height=1080

If a "loop" of argument files is detected then Jalview will refuse to play (which is a Good Thing).

Only argument files

When you use an --argfile argument, all other non-initialising arguments on the command line will be ignored. Only the initialising arguments and any and all --argfiles arguments on the command line will be used. You can also set initialising arguments in argument files.

Even more substitutions

When adding values that can use substitutions within argument files, there are two additional substitutions that are made:
{argfilebasename} - replaced with the base of the filename of the argument file (i.e. without directory path or file extension).
{argfiledirname} - replaced with the path to the filename of the argument file.

Another amusing substitution you can make in argument files is the {n} substitution, combined with an -npp increment at the start (or end) of the argument file, which gives the potential of having multiple argument files with the exact same content, or even re-using the same argument file multiple times. e.g.
File alignment.argfile
--open={argfilebasename}-{n}.fa
--wrap
--output={basename}.stk
--close
--npp

  jalview --argfile alignment.argfile --argfile alignment.argfile --headless
  
would be processed like
  jalview --open=alignment-0.fa --wrap --output=alignment-0.stk --close --open=alignment-1.fa --wrap --output=alignment-1.stk --close --headless
  


Return to Command Line: summary.