{"__v":31,"_id":"5640bad42b14f70d0039b8cd","category":{"__v":11,"_id":"5637e8b2fbe1c50d008cb078","pages":["5637e95797666c0d008656ba","5637ea64ee0ee60d0024ec0e","5637f110daf0840d0011dcd5","563d423e9799fb0d0004779b","5640ba77b9c4dd0d0097c827","5640bad42b14f70d0039b8cd","5640bae32b14f70d0039b8cf","5640bb0ceaede117005c99d8","565f6b770dc99e1900f24c73","56cc9eab8fa8b01b00b81f5a","56ddcb9ab4ac273200457c82"],"project":"55faf11ba62ba1170021a9a7","version":"55faf11ba62ba1170021a9aa","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-11-02T22:50:26.865Z","from_sync":false,"order":14,"slug":"describe-your-tool","title":"DESCRIBE YOUR TOOL"},"parentDoc":null,"project":"55faf11ba62ba1170021a9a7","user":"554340dfb7f4540d00fcef1d","version":{"__v":37,"_id":"55faf11ba62ba1170021a9aa","project":"55faf11ba62ba1170021a9a7","createdAt":"2015-09-17T16:58:03.490Z","releaseDate":"2015-09-17T16:58:03.490Z","categories":["55faf11ca62ba1170021a9ab","55faf8f4d0e22017005b8272","55faf91aa62ba1170021a9b5","55faf929a8a7770d00c2c0bd","55faf932a8a7770d00c2c0bf","55faf94b17b9d00d00969f47","55faf958d0e22017005b8274","55faf95fa8a7770d00c2c0c0","55faf96917b9d00d00969f48","55faf970a8a7770d00c2c0c1","55faf98c825d5f19001fa3a6","55faf99aa62ba1170021a9b8","55faf99fa62ba1170021a9b9","55faf9aa17b9d00d00969f49","55faf9b6a8a7770d00c2c0c3","55faf9bda62ba1170021a9ba","5604570090ee490d00440551","5637e8b2fbe1c50d008cb078","5649bb624fa1460d00780add","5671974d1b6b730d008b4823","5671979d60c8e70d006c9760","568e8eef70ca1f0d0035808e","56d0a2081ecc471500f1795e","56d4a0adde40c70b00823ea3","56d96b03dd90610b00270849","56fbb83d8f21c817002af880","573c811bee2b3b2200422be1","576bc92afb62dd20001cda85","5771811e27a5c20e00030dcd","5785191af3a10c0e009b75b0","57bdf84d5d48411900cd8dc0","57ff5c5dc135231700aed806","5804caf792398f0f00e77521","58458b4fba4f1c0f009692bb","586d3c287c6b5b2300c05055","58ef66d88646742f009a0216","58f5d52d7891630f00fe4e77"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-11-09T15:25:08.928Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":3,"body":"This page contains information on how to use the fields of the Inputs tab on the [Tool Editor](doc:the-tool-editor). \n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"On this page:\",\n  \"body\": \"* [Add an input port to the tool description](#section-add-an-input-port-to-the-tool-description)\\n* [Basic Information](#section-basic-information)\\n* [Additional Information](#section-additional-information)\\n* [Command Line Bindings for Inputs](#section-command-line-binding-for-inputs)\\n* [Stage Input](#section-stage-input)\\n* [Load Contents](#section-load-contents)\\n* [Example](#section-example)\"\n}\n[/block]\nThe **Inputs** tab allows you to describe the input ports of your tool. A port is a 'gateway' for data to flow in and out of your tool. You should add one input port for each input your tool takes. For instance, if your tool takes a file and an integer as input per execution, you should enter two ports; if it takes two files, one reference and one data file, and does different things to each, then you should also enter two ports. \n[block:callout]\n{\n  \"type\": \"success\",\n  \"title\": \"Note on inputs\",\n  \"body\": \"Remember that inputs in this sense include [parameters that can be adjusted in each execution](http://docs.cancergenomicscloud.org/docs/the-tool-editor#section-a-note-on-tool-inputs) as well as inputted data, like files.\"\n}\n[/block]\n<div align=\"right\"><a href=\"#top\">top</a></div>\n\n##Add an input port to the tool description\nTo add an input port to the tool description, go to the tab labeled **Inputs** on the Tool Editor. Then, click the **+** button.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/6q0z9sfCSMGp79EShPoP_-.1-1.jpeg\",\n        \"-.1-1.jpeg\",\n        \"3250\",\n        \"756\",\n        \"#72a6d0\",\n        \"\"\n      ],\n      \"caption\": \"Click + to add an input port to your tool description.\"\n    }\n  ]\n}\n[/block]\nThis will bring up a pop-up window that allows you to describe an input port.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/qf3MYSi2Trm4Hp8u41VV_--1100.jpeg\",\n        \"--1100.jpeg\",\n        \"1844\",\n        \"1066\",\n        \"#497aaf\",\n        \"\"\n      ],\n      \"caption\": \"In this window, you can describe an input port.\"\n    }\n  ]\n}\n[/block]\n<div align=\"right\"><a href=\"#top\">top</a></div>\n\n##Basic Information \n###**ID**: \nThis field can be any name you give to identify the port. It will be used to label the port with in other graphical interfaces, like the workflow editor.\n###**Type**:\n This field specifies the kind of object that should be inputted to the port from a drop-down list. The available input Types are: Files, strings, enums, ints, floats, booleans, and arrays. See Advanced features for more information on using customized input arrays to enter more complex data structures.\n\n<div align=\"right\"><a href=\"#top\">top</a></div>\n\n##Additional Information\n###Label and Description: \nThese fields allow you to add more information to describe the function of the input port. Information entered into these fields is just for your own labelling purposes, and doesn't affect the execution of the tool.\n\n<div align=\"right\"><a href=\"#top\">top</a></div>\n\n##Command line binding for inputs\nIf the data taken by the input port is fed into your tool as an option argument on the command line, then you should check the box marked Include in command line. This allows you to describe the format of the option and to specify the value that is passed in as the option argument. The way to describe the command line option is the same as for the ∫ field on the **General Information **tab:\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **Position**: This refers to the position of the command option on the command line relative to the base command. For example, '1' indicates that the option should be entered first, after the base command.\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **Prefix**: This refers to a command option that the base command can take to indicate inputs.\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ** Separate prefix with**: This allows you to specify the character that separates the prefix from the option argument: it can be either a space, or the empty string (i.e. no character separates prefix from the option argument). Note that if your command requires a separator other than space or the empty string, such as '=', you can enter this directly after the prefix and set the separator to the empty string.\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  **Value**: This refers to the fixed or dynamic expression passed in as the option argument for the option given in **Prefix**.\n   * If the **Value** field is left empty, you can pass in a value as the option argument for each execution of the tool. \n   * If the **Value** field contains a fixed value (such as an integer, string, etc) then it will be passed as the value of the option argument for every execution.\n   * Alternatively, the **Value** field can take a *dynamic* value, which is a JavaScript expression involving variables that refer to features of the execution. More details are contained in the tipbox below:\n[block:callout]\n{\n  \"type\": \"success\",\n  \"title\": \"Using dynamic expressions to give input values\",\n  \"body\": \"Suppose that your tool receives data—say, from a tool upstream in a workflow—that is not quite in the format that it expects. For example, your tool may expect just file names, not entire file paths, to be included in the command line, but may be passed file paths as inputs.\\n\\nIn cases like this, you can use string manipulation on the strings representing items that are inputted to the tool, in order to alter the string that is passed to the command line as the input for the port.\\n\\nFor more details, see [the CGC documentation on dynamic expressions in the Tool Editor](http://docs.cancergenomicscloud.org/docs/dynamic-expressions-in-tool-descriptions#section-the-self-object).\"\n}\n[/block]\nClicking **Show More** brings up extra fields on the input tab:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/ipjpHrRTYOGFDDw3G9lg_--1101.jpeg\",\n        \"--1101.jpeg\",\n        \"1828\",\n        \"1204\",\n        \"#4d6579\",\n        \"\"\n      ],\n      \"caption\": \"Extra fields on the inputs tab\"\n    }\n  ]\n}\n[/block]\nThese extra fields are:\n###Alternative Prefix: \nIf your tool inputs are included on the command line using a prefix (command option), and you have specified this [in the command line bindings](http://docs.cancergenomicscloud.org/docs/tool-input-ports#section-command-line-binding-for-inputs), you can include the alternative prefix here. This would typically be the long prefix.\n###Tool Default: \nIn this field, you can enter a brief description of what the tool does by default. This is just for the purpose of labelling the tool in the workflow editor; it doesn't affect functioning.\nCategory: You can enter a keyword that describes the tool. Again, this is just for labelling purposes.\n\n<div align=\"right\"><a href=\"#top\">top</a></div>\n##STAGE INPUT\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/mlUDnq3RQu6xgBv69cJo_Screen%20Shot%202016-02-11%20at%2013.44.47.png\",\n        \"Screen Shot 2016-02-11 at 13.44.47.png\",\n        \"798\",\n        \"226\",\n        \"#255071\",\n        \"\"\n      ],\n      \"caption\": \"Stage input\",\n      \"border\": true\n    }\n  ]\n}\n[/block]\nThe settings under **Stage Input** allow you to make a tool's input files available in the tool's working directory.\n\nFiles that are named as inputs to a tool are not, by default, in the tool's working directory. In most workflows this access is sufficient, since most tools only need to read their input files, process the data contained in them, and write new output files on the basis of this data to their working directory. However, in some cases a tool might require input files to be in its working directory, and this is where the **Stage Input** option is used.\n\n**Stage Input** allows you to modify the way files appear in a tool's working directory in two ways:\n* **Copy** files that are input to a tool to that tool's working directory. This makes the files directly available in the working directory.\n* **Link** the files input to a tool to that tool's working directory, using a symbolic link (symlink). This option is used in the following circumstances:\n * To 'pass the files through' the tool, and report them as the tool's outputs, without actually modifying the files.\n * To simplify the relative path of the input files to the tool. If you need to include the file paths of a tool's input files as arguments passed to the tool, the path will be simpler if there is a symbolic link from the input files to the tool's working directory.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"Please note that while a tool on the CGC cannot create output files outside its own working directory, it may write other files – such as config files – outside the working directory. This means that you don't need to modify a tool that is configured to write files to a different directory, so long as you do not wish to treat those files as outputs.\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"Files that are copied or linked using the **Stage Input** option will not be produced as the tool's outputs unless output port(s) are created specifically for them.\"\n}\n[/block]\nConsider the following diagram:\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/a498451-stage-input-sample-wf.png\",\n        \"stage-input-sample-wf.png\",\n        518,\n        194,\n        \"#edefed\"\n      ]\n    }\n  ]\n}\n[/block]\nIn this example, files are input to **Tool B** from **Tool A**. If **Tool B** needs the input files to be available in its working directory, you need to use the **Stage Input** setting on the **#input_file** input port on **Tool B**.\n\nTo copy the input files from **Tool A** to the working directory of **Tool B**, in order to modify them:\n1. Open **Tool B** in the Tool Editor.\n2. On the **Inputs** tab, click the tool description for the inputs port **#input_file**.\n3. Click **Stage Input** and select **Copy** from the dropdown menu,\n\nTo create symbolic links for the input files into the working directory of **Tool B**, in order to pass them through, along with other output files but not modify them:\n1. Open **Tool B** in the Tool Editor.\n2. On the **Inputs** tab, click the tool description for the inputs port **#input_file**.\n3. Click **Stage Input** and select **Link** from the dropdown menu,\n\nSince the **Link** option only results in creation of a symbolic link, it is generally faster than **Copy**. However, **Copy** might be required in certain cases. Besides writing data to files produced by other tools, you also need to select **Copy** when the tool you are configuring needs to add the output files of the previous tool in the workflow to an archive. In order to be able to archive the files, you need actual copies of the files in the tool's working directory.\n\nTo see how the **Stage Input** option is used in an actual workflow on the CGC:\n**VarScan2 Workflow from BAM** is a public workflow that contains a tool named **SAMtools Index FASTA**. This tool indexes a sequence in FASTA format and outputs a FAI index file. It is also able to output the FASTA file that has been provided as its input.\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/bab1ae5-stage-input-2.png\",\n        \"stage-input-2.png\",\n        641,\n        564,\n        \"#e3d5bc\"\n      ]\n    }\n  ]\n}\n[/block]\nTo output the FASTA file that is used as the **SAMTools Index FASTA**'s input file, configure the **#input_fasta_file** input port as **Stage Input** > **Link**. This creates a symbolic link to the input FASTA file in the working directory of **SAMtools Index FASTA** and the tool passes the FASTA file as its output, along with the generated index file.\n\n<div align=\"right\"><a href=\"#top\">top</a></div>\n\n##LOAD CONTENTS\n\nIn the context of an input port for files, the `$self` object is a JavaScript object referring to the file objects, which can be used in the **Value** field (see the documentation on dynamic expressions in tool descriptions for details).\n\nChecking the box marked **Load Contents** on the inputs tab adds an additional property to $self, namely contents, which refers to the first 64kb of the file contents.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/wYq6L2djTNu5WsgxkqyW_ip2.jpeg\",\n        \"ip2.jpeg\",\n        \"1660\",\n        \"1568\",\n        \"#bb5b5a\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n<div align=\"right\"><a href=\"#top\">top</a></div>\n\n##Example\nSuppose that I had uploaded BWA Mem to the CGC, and was describing it in the tool editor. Then, I would need to add as many input ports as the tool has inputs. In particular, I would add an input port for the thread number to be inputted. \n\nThe prefix for thread number on BAW Mem is `-t`. If I wanted to be able to set the thread number every time I used the tool, I would configure its input port description as follows:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/VhwhRYSoSN5uE2s3PZAQ_ip3.jpeg\",\n        \"ip3.jpeg\",\n        \"1838\",\n        \"1254\",\n        \"#cb5856\",\n        \"\"\n      ],\n      \"caption\": \"Example of describing a tool input port\"\n    }\n  ]\n}\n[/block]\n<div align=\"right\"><a href=\"#top\">top</a></div>","excerpt":"<a name=\"top\"></a>","slug":"tool-input-ports","type":"basic","title":"Tool Input Ports"}

Tool Input Ports

<a name="top"></a>

This page contains information on how to use the fields of the Inputs tab on the [Tool Editor](doc:the-tool-editor). [block:callout] { "type": "warning", "title": "On this page:", "body": "* [Add an input port to the tool description](#section-add-an-input-port-to-the-tool-description)\n* [Basic Information](#section-basic-information)\n* [Additional Information](#section-additional-information)\n* [Command Line Bindings for Inputs](#section-command-line-binding-for-inputs)\n* [Stage Input](#section-stage-input)\n* [Load Contents](#section-load-contents)\n* [Example](#section-example)" } [/block] The **Inputs** tab allows you to describe the input ports of your tool. A port is a 'gateway' for data to flow in and out of your tool. You should add one input port for each input your tool takes. For instance, if your tool takes a file and an integer as input per execution, you should enter two ports; if it takes two files, one reference and one data file, and does different things to each, then you should also enter two ports. [block:callout] { "type": "success", "title": "Note on inputs", "body": "Remember that inputs in this sense include [parameters that can be adjusted in each execution](http://docs.cancergenomicscloud.org/docs/the-tool-editor#section-a-note-on-tool-inputs) as well as inputted data, like files." } [/block] <div align="right"><a href="#top">top</a></div> ##Add an input port to the tool description To add an input port to the tool description, go to the tab labeled **Inputs** on the Tool Editor. Then, click the **+** button. [block:image] { "images": [ { "image": [ "https://files.readme.io/6q0z9sfCSMGp79EShPoP_-.1-1.jpeg", "-.1-1.jpeg", "3250", "756", "#72a6d0", "" ], "caption": "Click + to add an input port to your tool description." } ] } [/block] This will bring up a pop-up window that allows you to describe an input port. [block:image] { "images": [ { "image": [ "https://files.readme.io/qf3MYSi2Trm4Hp8u41VV_--1100.jpeg", "--1100.jpeg", "1844", "1066", "#497aaf", "" ], "caption": "In this window, you can describe an input port." } ] } [/block] <div align="right"><a href="#top">top</a></div> ##Basic Information ###**ID**: This field can be any name you give to identify the port. It will be used to label the port with in other graphical interfaces, like the workflow editor. ###**Type**: This field specifies the kind of object that should be inputted to the port from a drop-down list. The available input Types are: Files, strings, enums, ints, floats, booleans, and arrays. See Advanced features for more information on using customized input arrays to enter more complex data structures. <div align="right"><a href="#top">top</a></div> ##Additional Information ###Label and Description: These fields allow you to add more information to describe the function of the input port. Information entered into these fields is just for your own labelling purposes, and doesn't affect the execution of the tool. <div align="right"><a href="#top">top</a></div> ##Command line binding for inputs If the data taken by the input port is fed into your tool as an option argument on the command line, then you should check the box marked Include in command line. This allows you to describe the format of the option and to specify the value that is passed in as the option argument. The way to describe the command line option is the same as for the ∫ field on the **General Information **tab: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **Position**: This refers to the position of the command option on the command line relative to the base command. For example, '1' indicates that the option should be entered first, after the base command. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **Prefix**: This refers to a command option that the base command can take to indicate inputs. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ** Separate prefix with**: This allows you to specify the character that separates the prefix from the option argument: it can be either a space, or the empty string (i.e. no character separates prefix from the option argument). Note that if your command requires a separator other than space or the empty string, such as '=', you can enter this directly after the prefix and set the separator to the empty string. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **Value**: This refers to the fixed or dynamic expression passed in as the option argument for the option given in **Prefix**. * If the **Value** field is left empty, you can pass in a value as the option argument for each execution of the tool. * If the **Value** field contains a fixed value (such as an integer, string, etc) then it will be passed as the value of the option argument for every execution. * Alternatively, the **Value** field can take a *dynamic* value, which is a JavaScript expression involving variables that refer to features of the execution. More details are contained in the tipbox below: [block:callout] { "type": "success", "title": "Using dynamic expressions to give input values", "body": "Suppose that your tool receives data—say, from a tool upstream in a workflow—that is not quite in the format that it expects. For example, your tool may expect just file names, not entire file paths, to be included in the command line, but may be passed file paths as inputs.\n\nIn cases like this, you can use string manipulation on the strings representing items that are inputted to the tool, in order to alter the string that is passed to the command line as the input for the port.\n\nFor more details, see [the CGC documentation on dynamic expressions in the Tool Editor](http://docs.cancergenomicscloud.org/docs/dynamic-expressions-in-tool-descriptions#section-the-self-object)." } [/block] Clicking **Show More** brings up extra fields on the input tab: [block:image] { "images": [ { "image": [ "https://files.readme.io/ipjpHrRTYOGFDDw3G9lg_--1101.jpeg", "--1101.jpeg", "1828", "1204", "#4d6579", "" ], "caption": "Extra fields on the inputs tab" } ] } [/block] These extra fields are: ###Alternative Prefix: If your tool inputs are included on the command line using a prefix (command option), and you have specified this [in the command line bindings](http://docs.cancergenomicscloud.org/docs/tool-input-ports#section-command-line-binding-for-inputs), you can include the alternative prefix here. This would typically be the long prefix. ###Tool Default: In this field, you can enter a brief description of what the tool does by default. This is just for the purpose of labelling the tool in the workflow editor; it doesn't affect functioning. Category: You can enter a keyword that describes the tool. Again, this is just for labelling purposes. <div align="right"><a href="#top">top</a></div> ##STAGE INPUT [block:image] { "images": [ { "image": [ "https://files.readme.io/mlUDnq3RQu6xgBv69cJo_Screen%20Shot%202016-02-11%20at%2013.44.47.png", "Screen Shot 2016-02-11 at 13.44.47.png", "798", "226", "#255071", "" ], "caption": "Stage input", "border": true } ] } [/block] The settings under **Stage Input** allow you to make a tool's input files available in the tool's working directory. Files that are named as inputs to a tool are not, by default, in the tool's working directory. In most workflows this access is sufficient, since most tools only need to read their input files, process the data contained in them, and write new output files on the basis of this data to their working directory. However, in some cases a tool might require input files to be in its working directory, and this is where the **Stage Input** option is used. **Stage Input** allows you to modify the way files appear in a tool's working directory in two ways: * **Copy** files that are input to a tool to that tool's working directory. This makes the files directly available in the working directory. * **Link** the files input to a tool to that tool's working directory, using a symbolic link (symlink). This option is used in the following circumstances: * To 'pass the files through' the tool, and report them as the tool's outputs, without actually modifying the files. * To simplify the relative path of the input files to the tool. If you need to include the file paths of a tool's input files as arguments passed to the tool, the path will be simpler if there is a symbolic link from the input files to the tool's working directory. [block:callout] { "type": "info", "body": "Please note that while a tool on the CGC cannot create output files outside its own working directory, it may write other files – such as config files – outside the working directory. This means that you don't need to modify a tool that is configured to write files to a different directory, so long as you do not wish to treat those files as outputs." } [/block] [block:callout] { "type": "warning", "body": "Files that are copied or linked using the **Stage Input** option will not be produced as the tool's outputs unless output port(s) are created specifically for them." } [/block] Consider the following diagram: [block:image] { "images": [ { "image": [ "https://files.readme.io/a498451-stage-input-sample-wf.png", "stage-input-sample-wf.png", 518, 194, "#edefed" ] } ] } [/block] In this example, files are input to **Tool B** from **Tool A**. If **Tool B** needs the input files to be available in its working directory, you need to use the **Stage Input** setting on the **#input_file** input port on **Tool B**. To copy the input files from **Tool A** to the working directory of **Tool B**, in order to modify them: 1. Open **Tool B** in the Tool Editor. 2. On the **Inputs** tab, click the tool description for the inputs port **#input_file**. 3. Click **Stage Input** and select **Copy** from the dropdown menu, To create symbolic links for the input files into the working directory of **Tool B**, in order to pass them through, along with other output files but not modify them: 1. Open **Tool B** in the Tool Editor. 2. On the **Inputs** tab, click the tool description for the inputs port **#input_file**. 3. Click **Stage Input** and select **Link** from the dropdown menu, Since the **Link** option only results in creation of a symbolic link, it is generally faster than **Copy**. However, **Copy** might be required in certain cases. Besides writing data to files produced by other tools, you also need to select **Copy** when the tool you are configuring needs to add the output files of the previous tool in the workflow to an archive. In order to be able to archive the files, you need actual copies of the files in the tool's working directory. To see how the **Stage Input** option is used in an actual workflow on the CGC: **VarScan2 Workflow from BAM** is a public workflow that contains a tool named **SAMtools Index FASTA**. This tool indexes a sequence in FASTA format and outputs a FAI index file. It is also able to output the FASTA file that has been provided as its input. [block:image] { "images": [ { "image": [ "https://files.readme.io/bab1ae5-stage-input-2.png", "stage-input-2.png", 641, 564, "#e3d5bc" ] } ] } [/block] To output the FASTA file that is used as the **SAMTools Index FASTA**'s input file, configure the **#input_fasta_file** input port as **Stage Input** > **Link**. This creates a symbolic link to the input FASTA file in the working directory of **SAMtools Index FASTA** and the tool passes the FASTA file as its output, along with the generated index file. <div align="right"><a href="#top">top</a></div> ##LOAD CONTENTS In the context of an input port for files, the `$self` object is a JavaScript object referring to the file objects, which can be used in the **Value** field (see the documentation on dynamic expressions in tool descriptions for details). Checking the box marked **Load Contents** on the inputs tab adds an additional property to $self, namely contents, which refers to the first 64kb of the file contents. [block:image] { "images": [ { "image": [ "https://files.readme.io/wYq6L2djTNu5WsgxkqyW_ip2.jpeg", "ip2.jpeg", "1660", "1568", "#bb5b5a", "" ] } ] } [/block] <div align="right"><a href="#top">top</a></div> ##Example Suppose that I had uploaded BWA Mem to the CGC, and was describing it in the tool editor. Then, I would need to add as many input ports as the tool has inputs. In particular, I would add an input port for the thread number to be inputted. The prefix for thread number on BAW Mem is `-t`. If I wanted to be able to set the thread number every time I used the tool, I would configure its input port description as follows: [block:image] { "images": [ { "image": [ "https://files.readme.io/VhwhRYSoSN5uE2s3PZAQ_ip3.jpeg", "ip3.jpeg", "1838", "1254", "#cb5856", "" ], "caption": "Example of describing a tool input port" } ] } [/block] <div align="right"><a href="#top">top</a></div>