In the Input Arguments section of the App Editor, one can configure the input options that will be shown to the end-users of an application and how the end-users inputs will be passed back to the program.
Input Description: Provides the text that will be shown above the input option when users run the application.
Input Rendering: This dropdown specifies how the input options are shown to the end-users of the application:
stdin: If your application takes stdin, you can specify this under the "Advanced Settings" section. Putting stdin on will give the user the option to provide a text or file input which will be passed to the application as stdin.
Require users to specify this input?: If set to on, users will not be able to run the application without providing an input.
Working with Sub-arguments: It is possible to have sub-arguments (options that are shown to the user depending on whether the user has chosen a particular option before that). To create sub-arguments one has to specify them directly in the .yml config file. Read more about the .yml config file here.
Under the hood, input arguments in BioLib are passed to the main script pretty much as if they were command-line arguments.
Input Key: The value provided here is the flag that will be passed back to the script along with any input the end-user provides. Make sure this field matches exactly the naming in the code including any dashes if such are used!
For example, a simple Python script might parse arguments using the
argparse library. The code example below takes
a text input and prints it.
# define imports import argparse # read inputs provided by user parser = argparse.ArgumentParser() parser.add_argument('--name') args = parser.parse_args() print("My name is", args.name)
In the Input Arguments section, the Input Key should be set to
--name to pass the value correctly.
In this example, the arguments passed to the script will be
--name Charles Darwin.
Note that scripts may expect e.g. a file-input without any corresponding key or flag. In such cases simply leave the Input Key field empty.
Key-Value Separator: Here, you can set the Key-Value Separator. If this is left blank, space is used as the
default character (as in the example above). If your script expects a particular flag to be separated from the value
passed by say an equal sign (for example
--type=a ) then this could be specified as follows:
Option Display Name and Option Value: The Option Display Name is the option that will be shown to the user of an application, e.g. in a drop-down or radio select menu. The Option Value is the value that will be passed back to the script when a user chooses a particular option.
Continuing the example above the user of the application would be presented with the following option:
If a user chooses Type A, this will be passed as
Default value: Allows you to provide a default value. In particular, it can be very useful for allowing users of an application to try out the application with an example input.