{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","settings":"","results":{"codes":[]},"params":[]},"next":{"description":"","pages":[]},"title":"Set suggested input values for CWL v1.x apps","type":"basic","slug":"set-suggested-input-values-for-cwl-v1x-apps","excerpt":"","body":"On this page, you will learn how to set suggested input values for your CWL v1.x app. Suggested values are predefined input values for inputs in an app, usually configured for commonly used input files such as reference genomes or other commonly used input values. When you run an app that has suggested input values configured for at least one of its file inputs, you are prompted whether to actually set those values as inputs on their respective input ports, which is done in a single click of a button. \n\nTo configure your CWL v1.x app to use suggested files, you will have to make slight modifications to the app's CWL code, as follows: \n1. [Navigate to a project](doc:view-a-project) on CAVATICA.\n2. Open the **Apps** tab.\n3. Click the name of the app for which you want to set suggested input files. You can now see app details.\n4. In the top-right corner click **Edit**. Depending on whether you are editing a tool or workflow, the Tool Editor or Workflow Editor opens.\n5. Click the **Code** tab. You can now see the CWL code of the app.\n6. Find the `inputs` list in the app's CWL code. Each of the items in the list represents one of the app's inputs. \n\nOnce you have reached the app's CWL code, continue by setting suggested [input files](#section-set-suggested-input-files) or [non-file values](#section-set-suggested-input-values-for-non-file-inputs).\n\n### Set suggested input files \n\nTo be able to set a file as suggested for an app's input port, you have to upload it to CAVATICA first, or use a file that is available in Public Reference Files or Public Test Files galleries. When you execute an app that has suggested files configured for at least one of its input ports, the files are copied to the execution project if they are not already present in that project or in one of your other projects. Note that only the root directory of the execution project is checked when verifying whether a suggested file already exists in that project. The user who is running the app needs Copy access in the project where the suggested file is stored. All users have Copy access for the Public Reference Files and Public Test Files galleries, so we suggest using these files when possible. \n\nWhen you find the file input for which you want to configure a suggested input file, add the code in the following format to it:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"\\\"sbg:suggestedValue\\\": {\\n                \\\"class\\\": \\\"File\\\",\\n                \\\"path\\\": \\\"<file-id>\\\",\\n                \\\"name\\\": \\\"<file-name>\\\"\\n            },\",\n      \"language\": \"json\",\n      \"name\": \"CWL\"\n    }\n  ]\n}\n[/block]\n\nTo get the ID of a file, click the file name in the list under the **Files** tab in a project and copy the file ID from the URL. To get the ID via the API, you can [list files](doc:list-files-primary-method) in a project or folder. \n\nFor example, if configuring the Homo sapiens reference FASTA file for the hg19 assembly as a suggested input file, the code above with actual values would be:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"\\\"sbg:suggestedValue\\\": {\\n                \\\"class\\\": \\\"File\\\",\\n                \\\"path\\\": \\\"5772b6df507c1752674486ee\\\",\\n                \\\"name\\\": \\\"ucsc.hg19.fasta\\\"\\n            },\",\n      \"language\": \"json\",\n      \"name\": \"CWL\"\n    }\n  ]\n}\n[/block]\nThis is what the code for the whole input in the `inputs` section would look like when a suggested file is added (the code has been truncated for brevity):\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"\\\"inputs\\\": [\\n...\\n        {\\n            \\\"sbg:category\\\": \\\"File inputs\\\",\\n            \\\"sbg:suggestedValue\\\": {\\n                \\\"class\\\": \\\"File\\\",\\n                \\\"path\\\": \\\"5772b6df507c1752674486ee\\\",\\n                \\\"name\\\": \\\"ucsc.hg19.fasta\\\"\\n            },\\n            \\\"id\\\": \\\"in_reference\\\",\\n            \\\"type\\\": \\\"File?\\\",\\n            \\\"inputBinding\\\": {\\n                \\\"prefix\\\": \\\"--reference\\\",\\n                \\\"shellQuote\\\": false,\\n                \\\"position\\\": 11\\n            },\\n            \\\"label\\\": \\\"Reference file\\\",\\n            \\\"doc\\\": \\\"Reference file. This file is used for compression/decompression of CRAM files. Please provide reference file when using CRAM input/output file.\\\",\\n            \\\"sbg:fileTypes\\\": \\\"FASTA, FASTA.GZ, FASTA.BGZF, GZ, BGZF\\\"\\n        },\\n...\\n]\",\n      \"language\": \"json\",\n      \"name\": \"CWL\"\n    }\n  ]\n}\n[/block]\n#### Providing secondary files along with suggested files\n\nAs some kinds of files that are often set as suggested require [secondary files](https://docs.sevenbridges.com/page/secondary-files), this is done by adding the `secondaryFiles` array in the `sbg:suggestedValue` object, as follows:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"\\\"sbg:suggestedValue\\\": {\\n    \\\"class\\\": \\\"File\\\",\\n     \\\"path\\\": \\\"5772b6df507c1752674486ee\\\",\\n     \\\"name\\\": \\\"ucsc.hg19.fasta\\\",\\n     \\\"secondaryFiles\\\": [\\n         {\\n             \\\"class\\\": \\\"File\\\",\\n             \\\"path\\\": \\\"578cf94a507c17681a3117e8\\\",\\n             \\\"name\\\": \\\"ucsc.hg19.fasta.fai\\\"\\n         },\\n         {\\n             \\\"class\\\": \\\"File\\\",\\n             \\\"path\\\": \\\"5c9ce4737369c402ad8a3c41\\\",\\n             \\\"name\\\": \\\"ucsc.hg19.dict\\\"\\n          }\\n     ]\\n},\",\n      \"language\": \"json\",\n      \"name\": \"CWL\"\n    }\n  ]\n}\n[/block]\nEach of the secondary file elements has the same structure as standard suggested files, so the values you need to provide are file ID (entered as the value for the `path` key) and file name. Secondary files will also be copied to the execution project unless they already exist at the root of that project.\n\n### Set suggested input values for non-file inputs \n\nSuggested input values can also be configured for all types of non-file inputs and entered in the CWL code as simple key:value pairs, where the key is `sbg:suggestedValue`, same as for file inputs. Some examples of suggested non-file input values are:\n\n* `“sbg:suggestedValue”: true`\n* `“sbg:suggestedValue”: “string value”`\n* `“sbg:suggestedValue”: [1, 2, 3]`\n\nIn the CWL code, the key:value pair is placed inside the corresponding input port, as follows:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"sbg:category\\\": \\\"Config Inputs\\\",\\n  \\t\\\"sbg:suggestedValue\\\": \\\"rnaseq\\\",\\n    \\\"id\\\": \\\"sort_by_tag\\\",\\n    \\\"type\\\": \\\"string?\\\",\\n    \\\"inputBinding\\\": {\\n        \\\"prefix\\\": \\\"-t\\\",\\n        \\\"shellQuote\\\": false,\\n        \\\"position\\\": 5\\n        },\\n     \\\"label\\\": \\\"Sort by value of tag\\\",\\n     \\\"doc\\\": \\\"Sort first by the value in the alignment tag, then by position or name (if also using -n).\\\"\\n},\",\n      \"language\": \"json\",\n      \"name\": \"CWL\"\n    }\n  ]\n}\n[/block]","updates":[],"order":1,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"60dc4efa04049900315c21f0","createdAt":"2021-06-30T11:01:14.258Z","user":"5767bc73bb15f40e00a28777","category":{"sync":{"isSync":false,"url":""},"pages":[],"title":"Tool wrapping tips and tricks","slug":"tool-wrapping-tips-and-tricks","order":13,"from_sync":false,"reference":false,"_id":"5eb01f202654a20136813093","createdAt":"2020-05-04T13:56:48.765Z","version":"5773dcfc255e820e00e1cd50","project":"5773dcfc255e820e00e1cd4d","__v":0},"version":{"version":"1.0","version_clean":"1.0.0","codename":"","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"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","5dc15666a4f788004c5fd7d7","5eaff69e844d67003642a020","5eb00899b36ba5002d35b0c1","5eb0172be179b70073dc936e","5eb01b42b36ba5002d35ebba","5eb01f202654a20136813093","5eb918ef149186021c9a76c8","5f0839d3f4b24e005ebbbc29","5f893e508c9862002d0614a9","6024033e2b2f6f004dfe994c","60a7a12f9a06c70052b7c4db","60a7ab97266a4700161507c4","60b0c84babba720010a8b0b5"],"_id":"5773dcfc255e820e00e1cd50","__v":39,"createdAt":"2016-06-29T14:36:44.812Z","releaseDate":"2016-06-29T14:36:44.812Z","project":"5773dcfc255e820e00e1cd4d"},"project":"5773dcfc255e820e00e1cd4d","__v":0,"parentDoc":null}

Set suggested input values for CWL v1.x apps


On this page, you will learn how to set suggested input values for your CWL v1.x app. Suggested values are predefined input values for inputs in an app, usually configured for commonly used input files such as reference genomes or other commonly used input values. When you run an app that has suggested input values configured for at least one of its file inputs, you are prompted whether to actually set those values as inputs on their respective input ports, which is done in a single click of a button.  To configure your CWL v1.x app to use suggested files, you will have to make slight modifications to the app's CWL code, as follows:  1. [Navigate to a project](doc:view-a-project) on CAVATICA. 2. Open the **Apps** tab. 3. Click the name of the app for which you want to set suggested input files. You can now see app details. 4. In the top-right corner click **Edit**. Depending on whether you are editing a tool or workflow, the Tool Editor or Workflow Editor opens. 5. Click the **Code** tab. You can now see the CWL code of the app. 6. Find the `inputs` list in the app's CWL code. Each of the items in the list represents one of the app's inputs.  Once you have reached the app's CWL code, continue by setting suggested [input files](#section-set-suggested-input-files) or [non-file values](#section-set-suggested-input-values-for-non-file-inputs). ### Set suggested input files  To be able to set a file as suggested for an app's input port, you have to upload it to CAVATICA first, or use a file that is available in Public Reference Files or Public Test Files galleries. When you execute an app that has suggested files configured for at least one of its input ports, the files are copied to the execution project if they are not already present in that project or in one of your other projects. Note that only the root directory of the execution project is checked when verifying whether a suggested file already exists in that project. The user who is running the app needs Copy access in the project where the suggested file is stored. All users have Copy access for the Public Reference Files and Public Test Files galleries, so we suggest using these files when possible.  When you find the file input for which you want to configure a suggested input file, add the code in the following format to it: [block:code] { "codes": [ { "code": "\"sbg:suggestedValue\": {\n \"class\": \"File\",\n \"path\": \"<file-id>\",\n \"name\": \"<file-name>\"\n },", "language": "json", "name": "CWL" } ] } [/block] To get the ID of a file, click the file name in the list under the **Files** tab in a project and copy the file ID from the URL. To get the ID via the API, you can [list files](doc:list-files-primary-method) in a project or folder. For example, if configuring the Homo sapiens reference FASTA file for the hg19 assembly as a suggested input file, the code above with actual values would be: [block:code] { "codes": [ { "code": "\"sbg:suggestedValue\": {\n \"class\": \"File\",\n \"path\": \"5772b6df507c1752674486ee\",\n \"name\": \"ucsc.hg19.fasta\"\n },", "language": "json", "name": "CWL" } ] } [/block] This is what the code for the whole input in the `inputs` section would look like when a suggested file is added (the code has been truncated for brevity): [block:code] { "codes": [ { "code": "\"inputs\": [\n...\n {\n \"sbg:category\": \"File inputs\",\n \"sbg:suggestedValue\": {\n \"class\": \"File\",\n \"path\": \"5772b6df507c1752674486ee\",\n \"name\": \"ucsc.hg19.fasta\"\n },\n \"id\": \"in_reference\",\n \"type\": \"File?\",\n \"inputBinding\": {\n \"prefix\": \"--reference\",\n \"shellQuote\": false,\n \"position\": 11\n },\n \"label\": \"Reference file\",\n \"doc\": \"Reference file. This file is used for compression/decompression of CRAM files. Please provide reference file when using CRAM input/output file.\",\n \"sbg:fileTypes\": \"FASTA, FASTA.GZ, FASTA.BGZF, GZ, BGZF\"\n },\n...\n]", "language": "json", "name": "CWL" } ] } [/block] #### Providing secondary files along with suggested files As some kinds of files that are often set as suggested require [secondary files](https://docs.sevenbridges.com/page/secondary-files), this is done by adding the `secondaryFiles` array in the `sbg:suggestedValue` object, as follows: [block:code] { "codes": [ { "code": "\"sbg:suggestedValue\": {\n \"class\": \"File\",\n \"path\": \"5772b6df507c1752674486ee\",\n \"name\": \"ucsc.hg19.fasta\",\n \"secondaryFiles\": [\n {\n \"class\": \"File\",\n \"path\": \"578cf94a507c17681a3117e8\",\n \"name\": \"ucsc.hg19.fasta.fai\"\n },\n {\n \"class\": \"File\",\n \"path\": \"5c9ce4737369c402ad8a3c41\",\n \"name\": \"ucsc.hg19.dict\"\n }\n ]\n},", "language": "json", "name": "CWL" } ] } [/block] Each of the secondary file elements has the same structure as standard suggested files, so the values you need to provide are file ID (entered as the value for the `path` key) and file name. Secondary files will also be copied to the execution project unless they already exist at the root of that project. ### Set suggested input values for non-file inputs  Suggested input values can also be configured for all types of non-file inputs and entered in the CWL code as simple key:value pairs, where the key is `sbg:suggestedValue`, same as for file inputs. Some examples of suggested non-file input values are: * `“sbg:suggestedValue”: true` * `“sbg:suggestedValue”: “string value”` * `“sbg:suggestedValue”: [1, 2, 3]` In the CWL code, the key:value pair is placed inside the corresponding input port, as follows: [block:code] { "codes": [ { "code": "{\n \"sbg:category\": \"Config Inputs\",\n \t\"sbg:suggestedValue\": \"rnaseq\",\n \"id\": \"sort_by_tag\",\n \"type\": \"string?\",\n \"inputBinding\": {\n \"prefix\": \"-t\",\n \"shellQuote\": false,\n \"position\": 5\n },\n \"label\": \"Sort by value of tag\",\n \"doc\": \"Sort first by the value in the alignment tag, then by position or name (if also using -n).\"\n},", "language": "json", "name": "CWL" } ] } [/block]