{"_id":"5cbf2f4f8f62fa00517abd1e","project":"5773dcfc255e820e00e1cd4d","version":{"_id":"5773dcfc255e820e00e1cd50","__v":26,"project":"5773dcfc255e820e00e1cd4d","createdAt":"2016-06-29T14:36:44.812Z","releaseDate":"2016-06-29T14:36:44.812Z","categories":["5773dcfc255e820e00e1cd51","5773df36904b0c0e00ef05ff","577baf92451b1e0e006075ac","577bb183b7ee4a0e007c4e8d","577ce77a1cf3cb0e0048e5ea","577d11865fd4de0e00cc3dab","578e62792c3c790e00937597","578f4fd98335ca0e006d5c84","578f5e5c3d04570e00976ebb","57bc35f7531e000e0075d118","57f801b3760f3a1700219ebb","5804d55d1642890f00803623","581c8d55c0dc651900aa9350","589dcf8ba8c63b3b00c3704f","594cebadd8a2f7001b0b53b2","59a562f46a5d8c00238e309a","5a2aa096e25025003c582b58","5a2e79566c771d003ca0acd4","5a3a5166142db90026f24007","5a3a52b5bcc254001c4bf152","5a3a574a2be213002675c6d2","5a3a66bb2be213002675cb73","5a3a6e4854faf60030b63159","5c8a68278e883901341de571","5cb9971e57bf020024523c7b","5cbf1683e2a36d01d5012ecd"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"category":{"_id":"5cbf1683e2a36d01d5012ecd","project":"5773dcfc255e820e00e1cd4d","version":"5773dcfc255e820e00e1cd50","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2019-04-23T13:43:31.578Z","from_sync":false,"order":13,"slug":"edit-an-app","title":"EDIT AN APP"},"user":"5767bc73bb15f40e00a28777","__v":0,"parentDoc":null,"metadata":{"title":"","description":"","image":[]},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2019-04-23T15:29:19.718Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":2,"body":"## About tool wrapping\nThe process of describing a command line tool in CWL so that it can be run as an app or used in a workflow with other tools and apps is known as *wrapping*. The tool editor is used to wrap tools.\n\nThere are two parts to wrapping a tool:\n\n  * creating a [Docker image](doc:upload-your-docker-image) containing the tool\n  * creating a **CWL description** of the tool\n\nThe Docker image contains the command line tool and any supporting files it needs in order to run (for example, fixed configuration files or dependencies).\n\nThe CWL description specifies the location of the Docker image, and defines the way in which the inputs and outputs exposed to the user of the tool are mapped to the underlying inputs, outputs and other options required by the command line tool.\n\nA CWL tool description may expose all the parameters and options available for a command line tool, but often only some parameters and options are exposed, and other more technical parameters and options are set to fixed values.\n\nWhen the tool is run in a workflow, it runs inside a Docker container created from the Docker image containing the tool and its dependencies. The execution process passes the input data to the Docker container, and retrieves the results from the container. The command line that is used to execute the tool inside the Docker container is constructed from the inputs and arguments that were specified when the tool was wrapped, and the values that have been supplied for those inputs.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/4b9ec06-introduction-to-tool-wrapping-1.png\",\n        \"introduction-to-tool-wrapping-1.png\",\n        1024,\n        193,\n        \"#f2efe8\"\n      ]\n    }\n  ]\n}\n[/block]\n## Tool wrapping components\nThere are several key components that need to be specified when wrapping a tool. Here’s a brief description of each. This [tool editor tutorial](doc:tool-editor-tutorial) looks at each component in more detail and shows how they could be defined when wrapping a real command line tool using the tool editor.\n\n* The **Docker image** contains the command line tool and supporting files if required. The Docker image needs to be saved in an image registry, usually either the [Cavatica Image Registry](doc:the-image-registry) or Docker's own image registry - [Docker Hub](https://docs.docker.com/docker-hub/).\n* The **base command** is the fixed part of the command that invokes the tool, before any options or parameters. The arguments, despite the name, are any parts of the command line after the base command which you want to be set to fixed values when the tool executes. Arguments can be specified by a prefix or a position on the command line, or both. If an argument can be positioned immediately after the base command, then optionally, you could include it in the base command section instead.\n* The **input ports** define the variable data that you want to supply to the tool when it executes. Many input ports will be files, but input ports can also have other data types, like strings, integers or structures. When a tool is placed in a workflow, an input port can either be connected to an output port of another tool, or can be used to define an input to the workflow.\n* The **output ports** define the data that the tool creates when it executes. Many outputs will be files, but output ports can also have other data types, like strings, integers or structures. When a tool is placed in a workflow, an output port can either be connected to an input port of another tool, or can be used to define an output to the workflow.\n\n## About dynamic expressions\nDynamic expressions are an important and useful concept in tool wrapping. They allow you to express the value of one parameter or option in terms of another parameter, option, or other aspect of the tool’s execution. For example, you may want to specify an output file name that is based on the name of an input file, perhaps with a suffix or a different file extension. Dynamic expressions can be used in arguments, input ports and output ports, as well as in various other places in the Tool Editor.\n\nDynamic expressions are written in JavaScript. You can enter a dynamic expression anywhere in the tool editor where you see the symbol **</>**.\n\nFor detailed information about using dynamic expressions when you wrap tools, see the documentation on [Dynamic Expressions in Tool Descriptions](doc:dynamic-expressions-in-tool-descriptions-1). The [JavaScript Cookbook](doc:javascript-cookbook-1) includes some worked examples of commonly used dynamic expressions.","excerpt":"","slug":"introduction-to-tool-wrapping","type":"basic","title":"Introduction to tool wrapping"}

Introduction to tool wrapping


## About tool wrapping The process of describing a command line tool in CWL so that it can be run as an app or used in a workflow with other tools and apps is known as *wrapping*. The tool editor is used to wrap tools. There are two parts to wrapping a tool: * creating a [Docker image](doc:upload-your-docker-image) containing the tool * creating a **CWL description** of the tool The Docker image contains the command line tool and any supporting files it needs in order to run (for example, fixed configuration files or dependencies). The CWL description specifies the location of the Docker image, and defines the way in which the inputs and outputs exposed to the user of the tool are mapped to the underlying inputs, outputs and other options required by the command line tool. A CWL tool description may expose all the parameters and options available for a command line tool, but often only some parameters and options are exposed, and other more technical parameters and options are set to fixed values. When the tool is run in a workflow, it runs inside a Docker container created from the Docker image containing the tool and its dependencies. The execution process passes the input data to the Docker container, and retrieves the results from the container. The command line that is used to execute the tool inside the Docker container is constructed from the inputs and arguments that were specified when the tool was wrapped, and the values that have been supplied for those inputs. [block:image] { "images": [ { "image": [ "https://files.readme.io/4b9ec06-introduction-to-tool-wrapping-1.png", "introduction-to-tool-wrapping-1.png", 1024, 193, "#f2efe8" ] } ] } [/block] ## Tool wrapping components There are several key components that need to be specified when wrapping a tool. Here’s a brief description of each. This [tool editor tutorial](doc:tool-editor-tutorial) looks at each component in more detail and shows how they could be defined when wrapping a real command line tool using the tool editor. * The **Docker image** contains the command line tool and supporting files if required. The Docker image needs to be saved in an image registry, usually either the [Cavatica Image Registry](doc:the-image-registry) or Docker's own image registry - [Docker Hub](https://docs.docker.com/docker-hub/). * The **base command** is the fixed part of the command that invokes the tool, before any options or parameters. The arguments, despite the name, are any parts of the command line after the base command which you want to be set to fixed values when the tool executes. Arguments can be specified by a prefix or a position on the command line, or both. If an argument can be positioned immediately after the base command, then optionally, you could include it in the base command section instead. * The **input ports** define the variable data that you want to supply to the tool when it executes. Many input ports will be files, but input ports can also have other data types, like strings, integers or structures. When a tool is placed in a workflow, an input port can either be connected to an output port of another tool, or can be used to define an input to the workflow. * The **output ports** define the data that the tool creates when it executes. Many outputs will be files, but output ports can also have other data types, like strings, integers or structures. When a tool is placed in a workflow, an output port can either be connected to an input port of another tool, or can be used to define an output to the workflow. ## About dynamic expressions Dynamic expressions are an important and useful concept in tool wrapping. They allow you to express the value of one parameter or option in terms of another parameter, option, or other aspect of the tool’s execution. For example, you may want to specify an output file name that is based on the name of an input file, perhaps with a suffix or a different file extension. Dynamic expressions can be used in arguments, input ports and output ports, as well as in various other places in the Tool Editor. Dynamic expressions are written in JavaScript. You can enter a dynamic expression anywhere in the tool editor where you see the symbol **</>**. For detailed information about using dynamic expressions when you wrap tools, see the documentation on [Dynamic Expressions in Tool Descriptions](doc:dynamic-expressions-in-tool-descriptions-1). The [JavaScript Cookbook](doc:javascript-cookbook-1) includes some worked examples of commonly used dynamic expressions.