If you copied a tool script that runs on your local computer, you might notice that all the parameters are hard-coded. The next step will be to identify the tool's inputs that should be exposed to users.
First, select a portion of the script you want to replace with an input. As a simple example, consider the line of code below that makes a plot of a line with a given slope, y-intercept, and graph title:
makeplot(slope, intercept, title)
To allow users to set the slope to a different value when launching the tool, simply highlight "slope" and right click. Once you do this, just click on the button that appears.
Next, you can configure various parameter properties, detailed below.
Parameter name: Give the parameter a simple, human-readable name.
Description: Give the parameter a brief description about what it is. If you want to link to a specific documentation page, you can embed links in the description with Markdown syntax: [text](url).
Parameters are assumed to be single items (i.e. having cardinality of 1). We have plans for a "variable list" option that will allow users to duplicate the input element on the form as many times as they want. Values from those elements will be combined in a comma-separated list and injected into the code.
- String: A series of characters, excluding the enclosing quotes.
- Integer: A whole number (can be negative, zero, or positive).
- Double: A number that can have fractional parts, expressed in decimal notation. For our purposes here, we ignore the technical differences between a double and other floating-point variable types.
- Boolean: A binary variable (e.g. true/false) that can also be set to toggle between two options.
- File: A file or folder that can be accessed through Ontologic's data browser.
If you are used to running your tool in the context of your local file system, the notion of a file as an explicit input may be confusing. For example, your code might contain hard-coded references to a path to your data storage.
When Ontologic runs a tool, input files are copied into the root directory of the tool's container. That means you can replace the entire path to a local file with a file input parameter in your script.
Settings: The settings dropdown provides additional control over how users can interact with the parameters.
- Required: If this box is checked, the tool won't launch unless this parameter is set.
- Show help text: Checking this box will allow you to provide some help text that appears when the parameter is unset.
- UI element presentation: Depending on the type of parameter, you will see different options for how it will be presented. Some of these options allow you to place constraints on how the parameter is set. For example, you can constrain a string input to a set of options by selecting the "Dropdown" setting and providing a comma-separated list of options. The below table lists out all of the "basic" and "constrained" elements for each parameter type.
Default value: For all parameter types other than files, you can provide a default value for the parameter.
Once you click the "Done Editing" button, you'll see the parameter you just added as an entry in a list to the right of the tool script. You can repeat the same process for any other tool inputs you want to expose.
To make any changes to a parameter, just click on its entry in the to go back to the editor. You can also delete the parameter from the editor by clicking on the three dots in the upper right-hand corner.