{"__v":0,"_id":"57f66175cecf1517001f02d8","category":{"__v":0,"_id":"57bdf84d5d48411900cd8dc0","project":"55faf11ba62ba1170021a9a7","version":"55faf11ba62ba1170021a9aa","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-08-24T19:41:01.302Z","from_sync":false,"order":25,"slug":"api-hub","title":"API Hub"},"parentDoc":null,"project":"55faf11ba62ba1170021a9a7","user":"5613e4f8fdd08f2b00437620","version":{"__v":35,"_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"],"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":"2016-10-06T14:36:37.760Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":8,"body":"[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"On this page:\",\n  \"body\": \"* [Overview](#overview)\\n* [Objective](#objective)\\n* [Prerequisites](#prerequisites)\\n* [Procedure](#procedure)\\n* [Step 1: Find your billing group](#find-your-billing-group)\\n* [Step 2: Create a project](#create-a-project)\\n* [Step 3: Add data files to your project](#add-data-files-to-your-project)\\n * [3a: Find your files](#find-your-files)\\n * [3b: Copy files to a project](#copy-files-to-a-project)\\n* [Step 4: Add reference files to your project](#add-reference-files-to-your-project)\\n * [4a: Find reference files](#find-reference-files)\\n * [4b: Copy reference files to your project](#copy-reference-files-to-you-project)\\n* [Step 5: Add a public workflow to your project](#add-a-public-workflow-to-your-project)\\n * [5a: Find a public workflow](#find-a-public-workflow)\\n * [5b: Copy a public app into a project](#copy-a-public-app-into-a-project)\\n * [5c: Modify a workflow on the visual interface](#modify-a-workflow-on-the-visual-interface)\\n * [5d: Find an app in your project via the API](#find-an-app-in-your-project-via-the-API)\\n* [Step 6: Create a draft task](#create-a-draft-task)\\n* [Step 7: Run a task](#run-a-task)\\n* [Step 8: Get task outputs](#get-task-outputs)\\n * [8a: List the child tasks](#list-the-child-tasks)\\n * [8b: Obtain the outputs of a child task](#obtain-the-outputs-of-a-child-task)\"\n}\n[/block]\n<a name=\"overview\"></a>\n##Overview\n\nThis tutorial introduces you to [performing a batch analysis](perform-a-batch-analysis) using the API.\nBatching allows you to run identical analyses on different data, by entering multiple input files and grouping them with specified metadata criteria. For instance, you can group input files by File, Sample, Library, Platform unit, or File segment. By using **Batch Input**, you can process multiple datasets with a single workflow containing the same parameter settings without having to set up the workflow multiple times. Batching creates one parent task containing multiple child tasks: one for each group of files.\n\n<div align=\"right\"><a href=\"#top\">top</a></div>\n\n<a name=\"objective\"></a>\n##Objective\n\nIn this tutorial, we'll run a batch analysis in which we align reads based on their Sample metadata.\n\n<div align=\"right\"><a href=\"#top\">top</a></div>\n\n<a name=\"prerequisites\"></a>\n##Prerequisites[](http://google.com)\n\nYou will need an account on the <a href=\"https://cgc-accounts.sbgenomics.com/auth/login\" target=\"blank\">CGC</a> in order to obtain your authentication token. Almost all API requests require your CGC authentication token. This acts as a security measure regulating your access to your projects. Learn more about [obtaining your authentication token](get-your-authentication-token).\n\n<div align=\"right\"><a href=\"#top\">top</a></div>\n\n<a name=\"procedure\"></a>\n##Procedure\nWe'll use the API to create a project and populating it with files. Then, we'll use the visual interface to modify one of the RNA sequencing workflows, **RNA-seq Alignment STAR**, to carry out the analysis. At this point, we will use the API to specify the inputs and set the batch criteria to batch by sample. Finally, we'll examine our results.\n\nAll necessary tools and data are available on the CGC.\n\nWe will state the HTTP requests for each API call used in the procedure. But you could also write a script that makes these calls using Seven Bridges [Python](api-python-library) or [R](api-r-library) client libraries.\n\n<div align=\"right\"><a href=\"#top\">top</a></div>\n\n<a name=\"find-your-billing-group\"></a>\n##Step 1: Find your billing group\n\nTo start an analysis, we must first create a project. To do this, we need to obtain following information:\n* Your CGC [authentication token](get-your-authentication-token)\n* A billing group ID\n\nYour authentication token acts as a security measure so only you can access your projects and resources on the CGC. The billing group ID designates which funding resource to charge for the analyses you run in the project you're about to create. Learn more about [billing groups](account-settings-and-billing#section-billing-groups) on the CGC.\n\nKeep in mind, when you signed up for the CGC, your account was automatically credited with $100 in free funds (your Pilot Funds) to use for data analyses. We will use this billing group in this tutorial.\n\nUse the API request to [list your billing groups](list-your-billing-groups), as shown in the HTTP request below. Be sure to substitute your authentication token for `X-SBG-Auth-Token`.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"GET /v2/billing/groups HTTP/1.1\\nHost: cgc-api.sbgenomics.com\\nX-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74\",\n      \"language\": \"http\",\n      \"name\": \"Get your billing group\"\n    }\n  ]\n}\n[/block]\nThis request returns a list of the billing groups you are part of, as shown below:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"href\\\": \\\"https://cgc-api.sbgenomics.com/v2/billing/groups/\\\",\\n  \\\"items\\\":\\n    {\\n      \\\"id\\\": \\\"70c12809-9ef2-845c-9d67-dfb8c9619fd6\\\",\\n      \\\"href\\\": \\\"https://cgc-api.sbgenomics.com/v2/billing/groups/70c12809-9ef2-845c-9d67-dfb8c9619fd6\\\",\\n      \\\"name\\\": \\\"Pilot Funds (rfranklin)\\\"\\n    }\\n  \\\"links\\\": []\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Response body\"\n    }\n  ]\n}\n[/block]\nCopy the value for `id` (in this case `70c12809-9ef2-845c-9d67-dfb8c9619fd6`) to your clipboard. We will use this in the next step when creating a project.\n\n<div align=\"right\"><a href=\"#top\">top</a></div>\n\n<a name=\"create-a-project\"></a>\n##Step 2: Create a project\n\nProjects on the CGC serve as the containers for the data, analytical tools, results, and team of collaborators for a distinct scientific investigation.\n\nTo create a project, make the API request to [create a project](create-a-new-project), as shown in the HTTP request shown below. Be sure to paste in your authentication token for the `X-SBG-Auth-Token` key.\n\nThis request also requires a request body. Provide a `name` for your project and an optional `description`. Here, you should also paste in the `billing_group` id you obtained in the previous step.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /v2/projects HTTP/1.1\\nHost: cgc-api.sbgenomics.com\\nX-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74\\ncontent-type: application/json\",\n      \"language\": \"http\",\n      \"name\": \"Create a project\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"name\\\":\\\"Batch tutorial\\\",\\n    \\\"description\\\":\\\"project for batching by sample via the APi\\\",\\n    \\\"billing_group\\\":\\\"70c12809-9ef2-845c-9d67-dfb8c9619fd6\\\"\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Create a project request body\"\n    }\n  ]\n}\n[/block]\nYou'll see a response body, as shown below, containing the name of your project, its URL (`href`), your project `id`, and your project's `billing_group`.\n\nNote down the project `id`. We will use this throughout the tutorial to designate our project. The project `id` consists of two parts: your username followed by your project's [short name](the-cgc-api#section-project-short-names).\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"href\\\": \\\"https://cgc-api.sbgenomics.com/v2/projects/rfranklin/batch-tutorial\\\",\\n  \\\"id\\\": \\\"rfranklin/batch-tutorial\\\",\\n  \\\"name\\\": \\\"Batch-tutorial\\\",\\n  \\\"type\\\": \\\"v2\\\",\\n  \\\"description\\\": \\\"project for batching by sample via the API\\\",\\n  \\\"tags\\\": [],\\n  \\\"billing_group\\\": \\\"70c12809-9ef2-845c-9d67-dfb8c9619fd6\\\"\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Response body\"\n    }\n  ]\n}\n[/block]\nNow that you've successfully created a project, we can add data to the project for analysis.\n\n<div align=\"right\"><a href=\"#top\">top</a></div>\n\n<a name=\"add-data-files-to-your-project\"></a>\n##Step 3: Add data files to your project\n\nIn this tutorial, we'll analyze data that is hosted in the [Cancer Cell Line Encyclopedia (CCLE) public project](ccle) on the CGC.\n\nPublic projects are repositories for examples of specific analyses as well as the associated data and tools you need to replicate these analyses on the CGC.\n\nFor this analysis, we want to use data files contained within the CCLE project.\n\n<div align=\"right\"><a href=\"#top\">top</a></div>\n\n<a name=\"find-your-files\"></a>\n###3a: Find your files\n\nTo find BAM files that contain RNA sequencing data within CCLE, we will make the API request to [list all files in a project](list-files-in-a-project), as shown below.\n\nWe'll need to pass along two query parameters to locate the files. First, we have to specify the project containing the files. In this case, the CCLE public project is specified by the id of `sevenbridges/cancer-cell-line-encyclopedia-ccle-1`. Following the path, you can pass this query parameter using `project=sevenbridges/cancer-cell-line-encyclopedia-ccle-1`.\n\nThen, we want to find BAM files with an experimental strategy of RNA-Seq. It is possible to filter by [metadata fields](metadata-for-private-data) to retrieve files with certain properties. In this tutorial, however, we already know that we want to find the following three files:\n  * G30630.VM-CUB1.3.bam\n  * G30603.TUHR4TKB.1.bam\n  * G28034.MDA-MB-361.1.bam\n\nSince we know the files' names, we can filter the returned files by name, using [the `name` query parameter](the-cgc-api#section-generic-query-parameters). We can append this query parameter to the query parameter `project` using an ampersand (`&`).\n\nYou can search for multiple files by name with the same API request, by including the field name multiple times. When filtering on any resource, including the same field several times with different filtering criteria results in an implicit `OR` operation for that field and the different criteria, so including the name field three times for three file names will find files matching any one of the file names.\n\nThe HTTP request to find files in the CCLE project matching our chosen file names is shown below:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"GET /v2/files?project=sevenbridges/cancer-cell-line-encyclopedia-ccle-1&name=G30630.VM-CUB1.3.bam&name=G30603.TUHR4TKB.1.bam&name=G28034.MDA-MB-361.1.bam HTTP/1.1\\nHost: cgc-api.sbgenomics.com\\nX-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74\",\n      \"language\": \"http\",\n      \"name\": \"Find your files\"\n    }\n  ]\n}\n[/block]\nIn the response returned, you will see a list of files along with their id, name, and the project to which they belong, as shown below.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"href\\\": \\\"https://cgc-api.sbgenomics.com/v2/files?offset=0&name=G30630.VM-CUB1.3.bam&name=G30603.TUHR4TKB.1.bam&name=G28034.MDA-MB-361.1.bam&limit=3&project=sevenbridges/cancer-cell-line-encyclopedia-ccle-1\\\",\\n  \\\"items\\\": [\\n    {\\n      \\\"href\\\": \\\"https://cgc-api.sbgenomics.com/v2/files/57da918fe4b002eed2cb10eb\\\",\\n      \\\"id\\\": \\\"57da918fe4b002eed2cb10eb\\\",\\n      \\\"name\\\": \\\"G30603.TUHR4TKB.1.bam\\\",\\n      \\\"project\\\": \\\"sevenbridges/cancer-cell-line-encyclopedia-ccle-1\\\"\\n    },\\n    {\\n      \\\"href\\\": \\\"https://cgc-api.sbgenomics.com/v2/files/57da918fe4b002eed2cb0915\\\",\\n      \\\"id\\\": \\\"57da918fe4b002eed2cb0915\\\",\\n      \\\"name\\\": \\\"G28034.MDA-MB-361.1.bam\\\",\\n      \\\"project\\\": \\\"sevenbridges/cancer-cell-line-encyclopedia-ccle-1\\\"\\n    },\\n    {\\n      \\\"href\\\": \\\"https://cgc-api.sbgenomics.com/v2/files/57da918fe4b002eed2cb0fe7\\\",\\n      \\\"id\\\": \\\"57da918fe4b002eed2cb0fe7\\\",\\n      \\\"name\\\": \\\"G30630.VM-CUB1.3.bam\\\",\\n      \\\"project\\\": \\\"sevenbridges/cancer-cell-line-encyclopedia-ccle-1\\\"\\n    }\\n  ],\\n  \\\"links\\\": []\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Response body\"\n    }\n  ]\n}\n[/block]\nCopy the `id` for each of the three files to your clipboard. We will use this in the next step when copying these files into our project.\n\n<div align=\"right\"><a href=\"#top\">top</a></div>\n\n<a name=\"copy-files-to-a-project\"></a>\n###3b: Copy files to a project\n\nTo copy files into a project, make the API request to [batch copy files](copy-files-between-projects), as shown below. \n\nIn the body of the request, you can designate the target project for the copied files. As shown in the example request below, supply a project id consisting of your username followed by the project's [short name](the-cgc-api#section-project-short-names) for the `project` key.\n\nWe also want to pass along the file ids you obtained in the step above in the body of the request. We can input the ids as a list of values for the `file_ids` key, as shown below.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /v2/action/files/copy HTTP/1.1\\nHost: cgc-api.sbgenomics.com\\nX-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74\",\n      \"language\": \"http\",\n      \"name\": \"Copy files to a project\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"project\\\":\\\"rfranklin/batch-tutorial\\\",\\n    \\\"file_ids\\\":[\\n  \\t\\t\\\"57da918fe4b002eed2cb10eb\\\",\\n      \\\"57da918fe4b002eed2cb0915\\\",\\n      \\\"57da918fe4b002eed2cb0fe7\\\"\\n    ]\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Copy files to a project request body\"\n    }\n  ]\n}\n[/block]\nThe response body, as shown below, will indicate if your request was successful. The response contains the original ids of your copied files and the `status` of the response. \n\nThe response body also contains two other fields: `new_file_id` and `new_file_name`. These indicate the new id and the new name assigned to the copy of the file within your project. You can use this id in future API requests to refer to the copy of the file within your project as opposed to the original file.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"57da918fe4b002eed2cb10eb\\\": {\\n    \\\"status\\\": \\\"OK\\\",\\n    \\\"new_file_id\\\": \\\"57e43957e4b002eed2cbe64d\\\",\\n    \\\"new_file_name\\\": \\\"G30603.TUHR4TKB.1.bam\\\"\\n  },\\n  \\\"57da918fe4b002eed2cb0915\\\": {\\n    \\\"status\\\": \\\"OK\\\",\\n    \\\"new_file_id\\\": \\\"57e43957e4b002eed2cbe64f\\\",\\n    \\\"new_file_name\\\": \\\"G28034.MDA-MB-361.1.bam\\\"\\n  },\\n  \\\"57da918fe4b002eed2cb0fe7\\\": {\\n    \\\"status\\\": \\\"OK\\\",\\n    \\\"new_file_id\\\": \\\"57e43957e4b002eed2cbe651\\\",\\n    \\\"new_file_name\\\": \\\"G30630.VM-CUB1.3.bam\\\"\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Response body\"\n    }\n  ]\n}\n[/block]\nThe files have been successfully copied to your project.\n\n<div align=\"right\"><a href=\"#top\">top</a></div>\n\n<a name=\"add-reference-files-to-your-project\"></a>\n##Step 4: Add reference files to your project\n\nMany bioinformatics tools require certain data, such as reference genomes or annotation files, to execute properly. The CGC maintains a collection of the latest and most frequently used reference genomes and annotation files in the Public Reference Files repository. The RNA-seq Alignment STAR workflow uses a reference genome and an annotation files to align reads. We'll need to have these reference files in our project to be able to use them while setting up our task.\n\nFor this analysis, we need to supply the workflow with the following two reference files:\n  * HG19_Broad_variant.fasta\n  * Homo_sapiens.GRCh37.75.gtf\n\nSee the table below for more information about each file.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"API key\",\n    \"h-1\": \"Input files\",\n    \"h-2\": \"File type\",\n    \"0-0\": \"`genomeFastaFiles`\",\n    \"0-1\": \"HG19_Broad_variant.fasta\",\n    \"0-2\": \"**FASTA** is a reference genome file which we will use for the alignment of the FASTQ files.\",\n    \"1-0\": \"`sjdbGTFfile`\",\n    \"1-1\": \"Homo_sapiens.GRCh37.75.gtf\",\n    \"1-2\": \"**GTF** is an annotation file containing information about gene structure.\"\n  },\n  \"cols\": 3,\n  \"rows\": 2\n}\n[/block]\n<div align=\"right\"><a href=\"#top\">top</a></div>\n\n<a name=\"find-reference-files\"></a>\n###4a: Find reference files\n\nTo find the reference files above in the Public Reference Files repository, we will make the API request to [list all files in a project](list-files-in-a-project), as shown below.\n\nThis process is similar to finding the data files above. In this case, the Public Reference Files repository is specified in the same way as a project on the CGC by an `id` of `admin/sbg-public-data`. Following the path, you can pass this query parameter using `project=admin/sbg-public-data`.\n\nAs above, we want to filter the results by the name parameter to find **HG19_Broad_variant.fasta** and **Homo_sapiens.GRCh37.75.gtf**.\n\nThe entire HTTP request is shown below:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"GET /v2/files?project=admin/sbg-public-data&name=HG19_Broad_variant.fasta&name=Homo_sapiens.GRCh37.75.gtf HTTP/1.1\\nHost: cgc-api.sbgenomics.com\\nX-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74\",\n      \"language\": \"http\",\n      \"name\": \"Find reference files\"\n    }\n  ]\n}\n[/block]\nIn the response, you will see information about each file as well as the file's `id`. Copy each `id` (for example, `5772b6cd507c1752674486d8`) to your clipboard. We will use these ids in the next step.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"href\\\": \\\"https://cgc-api.sbgenomics.com/v2/files?offset=0&name=HG19_Broad_variant.fasta&name=Homo_sapiens.GRCh37.75.gtf&limit=2&project=admin/sbg-public-data\\\",\\n  \\\"items\\\": [\\n    {\\n      \\\"href\\\": \\\"https://cgc-api.sbgenomics.com/v2/files/5772b6c4507c1752674486cd\\\",\\n      \\\"id\\\": \\\"5772b6c4507c1752674486cd\\\",\\n      \\\"name\\\": \\\"Homo_sapiens.GRCh37.75.gtf\\\",\\n      \\\"project\\\": \\\"admin/sbg-public-data\\\"\\n    },\\n    {\\n      \\\"href\\\": \\\"https://cgc-api.sbgenomics.com/v2/files/5772b6c1507c1752674486c9\\\",\\n      \\\"id\\\": \\\"5772b6c1507c1752674486c9\\\",\\n      \\\"name\\\": \\\"HG19_Broad_variant.fasta\\\",\\n      \\\"project\\\": \\\"admin/sbg-public-data\\\"\\n    }\\n  ],\\n  \\\"links\\\": []\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Response body\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"success\",\n  \"title\": \"Pro-tip:\",\n  \"body\": \"To display only the `id` and `name` fields in the response, you can specify `fields` as a query parameter by using `fields=id,name`.\"\n}\n[/block]\n<div align=\"right\"><a href=\"#top\">top</a></div>\n\n<a name=\"copy-reference-files-to-you-project\"></a>\n###4b: Copy reference files to your project\n\nTo copy files into a project, make the API request to [batch copy files](copy-files-between-projects), as shown below. This is the same method we used to copy our data files into our project.\n\nIn the body of the request, you can specify the target project for the copied files, such as `rfranklin/batch-tutorial`, as a value for the `project` key.\n\nWe also want to pass along the file ids you obtained in the step above in the body of the request. We can input the ids as a list of values for the `file_ids` key, as shown below.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /v2/action/files/copy HTTP/1.1\\nHost: cgc-api.sbgenomics.com\\nX-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74\",\n      \"language\": \"http\",\n      \"name\": \"Copy reference files\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"project\\\":\\\"rfranklin/batch-tutorial\\\",\\n    \\\"file_ids\\\": [\\n        \\\"5772b6c4507c1752674486cd\\\",\\n        \\\"5772b6c1507c1752674486c9\\\"\\n    ]\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Copy reference files request body\"\n    }\n  ]\n}\n[/block]\nThe response body contains the `new_file_id` for each of the copied reference files. These indicate the new id assigned to the copy of the file within your project. You can use this id in future API requests to refer to the copy of the file within your project as opposed to the original file\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"5772b6c4507c1752674486cd\\\": {\\n    \\\"status\\\": \\\"OK\\\",\\n    \\\"new_file_id\\\": \\\"57e53cb8e4b002eed2cbf489\\\",\\n    \\\"new_file_name\\\": \\\"Homo_sapiens.GRCh37.75.gtf\\\"\\n  },\\n  \\\"5772b6c1507c1752674486c9\\\": {\\n    \\\"status\\\": \\\"OK\\\",\\n    \\\"new_file_id\\\": \\\"57e53cb8e4b002eed2cbf48b\\\",\\n    \\\"new_file_name\\\": \\\"HG19_Broad_variant.fasta\\\"\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Response body\"\n    }\n  ]\n}\n[/block]\nWe have populated our project with the requisite data and reference files. Now, we can add a workflow to our project.\n\n<div align=\"right\"><a href=\"#top\">top</a></div>\n\n<a name=\"add-a-public-workflow-to-your-project\"></a>\n##Step 5: Add a public workflow to your project\n\nWe need a workflow to analyze our data. We'll start with a publicly available workflow from the <a href=\"https://cgc.sbgenomics.com/public/apps\" target=\"blank\">Public Apps repository</a>, **RNA-seq Alignment - STAR**. However, the workflow takes FASTQ inputs. Since we added BAM files from CCLE above, we'll need to modify the workflow to accept input BAM files and convert them to the FASTQ format.\n\n<div align=\"right\"><a href=\"#top\">top</a></div>\n\n<a name=\"find-a-public-workflow\"></a>\n###5a: Find a public workflow\n\nTo find a public workflow on the CGC, make the API request to [list all apps](list-all-apps-available-to-you) (i.e. tools and workflows) available to you, as shown below.\n\nYou can filter for public workflows by adding the parameter `visibility=public`. Since this will return many results, we want to see as many results as we can on one page. To [set the pagination](the-cgc-api#section-response-pagination), we use the query parameter `limit=100` to display 100 results per page. The maximum allowable `limit` per page is 100.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"GET /v2/apps?visibility=public&limit=100 HTTP/1.1\\nHost: cgc-api.sbgenomics.com\\nX-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74\",\n      \"language\": \"http\",\n      \"name\": \"Find a public workflow\"\n    }\n  ]\n}\n[/block]\nThis query returns the response below. For brevity, we have omitted part some of the returned apps.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"href\\\": \\\"https://cgc-api.sbgenomics.com/v2/apps?visibility=public&offset=0&limit=100\\\",\\n  \\\"items\\\": [\\n    {\\n      \\\"href\\\": \\\"https://cgc-api.sbgenomics.com/v2/apps/admin/sbg-public-data/sbg-split-bed/3\\\",\\n      \\\"id\\\": \\\"admin/sbg-public-data/sbg-split-bed/3\\\",\\n      \\\"project\\\": \\\"admin/sbg-public-data\\\",\\n      \\\"name\\\": \\\"SBG Split BED\\\"\\n    },\\n    {\\n      \\\"href\\\": \\\"https://cgc-api.sbgenomics.com/v2/apps/admin/sbg-public-data/sbg-untar-fasta/8\\\",\\n      \\\"id\\\": \\\"admin/sbg-public-data/sbg-untar-fasta/8\\\",\\n      \\\"project\\\": \\\"admin/sbg-public-data\\\",\\n      \\\"name\\\": \\\"SBG Untar fasta\\\"\\n    },\\n    <snip>\\n  ],\\n  \\\"links\\\": [\\n    {\\n      \\\"href\\\": \\\"https://cgc-api.sbgenomics.com/v2/apps?visibility=public&offset=100&limit=100\\\",\\n      \\\"rel\\\": \\\"next\\\",\\n      \\\"method\\\": \\\"GET\\\"\\n    }\\n  ]\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Response body, page 1\"\n    }\n  ]\n}\n[/block]\nScrolling through this list of apps, you'll see that **RNA-seq Alignment - STAR** isn't on this list of the first 100 results. To page through to the next 100 results, follow the path at the bottom of your response, `\"href\": \"https://cgc-api.sbgenomics.com/v2/apps?visibility=public&offset=100&limit=100\"`. Use this path to issue another request which lists next 100 results starting from the 101st result, as shown below.\n\nIf **RNA-seq Alignment - STAR** is not in the results, page through until you see the workflow. Locate and copy the `id` of the RNA-seq Alignment - STAR workflow. We'll use this in the next step.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"href\\\": \\\"https://cgc-api.sbgenomics.com/v2/apps?visibility=public&offset=200&limit=100\\\",\\n  \\\"items\\\": [\\n    <snip>\\n   {\\n      \\\"href\\\": \\\"https://cgc-api.sbgenomics.com/v2/apps/admin/sbg-public-data/rna-seq-alignment-star/16\\\",\\n      \\\"id\\\": \\\"admin/sbg-public-data/rna-seq-alignment-star/16\\\",\\n      \\\"project\\\": \\\"admin/sbg-public-data\\\",\\n      \\\"name\\\": \\\"RNA-seq Alignment - STAR\\\"\\n    },\\n    <snip>\\n    {\\n      \\\"href\\\": \\\"https://cgc-api.sbgenomics.com/v2/apps?visibility=public&offset=100&limit=100\\\",\\n      \\\"rel\\\": \\\"prev\\\",\\n      \\\"method\\\": \\\"GET\\\"\\n    }\\n  ]\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Response body, page 2\"\n    }\n  ]\n}\n[/block]\nWe've located the `id` for the RNA-seq Alignment - STAR workflow, and now we can copy the workflow into our project.\n\n<div align=\"right\"><a href=\"#top\">top</a></div>\n\n<a name=\"copy-a-public-app-into-a-project\"></a>\n###5b: Copy a workflow into a project\n\nWe can use the `id` we obtained above to copy the workflow into our project.\n\nTo copy a workflow, make the API request to [copy an app](copy-an-app-secondary-method), as shown below. Be sure to pass the app's `id` in the path of the request.\n\nIn the body of the request, include the name of the `project` you want to copy the public app into, such as `rfranklin/batch-tutorial`.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /v2/apps/admin/sbg-public-data/rna-seq-alignment-star/16/actions/copy HTTP/1.1\\nHost: cgc-api.sbgenomics.com\\nX-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74\",\n      \"language\": \"http\",\n      \"name\": \"Copy a public workflow\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"project\\\":\\\"rfranklin/batch-tutorial\\\"\\n}\\n\",\n      \"language\": \"json\",\n      \"name\": \"Copy a public workflow request body\"\n    }\n  ]\n}\n[/block]\nThis call returns the name and the id of the app within your project. Copy this id as we'll need it in the next step.\n\nThe response body also contains the full <a href=\"http://www.commonwl.org/\" target=\"blank\">Common Workflow Language</a> description of the copied app. This is typically a lengthy JSON object (`raw`), which we have omitted in part below for brevity. Keep this JSON handy for the next step, as it include information about setting up inputs for the workflow.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"href\\\": \\\"https://cgc-api.sbgenomics.com/v2/apps/rfranklin/batch-tutorial/RNA-seq Alignment - STAR/0\\\",\\n  \\\"id\\\": \\\"rfranklin/batch-tutorial/rna-seq-alignment-star/0\\\",\\n  \\\"project\\\": \\\"rfranklin/batch-tutorial\\\",\\n  \\\"name\\\": \\\"RNA-seq Alignment - STAR\\\",\\n  \\\"revision\\\": 0,\\n  <snip>\\n  \\\"inputs\\\": [\\n      {\\n        \\\"sbg:suggestedValue\\\": [\\n          {\\n            \\\"name\\\": \\\"Homo_sapiens.GRCh37.75.gtf\\\",\\n            \\\"class\\\": \\\"File\\\",\\n            \\\"path\\\": \\\"5772b6c4507c1752674486cd\\\"\\n          }\\n        ],\\n        \\\"id\\\": \\\"#sjdbGTFfile\\\",\\n        \\\"label\\\": \\\"sjdbGTFfile\\\",\\n        \\\"type\\\": [\\n          \\\"null\\\",\\n          {\\n            \\\"items\\\": \\\"File\\\",\\n            \\\"type\\\": \\\"array\\\"\\n          }\\n        ],\\n        \\\"sbg:y\\\": 195.08331063389656,\\n        \\\"sbg:x\\\": 160.49997586011762\\n      },\\n      {\\n        \\\"id\\\": \\\"#fastq\\\",\\n        \\\"type\\\": [\\n          {\\n            \\\"items\\\": \\\"File\\\",\\n            \\\"type\\\": \\\"array\\\"\\n          }\\n        ],\\n        \\\"label\\\": \\\"fastq\\\",\\n        \\\"sbg:includeInPorts\\\": true,\\n        \\\"sbg:y\\\": 323.74995018542,\\n        \\\"sbg:x\\\": 164.24999140203002\\n      },\\n      {\\n        \\\"sbg:suggestedValue\\\": {\\n          \\\"name\\\": \\\"human_g1k_v37_decoy.phiX174_Homo_sapiens.GRCh37.75_star-2.4.2a.tar\\\",\\n          \\\"class\\\": \\\"File\\\",\\n          \\\"path\\\": \\\"57bd5d15507c17b56d99b0d6\\\"\\n        },\\n        \\\"id\\\": \\\"#genomeFastaFiles\\\",\\n        \\\"label\\\": \\\"genomeFastaFiles\\\",\\n        \\\"type\\\": [\\n          \\\"File\\\"\\n        ],\\n        \\\"sbg:y\\\": 469.9999105781354,\\n        \\\"sbg:x\\\": 167.749960079791\\n      }\\n    ],\\n<snip>\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Response body\"\n    }\n  ]\n}\n[/block]\nWe're now ready to modify the workflow we've copied.\n\n<div align=\"right\"><a href=\"#top\">top</a></div>\n\n<a name=\"modify-a-workflow-on-the-visual-interface\"></a>\n###5c: Modify a workflow on the visual interface\n\nAfter you copy a workflow from the Public Apps repository to your own project, you can edit the workflow via the visual interface or by editing its CWL. To edit the workflow, let's use the [Workflow Editor](the-pipeline-editor) on the visual interface.\n\nWe want to modify the RNA-seq Alignment - STAR workflow we copied above to take BAM files as inputs.\n\nTo modify the workflow, follow the directions below. Note that the following directions apply to the visual interface of the CGC.\n\n1. Navigate to the **Apps** tab of your project and click the pencil icon next to your copied workflow. You'll be taken to the Workflow Editor, as shown below.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/0dade69-Screen_Shot_2016-09-23_at_11.54.40_AM.jpeg\",\n        \"Screen Shot 2016-09-23 at 11.54.40 AM.jpeg\",\n        2320,\n        1252,\n        \"#356083\"\n      ]\n    }\n  ]\n}\n[/block]\nAs shown above, the workflow has three input nodes (icons with arrows going into a half circle): **sjdbGTFfile**, **fastq**, and **genomeFastaFiles**. As our CCLE data is in the BAM format, we need to add the **Picard SamToFastq** tool so the workflow will accept BAM files by converting them to the fastq format.\n\n2. Click on the **fastq** input and select the red **x** above the node to delete it.\n3. Use the righthand **APPS** panel to search for the **Picard SamToFastq** tool.\n4. Drag and drop the **Picard SamToFastq** tool onto the Workflow Editor canvas.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/af0ee33-Screen_Shot_2016-09-23_at_12.16.16_PM.jpeg\",\n        \"Screen Shot 2016-09-23 at 12.16.16 PM.jpeg\",\n        1366,\n        916,\n        \"#e0e1e1\"\n      ]\n    }\n  ]\n}\n[/block]\n5. Connect the **Picard SAMToFastq** tool to the **SBG FASTQ Quality Detector** tool as shown below.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/46d0dcf-Screen_Shot_2016-09-23_at_12.19.04_PM.jpeg\",\n        \"Screen Shot 2016-09-23 at 12.19.04 PM.jpeg\",\n        688,\n        352,\n        \"#e2e4e2\"\n      ]\n    }\n  ]\n}\n[/block]\n7. Click on the circle on the left side of the **Picard SamtoFastq** tool and drag it out to the left side of the canvas. This adds an input node which accepts BAM files.\n8. Click on the input node, **input_file**. On the righthand panel, click on the dropdown menu below **Create batch group by metadata criteria** and select **Sample ID**. Note down the name of the input node**, input_file**. We'll use this information below to specify the input on which to batch when creating a draft task below\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/5400584-Screen_Shot_2016-09-23_at_2.45.07_PM_1.jpeg\",\n        \"Screen Shot 2016-09-23 at 2.45.07 PM (1).jpeg\",\n        740,\n        580,\n        \"#e6eaee\"\n      ]\n    }\n  ]\n}\n[/block]\n9. Click **Save** in the top righthand corner and add an optional description, as shown below. Finish by clicking **Save** once more.\n\nThe modified RNA-seq Alignment - STAR workflow now accepts BAM inputs.\n\n<div align=\"right\"><a href=\"#top\">top</a></div>\n\n<a name=\"find-an-app-in-your-project-via-the-API\"></a>\n###5d: Find an app in your project via the API\n\nNow that we've modified our workflow, we will return to the API to find the id for our modified workflow. To do this, we make the API request to [list all apps available in a project](list-all-apps-available-to-you). As shown in the example request below, supply a project id, such as `rfranklin/batch-tutorial`.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"GET /v2/apps?project=rfranklin/batch-tutorial HTTP/1.1\\nHost: cgc-api.sbgenomics.com\\nX-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74\",\n      \"language\": \"http\",\n      \"name\": \"Find an app\"\n    }\n  ]\n}\n[/block]\nThis call returns the `name` and the `id` of the app within your project. Copy this `id` as we'll need it in the next step.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"href\\\": \\\"https://cgc-api.sbgenomics.com/v2/apps?offset=0&limit=1&project=rfranklin/batch-tutorial\\\",\\n  \\\"items\\\": [\\n    {\\n      \\\"href\\\": \\\"https://cgc-api.sbgenomics.com/v2/apps/rfranklin/batch-tutorial/rna-seq-alignment-star/1\\\",\\n      \\\"id\\\": \\\"rfranklin/batch-tutorial/rna-seq-alignment-star/1\\\",\\n      \\\"project\\\": \\\"rfranklin/batch-tutorial\\\",\\n      \\\"name\\\": \\\"RNA-seq Alignment - STAR\\\"\\n    }\\n  ],\\n  \\\"links\\\": []\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Response body\"\n    }\n  ]\n}\n[/block]\nWe're now ready to set up a draft batch task.\n\n<div align=\"right\"><a href=\"#top\">top</a></div>\n\n<a name=\"create-a-draft-task\"></a>\n##Step 6: Create a draft task\n\nAn app execution is called a task. Each task is associated with a set of input files and chosen settings for the tool(s) in the app. The first step to executing a task is to set up a draft task. In this step, you specify the inputs for your task.\n\nTo set up a draft task, make the API request to [create a draft task](create-a-new-task), as shown below.\n\nIn the body of the request, specify the following:\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"`name`\",\n    \"1-0\": \"`app`\",\n    \"2-0\": \"`batch_input`\",\n    \"3-0\": \"`batch_by`\",\n    \"4-0\": \"`project`\",\n    \"5-0\": \"`input`\",\n    \"0-1\": \"A name for your task.\",\n    \"1-1\": \"The workflow you're running by including the workflow's id, which we obtained in the step above.\",\n    \"2-1\": \"The [input port on which you wish to batch](create-a-new-task#batch-input), such as\\ninput_file from above.\",\n    \"3-1\": \"The [criteria on which to batch](create-a-new-task#batch-by) for the batch_by key. This consists of a type as well as the criteria.\\nAs shown below, we supply the first key, type, with the value, CRITERIA. We then supply the second key, criteria, with the value, metadata.sample_id. In short, we're batching by sample.\",\n    \"4-1\": \"Your project id, such as `rfranklin/batch-tutorial`.\",\n    \"5-1\": \"The reference files and data files for our workflow.\\n\\nInclude the `class`, the file's `path`, and the file's `name`. The `path` is the file's id in our project. We obtained these ids when we copied the files to our project.\"\n  },\n  \"cols\": 2,\n  \"rows\": 6\n}\n[/block]\nAn example request to create a draft task is as follows:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /v2/tasks HTTP/1.1\\nHost: cgc-api.sbgenomics.com\\nX-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74\",\n      \"language\": \"http\",\n      \"name\": \"Create a draft task\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{  \\n    \\\"name\\\": \\\"api batch tutorial task\\\",\\n    \\\"app\\\": \\\"rfranklin/batch-tutorial/rna-seq-alignment-star/1\\\",\\n    \\\"project\\\": \\\"rfranklin/batch-tutorial\\\",\\n    \\\"batch_input\\\": \\\"input_file\\\",\\n    \\\"batch_by\\\": {\\n        \\\"type\\\": \\\"CRITERIA\\\",\\n        \\\"criteria\\\": [\\n            \\\"metadata.sample_id\\\"\\n        ]\\n    },\\n    \\\"inputs\\\": {\\n    \\\"input_file\\\": [\\n      {\\n        \\\"class\\\": \\\"File\\\",\\n        \\\"path\\\": \\\"57e43957e4b002eed2cbe64f\\\",\\n        \\\"name\\\": \\\"G28034.MDA-MB-361.1.bam\\\"\\n      },\\n      {\\n        \\\"class\\\": \\\"File\\\",\\n        \\\"path\\\": \\\"57e43957e4b002eed2cbe64d\\\",\\n        \\\"name\\\": \\\"G30603.TUHR4TKB.1.bam\\\"\\n      },\\n      {\\n        \\\"class\\\": \\\"File\\\",\\n        \\\"path\\\": \\\"57e43957e4b002eed2cbe651\\\",\\n        \\\"name\\\": \\\"G30630.VM-CUB1.3.bam\\\"\\n      }\\n    ],\\n    \\\"genomeFastaFiles\\\": {\\n      \\\"class\\\": \\\"File\\\",\\n      \\\"path\\\": \\\"57e53cb8e4b002eed2cbf48b\\\",\\n      \\\"name\\\": \\\"HG19_Broad_variant.fasta\\\"\\n    },\\n    \\\"sjdbGTFfile\\\": [\\n      {\\n        \\\"name\\\": \\\"Homo_sapiens.GRCh37.75.gtf\\\",\\n        \\\"class\\\": \\\"File\\\",\\n        \\\"path\\\": \\\"57e53cb8e4b002eed2cbf489\\\"\\n      }\\n    ]\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Create a draft task request body\"\n    }\n  ]\n}\n[/block]\nThe response body will indicate if your draft task was successfully created. You'll also see the `id` for your draft task. Copy this to your clipboard, as we'll use it in the next step.\n\nNote that you'll also see error messages if you've made a mistake in entering your inputs.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"href\\\": \\\"https://cgc-api.sbgenomics.com/v2/tasks/e3a88ab3-829a-485c-995a-3acd817ee98c\\\",\\n  \\\"id\\\": \\\"e3a88ab3-829a-485c-995a-3acd817ee98c\\\",\\n  \\\"name\\\": \\\"api batch tutorial task\\\",\\n  \\\"status\\\": \\\"DRAFT\\\",\\n  \\\"project\\\": \\\"rfranklin/batch-tutorial\\\",\\n  \\\"app\\\": \\\"rfranklin/batch-tutorial/rna-seq-alignment-star/1\\\",\\n  \\\"type\\\": \\\"v2\\\",\\n  \\\"created_by\\\": \\\"rfranklin\\\",\\n  \\\"start_time\\\": \\\"2016-09-23T18:43:24Z\\\",\\n  \\\"batch\\\": true,\\n  \\\"batch_input\\\": \\\"input_file\\\",\\n  \\\"batch_by\\\": {\\n    \\\"type\\\": \\\"CRITERIA\\\",\\n    \\\"criteria\\\": [\\n      \\\"metadata.sample_id\\\"\\n    ]\\n  },\\n  \\\"errors\\\": [],\\n  \\\"warnings\\\": [],\\n  \\\"inputs\\\": {\\n    <snip>\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Response body\"\n    }\n  ]\n}\n[/block]\nNote that `batch` is set to `true`. This indicates we've created a draft batch task. The response also reiterates the criteria by which we're batching. Now, we're ready to run the task.\n\n<div align=\"right\"><a href=\"#top\">top</a></div>\n\n<a name=\"run-a-task\"></a>\n##Step 7: Run a task\n\nTo run a task on the CGC, you'll need your draft task's `id`, obtained in the step above. Then, make the API request to [run a task](perform-an-action-on-a-specific-task), specifying the `id` of the draft task, as shown below.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /v2/tasks/e3a88ab3-829a-485c-995a-3acd817ee98c/actions/run\\\" HTTP/1.1\\nHost: cgc-api.sbgenomics.com\\nX-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74\",\n      \"language\": \"http\",\n      \"name\": \"Run a task\"\n    }\n  ]\n}\n[/block]\nYour response body will contain information about your task as well as its status. Learn more about what happens when you [run a task](blog:what-happens-when-i-run-a-task).\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"\\n{\\n  \\\"href\\\": \\\"https://cgc-api.sbgenomics.com/v2/tasks/e3a88ab3-829a-485c-995a-3acd817ee98c\\\",\\n  \\\"id\\\": \\\"e3a88ab3-829a-485c-995a-3acd817ee98c\\\",\\n  \\\"name\\\": \\\"api batch tutorial task\\\",\\n  \\\"status\\\": \\\"CREATING\\\",\\n  \\\"project\\\": \\\"rfranklin/batch-tutorial\\\",\\n  \\\"app\\\": \\\"rfranklin/batch-tutorial/rna-seq-alignment-star/1\\\",\\n  \\\"type\\\": \\\"v2\\\",\\n  \\\"created_by\\\": \\\"rfranklin\\\",\\n  \\\"executed_by\\\": \\\"rfranklin\\\",\\n  \\\"start_time\\\": \\\"2016-09-23T18:43:24Z\\\",\\n  \\\"batch\\\": true,\\n  \\\"batch_input\\\": \\\"input_file\\\",\\n  \\\"batch_by\\\": {\\n    \\\"type\\\": \\\"CRITERIA\\\",\\n    \\\"criteria\\\": [\\n      \\\"metadata.sample_id\\\"\\n    ]\\n  },\\n  \\\"errors\\\": [],\\n  \\\"warnings\\\": [],\\n  \\\"inputs\\\": {\\n    <snip>\\n  },\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Response body\"\n    }\n  ]\n}\n[/block]\nCopy down the `id` of the parent task from the response body. You'll use this in the next step to obtain your task outputs. You'll be notified by email once your task has completed.\n\n<div align=\"right\"><a href=\"#top\">top</a></div>\n\n<a name=\"get-task-outputs\"></a>\n##Step 8: Get task outputs\n\nOnce your task has completed, you can get your task outputs. First, we obtain the task ids of the child tasks. Then, we make the API request to [get details of a task](get-details-of-a-task).\n\n<div align=\"right\"><a href=\"#top\">top</a></div>\n\n<a name=\"list-the-child-tasks\"></a>\n###8a: List the child tasks\n\nBefore we can obtain the outputs of each child task, we have to obtain their task ids by making the API request to [list tasks](list-tasks-you-can-access). To list all tasks associated with a parent task, set the parameter `parent` to the task `id` of the parent task obtained in the step above. For instance, in the example below, `parent` is set to `e3a88ab3-829a-485c-995a-3acd817ee98c`.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"GET /v2/tasks?parent=e3a88ab3-829a-485c-995a-3acd817ee98c HTTP/1.1\\nHost: cgc-api.sbgenomics.com\\nX-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74\",\n      \"language\": \"http\",\n      \"name\": \"Get child tasks\"\n    }\n  ]\n}\n[/block]\nThe response body returns a list of the child tasks, including the `id` of each child task, the `name` of the parent task, and the `project` the tasks belong to. Copy the `id` of each child task to a clipboard. We'll use this in the next step.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"href\\\": \\\"https://cgc-api.sbgenomics.com/v2/tasks?parent=e3a88ab3-829a-485c-995a-3acd817ee98c&offset=0&limit=3\\\",\\n  \\\"items\\\": [\\n    {\\n      \\\"href\\\": \\\"https://cgc-api.sbgenomics.com/v2/tasks/330e9764-319c-4523-bb5b-953644a1b119\\\",\\n      \\\"id\\\": \\\"330e9764-319c-4523-bb5b-953644a1b119\\\",\\n      \\\"name\\\": \\\"api batch tutorial task\\\",\\n      \\\"project\\\": \\\"rfranklin/batch-tutorial\\\"\\n    },\\n    {\\n      \\\"href\\\": \\\"https://cgc-api.sbgenomics.com/v2/tasks/b10144f0-1cda-48e1-87f3-e66f2cf4aa2d\\\",\\n      \\\"id\\\": \\\"b10144f0-1cda-48e1-87f3-e66f2cf4aa2d\\\",\\n      \\\"name\\\": \\\"api batch tutorial task\\\",\\n      \\\"project\\\": \\\"rfranklin/batch-tutorial\\\"\\n    },\\n    {\\n      \\\"href\\\": \\\"https://cgc-api.sbgenomics.com/v2/tasks/74b642da-e647-4b91-89d0-81ae308abcbd\\\",\\n      \\\"id\\\": \\\"74b642da-e647-4b91-89d0-81ae308abcbd\\\",\\n      \\\"name\\\": \\\"api batch tutorial task\\\",\\n      \\\"project\\\": \\\"rfranklin/batch-tutorial\\\"\\n    }\\n  ],\\n  \\\"links\\\": []\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Response body\"\n    }\n  ]\n}\n[/block]\n<div align=\"right\"><a href=\"#top\">top</a></div>\n\n<a name=\"obtain-the-outputs-of-a-child-task\"></a>\n###8b: Obtain the outputs of a child task\n\nFor each child task above, make the following API request to [get details of a task](get-details-of-a-task) to obtain its outputs. Be sure to pass along the child task's `id`, obtained in the step above, in the path. Add the parameter `fields=outputs` to filter the response body to only display the outputs, as shown below.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"GET /v2/tasks/330e9764-319c-4523-bb5b-953644a1b119?fields=outputs HTTP/1.1\\nHost: cgc-api.sbgenomics.com\\nX-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74\",\n      \"language\": \"http\",\n      \"name\": \"Get the outputs of a child task\"\n    }\n  ]\n}\n[/block]\nThe response body returns the outputs of your task, including file ids (`path`) in case you wish to perform further analyses on these files.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"outputs\\\": {\\n    \\\"log_files\\\": [\\n      {\\n        \\\"path\\\": \\\"57e58b05e4b0ebec9056ec72\\\",\\n        \\\"name\\\": \\\"G30603.TUHR4TKB.1.converted.pe.Log.final.out\\\",\\n        \\\"class\\\": \\\"File\\\"\\n      },\\n      {\\n        \\\"path\\\": \\\"57e58b05e4b0b3cd0ec80c15\\\",\\n        \\\"name\\\": \\\"G30603.TUHR4TKB.1.converted.pe.Log.out\\\",\\n        \\\"class\\\": \\\"File\\\"\\n      },\\n      {\\n        \\\"path\\\": \\\"57e58b05e4b0ebec9056ec74\\\",\\n        \\\"name\\\": \\\"G30603.TUHR4TKB.1.converted.pe.Log.progress.out\\\",\\n        \\\"class\\\": \\\"File\\\"\\n      }\\n    ],\\n    \\\"reads_per_gene\\\": {},\\n    \\\"unmapped_reads\\\": [\\n      {\\n        \\\"path\\\": \\\"57e58b06e4b0b3cd0ec80c17\\\",\\n        \\\"name\\\": \\\"G30603.TUHR4TKB.1.converted.pe.Unmapped.out.mate1.fastq\\\",\\n        \\\"class\\\": \\\"File\\\"\\n      },\\n      {\\n        \\\"path\\\": \\\"57e58b06e4b0ebec9056ec76\\\",\\n        \\\"name\\\": \\\"G30603.TUHR4TKB.1.converted.pe.Unmapped.out.mate2.fastq\\\",\\n        \\\"class\\\": \\\"File\\\"\\n      }\\n    ],\\n    \\\"chimeric_junctions\\\": {},\\n    \\\"sorted_bam\\\": {\\n      \\\"path\\\": \\\"57e58db2e4b0ebec9056f2c0\\\",\\n      \\\"name\\\": \\\"G30603.TUHR4TKB.1.converted.pe.Aligned.out.sorted.bam\\\",\\n      \\\"secondaryFiles\\\": [\\n        {\\n          \\\"path\\\": \\\"57e58db2e4b0b3cd0ec810ef\\\",\\n          \\\"size\\\": 4018336,\\n          \\\"name\\\": \\\"G30603.TUHR4TKB.1.converted.pe.Aligned.out.sorted.bam.bai\\\",\\n          \\\"class\\\": \\\"File\\\"\\n        }\\n      ],\\n      \\\"class\\\": \\\"File\\\"\\n    },\\n    \\\"chimeric_alignments\\\": {},\\n    \\\"transcriptome_aligned_reads\\\": {\\n      \\\"path\\\": \\\"57e58b06e4b0b3cd0ec80c19\\\",\\n      \\\"name\\\": \\\"G30603.TUHR4TKB.1.converted.pe.Aligned.toTranscriptome.out.bam\\\",\\n      \\\"class\\\": \\\"File\\\"\\n    },\\n    \\\"intermediate_genome\\\": {},\\n    \\\"splice_junctions\\\": {\\n      \\\"path\\\": \\\"57e58b07e4b0ebec9056ec78\\\",\\n      \\\"name\\\": \\\"G30603.TUHR4TKB.1.converted.pe.SJ.out.tab\\\",\\n      \\\"class\\\": \\\"File\\\"\\n    }\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Response body\"\n    }\n  ]\n}\n[/block]\nRepeat this process for the other child tasks to obtain their respective outputs.\n\nThat’s it! We've executed a batch analysis and obtained some results.\n\n<div align=\"right\"><a href=\"#top\">top</a></div>","excerpt":"","slug":"api-batch-tutorial","type":"basic","title":"API Batch tutorial"}

API Batch tutorial


[block:callout] { "type": "warning", "title": "On this page:", "body": "* [Overview](#overview)\n* [Objective](#objective)\n* [Prerequisites](#prerequisites)\n* [Procedure](#procedure)\n* [Step 1: Find your billing group](#find-your-billing-group)\n* [Step 2: Create a project](#create-a-project)\n* [Step 3: Add data files to your project](#add-data-files-to-your-project)\n * [3a: Find your files](#find-your-files)\n * [3b: Copy files to a project](#copy-files-to-a-project)\n* [Step 4: Add reference files to your project](#add-reference-files-to-your-project)\n * [4a: Find reference files](#find-reference-files)\n * [4b: Copy reference files to your project](#copy-reference-files-to-you-project)\n* [Step 5: Add a public workflow to your project](#add-a-public-workflow-to-your-project)\n * [5a: Find a public workflow](#find-a-public-workflow)\n * [5b: Copy a public app into a project](#copy-a-public-app-into-a-project)\n * [5c: Modify a workflow on the visual interface](#modify-a-workflow-on-the-visual-interface)\n * [5d: Find an app in your project via the API](#find-an-app-in-your-project-via-the-API)\n* [Step 6: Create a draft task](#create-a-draft-task)\n* [Step 7: Run a task](#run-a-task)\n* [Step 8: Get task outputs](#get-task-outputs)\n * [8a: List the child tasks](#list-the-child-tasks)\n * [8b: Obtain the outputs of a child task](#obtain-the-outputs-of-a-child-task)" } [/block] <a name="overview"></a> ##Overview This tutorial introduces you to [performing a batch analysis](perform-a-batch-analysis) using the API. Batching allows you to run identical analyses on different data, by entering multiple input files and grouping them with specified metadata criteria. For instance, you can group input files by File, Sample, Library, Platform unit, or File segment. By using **Batch Input**, you can process multiple datasets with a single workflow containing the same parameter settings without having to set up the workflow multiple times. Batching creates one parent task containing multiple child tasks: one for each group of files. <div align="right"><a href="#top">top</a></div> <a name="objective"></a> ##Objective In this tutorial, we'll run a batch analysis in which we align reads based on their Sample metadata. <div align="right"><a href="#top">top</a></div> <a name="prerequisites"></a> ##Prerequisites[](http://google.com) You will need an account on the <a href="https://cgc-accounts.sbgenomics.com/auth/login" target="blank">CGC</a> in order to obtain your authentication token. Almost all API requests require your CGC authentication token. This acts as a security measure regulating your access to your projects. Learn more about [obtaining your authentication token](get-your-authentication-token). <div align="right"><a href="#top">top</a></div> <a name="procedure"></a> ##Procedure We'll use the API to create a project and populating it with files. Then, we'll use the visual interface to modify one of the RNA sequencing workflows, **RNA-seq Alignment STAR**, to carry out the analysis. At this point, we will use the API to specify the inputs and set the batch criteria to batch by sample. Finally, we'll examine our results. All necessary tools and data are available on the CGC. We will state the HTTP requests for each API call used in the procedure. But you could also write a script that makes these calls using Seven Bridges [Python](api-python-library) or [R](api-r-library) client libraries. <div align="right"><a href="#top">top</a></div> <a name="find-your-billing-group"></a> ##Step 1: Find your billing group To start an analysis, we must first create a project. To do this, we need to obtain following information: * Your CGC [authentication token](get-your-authentication-token) * A billing group ID Your authentication token acts as a security measure so only you can access your projects and resources on the CGC. The billing group ID designates which funding resource to charge for the analyses you run in the project you're about to create. Learn more about [billing groups](account-settings-and-billing#section-billing-groups) on the CGC. Keep in mind, when you signed up for the CGC, your account was automatically credited with $100 in free funds (your Pilot Funds) to use for data analyses. We will use this billing group in this tutorial. Use the API request to [list your billing groups](list-your-billing-groups), as shown in the HTTP request below. Be sure to substitute your authentication token for `X-SBG-Auth-Token`. [block:code] { "codes": [ { "code": "GET /v2/billing/groups HTTP/1.1\nHost: cgc-api.sbgenomics.com\nX-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74", "language": "http", "name": "Get your billing group" } ] } [/block] This request returns a list of the billing groups you are part of, as shown below: [block:code] { "codes": [ { "code": "{\n \"href\": \"https://cgc-api.sbgenomics.com/v2/billing/groups/\",\n \"items\":\n {\n \"id\": \"70c12809-9ef2-845c-9d67-dfb8c9619fd6\",\n \"href\": \"https://cgc-api.sbgenomics.com/v2/billing/groups/70c12809-9ef2-845c-9d67-dfb8c9619fd6\",\n \"name\": \"Pilot Funds (rfranklin)\"\n }\n \"links\": []\n}", "language": "json", "name": "Response body" } ] } [/block] Copy the value for `id` (in this case `70c12809-9ef2-845c-9d67-dfb8c9619fd6`) to your clipboard. We will use this in the next step when creating a project. <div align="right"><a href="#top">top</a></div> <a name="create-a-project"></a> ##Step 2: Create a project Projects on the CGC serve as the containers for the data, analytical tools, results, and team of collaborators for a distinct scientific investigation. To create a project, make the API request to [create a project](create-a-new-project), as shown in the HTTP request shown below. Be sure to paste in your authentication token for the `X-SBG-Auth-Token` key. This request also requires a request body. Provide a `name` for your project and an optional `description`. Here, you should also paste in the `billing_group` id you obtained in the previous step. [block:code] { "codes": [ { "code": "POST /v2/projects HTTP/1.1\nHost: cgc-api.sbgenomics.com\nX-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74\ncontent-type: application/json", "language": "http", "name": "Create a project" } ] } [/block] [block:code] { "codes": [ { "code": "{\n \"name\":\"Batch tutorial\",\n \"description\":\"project for batching by sample via the APi\",\n \"billing_group\":\"70c12809-9ef2-845c-9d67-dfb8c9619fd6\"\n}", "language": "json", "name": "Create a project request body" } ] } [/block] You'll see a response body, as shown below, containing the name of your project, its URL (`href`), your project `id`, and your project's `billing_group`. Note down the project `id`. We will use this throughout the tutorial to designate our project. The project `id` consists of two parts: your username followed by your project's [short name](the-cgc-api#section-project-short-names). [block:code] { "codes": [ { "code": "{\n \"href\": \"https://cgc-api.sbgenomics.com/v2/projects/rfranklin/batch-tutorial\",\n \"id\": \"rfranklin/batch-tutorial\",\n \"name\": \"Batch-tutorial\",\n \"type\": \"v2\",\n \"description\": \"project for batching by sample via the API\",\n \"tags\": [],\n \"billing_group\": \"70c12809-9ef2-845c-9d67-dfb8c9619fd6\"\n}", "language": "json", "name": "Response body" } ] } [/block] Now that you've successfully created a project, we can add data to the project for analysis. <div align="right"><a href="#top">top</a></div> <a name="add-data-files-to-your-project"></a> ##Step 3: Add data files to your project In this tutorial, we'll analyze data that is hosted in the [Cancer Cell Line Encyclopedia (CCLE) public project](ccle) on the CGC. Public projects are repositories for examples of specific analyses as well as the associated data and tools you need to replicate these analyses on the CGC. For this analysis, we want to use data files contained within the CCLE project. <div align="right"><a href="#top">top</a></div> <a name="find-your-files"></a> ###3a: Find your files To find BAM files that contain RNA sequencing data within CCLE, we will make the API request to [list all files in a project](list-files-in-a-project), as shown below. We'll need to pass along two query parameters to locate the files. First, we have to specify the project containing the files. In this case, the CCLE public project is specified by the id of `sevenbridges/cancer-cell-line-encyclopedia-ccle-1`. Following the path, you can pass this query parameter using `project=sevenbridges/cancer-cell-line-encyclopedia-ccle-1`. Then, we want to find BAM files with an experimental strategy of RNA-Seq. It is possible to filter by [metadata fields](metadata-for-private-data) to retrieve files with certain properties. In this tutorial, however, we already know that we want to find the following three files: * G30630.VM-CUB1.3.bam * G30603.TUHR4TKB.1.bam * G28034.MDA-MB-361.1.bam Since we know the files' names, we can filter the returned files by name, using [the `name` query parameter](the-cgc-api#section-generic-query-parameters). We can append this query parameter to the query parameter `project` using an ampersand (`&`). You can search for multiple files by name with the same API request, by including the field name multiple times. When filtering on any resource, including the same field several times with different filtering criteria results in an implicit `OR` operation for that field and the different criteria, so including the name field three times for three file names will find files matching any one of the file names. The HTTP request to find files in the CCLE project matching our chosen file names is shown below: [block:code] { "codes": [ { "code": "GET /v2/files?project=sevenbridges/cancer-cell-line-encyclopedia-ccle-1&name=G30630.VM-CUB1.3.bam&name=G30603.TUHR4TKB.1.bam&name=G28034.MDA-MB-361.1.bam HTTP/1.1\nHost: cgc-api.sbgenomics.com\nX-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74", "language": "http", "name": "Find your files" } ] } [/block] In the response returned, you will see a list of files along with their id, name, and the project to which they belong, as shown below. [block:code] { "codes": [ { "code": "{\n \"href\": \"https://cgc-api.sbgenomics.com/v2/files?offset=0&name=G30630.VM-CUB1.3.bam&name=G30603.TUHR4TKB.1.bam&name=G28034.MDA-MB-361.1.bam&limit=3&project=sevenbridges/cancer-cell-line-encyclopedia-ccle-1\",\n \"items\": [\n {\n \"href\": \"https://cgc-api.sbgenomics.com/v2/files/57da918fe4b002eed2cb10eb\",\n \"id\": \"57da918fe4b002eed2cb10eb\",\n \"name\": \"G30603.TUHR4TKB.1.bam\",\n \"project\": \"sevenbridges/cancer-cell-line-encyclopedia-ccle-1\"\n },\n {\n \"href\": \"https://cgc-api.sbgenomics.com/v2/files/57da918fe4b002eed2cb0915\",\n \"id\": \"57da918fe4b002eed2cb0915\",\n \"name\": \"G28034.MDA-MB-361.1.bam\",\n \"project\": \"sevenbridges/cancer-cell-line-encyclopedia-ccle-1\"\n },\n {\n \"href\": \"https://cgc-api.sbgenomics.com/v2/files/57da918fe4b002eed2cb0fe7\",\n \"id\": \"57da918fe4b002eed2cb0fe7\",\n \"name\": \"G30630.VM-CUB1.3.bam\",\n \"project\": \"sevenbridges/cancer-cell-line-encyclopedia-ccle-1\"\n }\n ],\n \"links\": []\n}", "language": "json", "name": "Response body" } ] } [/block] Copy the `id` for each of the three files to your clipboard. We will use this in the next step when copying these files into our project. <div align="right"><a href="#top">top</a></div> <a name="copy-files-to-a-project"></a> ###3b: Copy files to a project To copy files into a project, make the API request to [batch copy files](copy-files-between-projects), as shown below. In the body of the request, you can designate the target project for the copied files. As shown in the example request below, supply a project id consisting of your username followed by the project's [short name](the-cgc-api#section-project-short-names) for the `project` key. We also want to pass along the file ids you obtained in the step above in the body of the request. We can input the ids as a list of values for the `file_ids` key, as shown below. [block:code] { "codes": [ { "code": "POST /v2/action/files/copy HTTP/1.1\nHost: cgc-api.sbgenomics.com\nX-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74", "language": "http", "name": "Copy files to a project" } ] } [/block] [block:code] { "codes": [ { "code": "{\n \"project\":\"rfranklin/batch-tutorial\",\n \"file_ids\":[\n \t\t\"57da918fe4b002eed2cb10eb\",\n \"57da918fe4b002eed2cb0915\",\n \"57da918fe4b002eed2cb0fe7\"\n ]\n}", "language": "json", "name": "Copy files to a project request body" } ] } [/block] The response body, as shown below, will indicate if your request was successful. The response contains the original ids of your copied files and the `status` of the response. The response body also contains two other fields: `new_file_id` and `new_file_name`. These indicate the new id and the new name assigned to the copy of the file within your project. You can use this id in future API requests to refer to the copy of the file within your project as opposed to the original file. [block:code] { "codes": [ { "code": "{\n \"57da918fe4b002eed2cb10eb\": {\n \"status\": \"OK\",\n \"new_file_id\": \"57e43957e4b002eed2cbe64d\",\n \"new_file_name\": \"G30603.TUHR4TKB.1.bam\"\n },\n \"57da918fe4b002eed2cb0915\": {\n \"status\": \"OK\",\n \"new_file_id\": \"57e43957e4b002eed2cbe64f\",\n \"new_file_name\": \"G28034.MDA-MB-361.1.bam\"\n },\n \"57da918fe4b002eed2cb0fe7\": {\n \"status\": \"OK\",\n \"new_file_id\": \"57e43957e4b002eed2cbe651\",\n \"new_file_name\": \"G30630.VM-CUB1.3.bam\"\n }\n}", "language": "json", "name": "Response body" } ] } [/block] The files have been successfully copied to your project. <div align="right"><a href="#top">top</a></div> <a name="add-reference-files-to-your-project"></a> ##Step 4: Add reference files to your project Many bioinformatics tools require certain data, such as reference genomes or annotation files, to execute properly. The CGC maintains a collection of the latest and most frequently used reference genomes and annotation files in the Public Reference Files repository. The RNA-seq Alignment STAR workflow uses a reference genome and an annotation files to align reads. We'll need to have these reference files in our project to be able to use them while setting up our task. For this analysis, we need to supply the workflow with the following two reference files: * HG19_Broad_variant.fasta * Homo_sapiens.GRCh37.75.gtf See the table below for more information about each file. [block:parameters] { "data": { "h-0": "API key", "h-1": "Input files", "h-2": "File type", "0-0": "`genomeFastaFiles`", "0-1": "HG19_Broad_variant.fasta", "0-2": "**FASTA** is a reference genome file which we will use for the alignment of the FASTQ files.", "1-0": "`sjdbGTFfile`", "1-1": "Homo_sapiens.GRCh37.75.gtf", "1-2": "**GTF** is an annotation file containing information about gene structure." }, "cols": 3, "rows": 2 } [/block] <div align="right"><a href="#top">top</a></div> <a name="find-reference-files"></a> ###4a: Find reference files To find the reference files above in the Public Reference Files repository, we will make the API request to [list all files in a project](list-files-in-a-project), as shown below. This process is similar to finding the data files above. In this case, the Public Reference Files repository is specified in the same way as a project on the CGC by an `id` of `admin/sbg-public-data`. Following the path, you can pass this query parameter using `project=admin/sbg-public-data`. As above, we want to filter the results by the name parameter to find **HG19_Broad_variant.fasta** and **Homo_sapiens.GRCh37.75.gtf**. The entire HTTP request is shown below: [block:code] { "codes": [ { "code": "GET /v2/files?project=admin/sbg-public-data&name=HG19_Broad_variant.fasta&name=Homo_sapiens.GRCh37.75.gtf HTTP/1.1\nHost: cgc-api.sbgenomics.com\nX-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74", "language": "http", "name": "Find reference files" } ] } [/block] In the response, you will see information about each file as well as the file's `id`. Copy each `id` (for example, `5772b6cd507c1752674486d8`) to your clipboard. We will use these ids in the next step. [block:code] { "codes": [ { "code": "{\n \"href\": \"https://cgc-api.sbgenomics.com/v2/files?offset=0&name=HG19_Broad_variant.fasta&name=Homo_sapiens.GRCh37.75.gtf&limit=2&project=admin/sbg-public-data\",\n \"items\": [\n {\n \"href\": \"https://cgc-api.sbgenomics.com/v2/files/5772b6c4507c1752674486cd\",\n \"id\": \"5772b6c4507c1752674486cd\",\n \"name\": \"Homo_sapiens.GRCh37.75.gtf\",\n \"project\": \"admin/sbg-public-data\"\n },\n {\n \"href\": \"https://cgc-api.sbgenomics.com/v2/files/5772b6c1507c1752674486c9\",\n \"id\": \"5772b6c1507c1752674486c9\",\n \"name\": \"HG19_Broad_variant.fasta\",\n \"project\": \"admin/sbg-public-data\"\n }\n ],\n \"links\": []\n}", "language": "json", "name": "Response body" } ] } [/block] [block:callout] { "type": "success", "title": "Pro-tip:", "body": "To display only the `id` and `name` fields in the response, you can specify `fields` as a query parameter by using `fields=id,name`." } [/block] <div align="right"><a href="#top">top</a></div> <a name="copy-reference-files-to-you-project"></a> ###4b: Copy reference files to your project To copy files into a project, make the API request to [batch copy files](copy-files-between-projects), as shown below. This is the same method we used to copy our data files into our project. In the body of the request, you can specify the target project for the copied files, such as `rfranklin/batch-tutorial`, as a value for the `project` key. We also want to pass along the file ids you obtained in the step above in the body of the request. We can input the ids as a list of values for the `file_ids` key, as shown below. [block:code] { "codes": [ { "code": "POST /v2/action/files/copy HTTP/1.1\nHost: cgc-api.sbgenomics.com\nX-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74", "language": "http", "name": "Copy reference files" } ] } [/block] [block:code] { "codes": [ { "code": "{\n \"project\":\"rfranklin/batch-tutorial\",\n \"file_ids\": [\n \"5772b6c4507c1752674486cd\",\n \"5772b6c1507c1752674486c9\"\n ]\n}", "language": "json", "name": "Copy reference files request body" } ] } [/block] The response body contains the `new_file_id` for each of the copied reference files. These indicate the new id assigned to the copy of the file within your project. You can use this id in future API requests to refer to the copy of the file within your project as opposed to the original file [block:code] { "codes": [ { "code": "{\n \"5772b6c4507c1752674486cd\": {\n \"status\": \"OK\",\n \"new_file_id\": \"57e53cb8e4b002eed2cbf489\",\n \"new_file_name\": \"Homo_sapiens.GRCh37.75.gtf\"\n },\n \"5772b6c1507c1752674486c9\": {\n \"status\": \"OK\",\n \"new_file_id\": \"57e53cb8e4b002eed2cbf48b\",\n \"new_file_name\": \"HG19_Broad_variant.fasta\"\n }\n}", "language": "json", "name": "Response body" } ] } [/block] We have populated our project with the requisite data and reference files. Now, we can add a workflow to our project. <div align="right"><a href="#top">top</a></div> <a name="add-a-public-workflow-to-your-project"></a> ##Step 5: Add a public workflow to your project We need a workflow to analyze our data. We'll start with a publicly available workflow from the <a href="https://cgc.sbgenomics.com/public/apps" target="blank">Public Apps repository</a>, **RNA-seq Alignment - STAR**. However, the workflow takes FASTQ inputs. Since we added BAM files from CCLE above, we'll need to modify the workflow to accept input BAM files and convert them to the FASTQ format. <div align="right"><a href="#top">top</a></div> <a name="find-a-public-workflow"></a> ###5a: Find a public workflow To find a public workflow on the CGC, make the API request to [list all apps](list-all-apps-available-to-you) (i.e. tools and workflows) available to you, as shown below. You can filter for public workflows by adding the parameter `visibility=public`. Since this will return many results, we want to see as many results as we can on one page. To [set the pagination](the-cgc-api#section-response-pagination), we use the query parameter `limit=100` to display 100 results per page. The maximum allowable `limit` per page is 100. [block:code] { "codes": [ { "code": "GET /v2/apps?visibility=public&limit=100 HTTP/1.1\nHost: cgc-api.sbgenomics.com\nX-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74", "language": "http", "name": "Find a public workflow" } ] } [/block] This query returns the response below. For brevity, we have omitted part some of the returned apps. [block:code] { "codes": [ { "code": "{\n \"href\": \"https://cgc-api.sbgenomics.com/v2/apps?visibility=public&offset=0&limit=100\",\n \"items\": [\n {\n \"href\": \"https://cgc-api.sbgenomics.com/v2/apps/admin/sbg-public-data/sbg-split-bed/3\",\n \"id\": \"admin/sbg-public-data/sbg-split-bed/3\",\n \"project\": \"admin/sbg-public-data\",\n \"name\": \"SBG Split BED\"\n },\n {\n \"href\": \"https://cgc-api.sbgenomics.com/v2/apps/admin/sbg-public-data/sbg-untar-fasta/8\",\n \"id\": \"admin/sbg-public-data/sbg-untar-fasta/8\",\n \"project\": \"admin/sbg-public-data\",\n \"name\": \"SBG Untar fasta\"\n },\n <snip>\n ],\n \"links\": [\n {\n \"href\": \"https://cgc-api.sbgenomics.com/v2/apps?visibility=public&offset=100&limit=100\",\n \"rel\": \"next\",\n \"method\": \"GET\"\n }\n ]\n}", "language": "json", "name": "Response body, page 1" } ] } [/block] Scrolling through this list of apps, you'll see that **RNA-seq Alignment - STAR** isn't on this list of the first 100 results. To page through to the next 100 results, follow the path at the bottom of your response, `"href": "https://cgc-api.sbgenomics.com/v2/apps?visibility=public&offset=100&limit=100"`. Use this path to issue another request which lists next 100 results starting from the 101st result, as shown below. If **RNA-seq Alignment - STAR** is not in the results, page through until you see the workflow. Locate and copy the `id` of the RNA-seq Alignment - STAR workflow. We'll use this in the next step. [block:code] { "codes": [ { "code": "{\n \"href\": \"https://cgc-api.sbgenomics.com/v2/apps?visibility=public&offset=200&limit=100\",\n \"items\": [\n <snip>\n {\n \"href\": \"https://cgc-api.sbgenomics.com/v2/apps/admin/sbg-public-data/rna-seq-alignment-star/16\",\n \"id\": \"admin/sbg-public-data/rna-seq-alignment-star/16\",\n \"project\": \"admin/sbg-public-data\",\n \"name\": \"RNA-seq Alignment - STAR\"\n },\n <snip>\n {\n \"href\": \"https://cgc-api.sbgenomics.com/v2/apps?visibility=public&offset=100&limit=100\",\n \"rel\": \"prev\",\n \"method\": \"GET\"\n }\n ]\n}", "language": "json", "name": "Response body, page 2" } ] } [/block] We've located the `id` for the RNA-seq Alignment - STAR workflow, and now we can copy the workflow into our project. <div align="right"><a href="#top">top</a></div> <a name="copy-a-public-app-into-a-project"></a> ###5b: Copy a workflow into a project We can use the `id` we obtained above to copy the workflow into our project. To copy a workflow, make the API request to [copy an app](copy-an-app-secondary-method), as shown below. Be sure to pass the app's `id` in the path of the request. In the body of the request, include the name of the `project` you want to copy the public app into, such as `rfranklin/batch-tutorial`. [block:code] { "codes": [ { "code": "POST /v2/apps/admin/sbg-public-data/rna-seq-alignment-star/16/actions/copy HTTP/1.1\nHost: cgc-api.sbgenomics.com\nX-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74", "language": "http", "name": "Copy a public workflow" } ] } [/block] [block:code] { "codes": [ { "code": "{\n \"project\":\"rfranklin/batch-tutorial\"\n}\n", "language": "json", "name": "Copy a public workflow request body" } ] } [/block] This call returns the name and the id of the app within your project. Copy this id as we'll need it in the next step. The response body also contains the full <a href="http://www.commonwl.org/" target="blank">Common Workflow Language</a> description of the copied app. This is typically a lengthy JSON object (`raw`), which we have omitted in part below for brevity. Keep this JSON handy for the next step, as it include information about setting up inputs for the workflow. [block:code] { "codes": [ { "code": "{\n \"href\": \"https://cgc-api.sbgenomics.com/v2/apps/rfranklin/batch-tutorial/RNA-seq Alignment - STAR/0\",\n \"id\": \"rfranklin/batch-tutorial/rna-seq-alignment-star/0\",\n \"project\": \"rfranklin/batch-tutorial\",\n \"name\": \"RNA-seq Alignment - STAR\",\n \"revision\": 0,\n <snip>\n \"inputs\": [\n {\n \"sbg:suggestedValue\": [\n {\n \"name\": \"Homo_sapiens.GRCh37.75.gtf\",\n \"class\": \"File\",\n \"path\": \"5772b6c4507c1752674486cd\"\n }\n ],\n \"id\": \"#sjdbGTFfile\",\n \"label\": \"sjdbGTFfile\",\n \"type\": [\n \"null\",\n {\n \"items\": \"File\",\n \"type\": \"array\"\n }\n ],\n \"sbg:y\": 195.08331063389656,\n \"sbg:x\": 160.49997586011762\n },\n {\n \"id\": \"#fastq\",\n \"type\": [\n {\n \"items\": \"File\",\n \"type\": \"array\"\n }\n ],\n \"label\": \"fastq\",\n \"sbg:includeInPorts\": true,\n \"sbg:y\": 323.74995018542,\n \"sbg:x\": 164.24999140203002\n },\n {\n \"sbg:suggestedValue\": {\n \"name\": \"human_g1k_v37_decoy.phiX174_Homo_sapiens.GRCh37.75_star-2.4.2a.tar\",\n \"class\": \"File\",\n \"path\": \"57bd5d15507c17b56d99b0d6\"\n },\n \"id\": \"#genomeFastaFiles\",\n \"label\": \"genomeFastaFiles\",\n \"type\": [\n \"File\"\n ],\n \"sbg:y\": 469.9999105781354,\n \"sbg:x\": 167.749960079791\n }\n ],\n<snip>\n}", "language": "json", "name": "Response body" } ] } [/block] We're now ready to modify the workflow we've copied. <div align="right"><a href="#top">top</a></div> <a name="modify-a-workflow-on-the-visual-interface"></a> ###5c: Modify a workflow on the visual interface After you copy a workflow from the Public Apps repository to your own project, you can edit the workflow via the visual interface or by editing its CWL. To edit the workflow, let's use the [Workflow Editor](the-pipeline-editor) on the visual interface. We want to modify the RNA-seq Alignment - STAR workflow we copied above to take BAM files as inputs. To modify the workflow, follow the directions below. Note that the following directions apply to the visual interface of the CGC. 1. Navigate to the **Apps** tab of your project and click the pencil icon next to your copied workflow. You'll be taken to the Workflow Editor, as shown below. [block:image] { "images": [ { "image": [ "https://files.readme.io/0dade69-Screen_Shot_2016-09-23_at_11.54.40_AM.jpeg", "Screen Shot 2016-09-23 at 11.54.40 AM.jpeg", 2320, 1252, "#356083" ] } ] } [/block] As shown above, the workflow has three input nodes (icons with arrows going into a half circle): **sjdbGTFfile**, **fastq**, and **genomeFastaFiles**. As our CCLE data is in the BAM format, we need to add the **Picard SamToFastq** tool so the workflow will accept BAM files by converting them to the fastq format. 2. Click on the **fastq** input and select the red **x** above the node to delete it. 3. Use the righthand **APPS** panel to search for the **Picard SamToFastq** tool. 4. Drag and drop the **Picard SamToFastq** tool onto the Workflow Editor canvas. [block:image] { "images": [ { "image": [ "https://files.readme.io/af0ee33-Screen_Shot_2016-09-23_at_12.16.16_PM.jpeg", "Screen Shot 2016-09-23 at 12.16.16 PM.jpeg", 1366, 916, "#e0e1e1" ] } ] } [/block] 5. Connect the **Picard SAMToFastq** tool to the **SBG FASTQ Quality Detector** tool as shown below. [block:image] { "images": [ { "image": [ "https://files.readme.io/46d0dcf-Screen_Shot_2016-09-23_at_12.19.04_PM.jpeg", "Screen Shot 2016-09-23 at 12.19.04 PM.jpeg", 688, 352, "#e2e4e2" ] } ] } [/block] 7. Click on the circle on the left side of the **Picard SamtoFastq** tool and drag it out to the left side of the canvas. This adds an input node which accepts BAM files. 8. Click on the input node, **input_file**. On the righthand panel, click on the dropdown menu below **Create batch group by metadata criteria** and select **Sample ID**. Note down the name of the input node**, input_file**. We'll use this information below to specify the input on which to batch when creating a draft task below [block:image] { "images": [ { "image": [ "https://files.readme.io/5400584-Screen_Shot_2016-09-23_at_2.45.07_PM_1.jpeg", "Screen Shot 2016-09-23 at 2.45.07 PM (1).jpeg", 740, 580, "#e6eaee" ] } ] } [/block] 9. Click **Save** in the top righthand corner and add an optional description, as shown below. Finish by clicking **Save** once more. The modified RNA-seq Alignment - STAR workflow now accepts BAM inputs. <div align="right"><a href="#top">top</a></div> <a name="find-an-app-in-your-project-via-the-API"></a> ###5d: Find an app in your project via the API Now that we've modified our workflow, we will return to the API to find the id for our modified workflow. To do this, we make the API request to [list all apps available in a project](list-all-apps-available-to-you). As shown in the example request below, supply a project id, such as `rfranklin/batch-tutorial`. [block:code] { "codes": [ { "code": "GET /v2/apps?project=rfranklin/batch-tutorial HTTP/1.1\nHost: cgc-api.sbgenomics.com\nX-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74", "language": "http", "name": "Find an app" } ] } [/block] This call returns the `name` and the `id` of the app within your project. Copy this `id` as we'll need it in the next step. [block:code] { "codes": [ { "code": "{\n \"href\": \"https://cgc-api.sbgenomics.com/v2/apps?offset=0&limit=1&project=rfranklin/batch-tutorial\",\n \"items\": [\n {\n \"href\": \"https://cgc-api.sbgenomics.com/v2/apps/rfranklin/batch-tutorial/rna-seq-alignment-star/1\",\n \"id\": \"rfranklin/batch-tutorial/rna-seq-alignment-star/1\",\n \"project\": \"rfranklin/batch-tutorial\",\n \"name\": \"RNA-seq Alignment - STAR\"\n }\n ],\n \"links\": []\n}", "language": "json", "name": "Response body" } ] } [/block] We're now ready to set up a draft batch task. <div align="right"><a href="#top">top</a></div> <a name="create-a-draft-task"></a> ##Step 6: Create a draft task An app execution is called a task. Each task is associated with a set of input files and chosen settings for the tool(s) in the app. The first step to executing a task is to set up a draft task. In this step, you specify the inputs for your task. To set up a draft task, make the API request to [create a draft task](create-a-new-task), as shown below. In the body of the request, specify the following: [block:parameters] { "data": { "0-0": "`name`", "1-0": "`app`", "2-0": "`batch_input`", "3-0": "`batch_by`", "4-0": "`project`", "5-0": "`input`", "0-1": "A name for your task.", "1-1": "The workflow you're running by including the workflow's id, which we obtained in the step above.", "2-1": "The [input port on which you wish to batch](create-a-new-task#batch-input), such as\ninput_file from above.", "3-1": "The [criteria on which to batch](create-a-new-task#batch-by) for the batch_by key. This consists of a type as well as the criteria.\nAs shown below, we supply the first key, type, with the value, CRITERIA. We then supply the second key, criteria, with the value, metadata.sample_id. In short, we're batching by sample.", "4-1": "Your project id, such as `rfranklin/batch-tutorial`.", "5-1": "The reference files and data files for our workflow.\n\nInclude the `class`, the file's `path`, and the file's `name`. The `path` is the file's id in our project. We obtained these ids when we copied the files to our project." }, "cols": 2, "rows": 6 } [/block] An example request to create a draft task is as follows: [block:code] { "codes": [ { "code": "POST /v2/tasks HTTP/1.1\nHost: cgc-api.sbgenomics.com\nX-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74", "language": "http", "name": "Create a draft task" } ] } [/block] [block:code] { "codes": [ { "code": "{ \n \"name\": \"api batch tutorial task\",\n \"app\": \"rfranklin/batch-tutorial/rna-seq-alignment-star/1\",\n \"project\": \"rfranklin/batch-tutorial\",\n \"batch_input\": \"input_file\",\n \"batch_by\": {\n \"type\": \"CRITERIA\",\n \"criteria\": [\n \"metadata.sample_id\"\n ]\n },\n \"inputs\": {\n \"input_file\": [\n {\n \"class\": \"File\",\n \"path\": \"57e43957e4b002eed2cbe64f\",\n \"name\": \"G28034.MDA-MB-361.1.bam\"\n },\n {\n \"class\": \"File\",\n \"path\": \"57e43957e4b002eed2cbe64d\",\n \"name\": \"G30603.TUHR4TKB.1.bam\"\n },\n {\n \"class\": \"File\",\n \"path\": \"57e43957e4b002eed2cbe651\",\n \"name\": \"G30630.VM-CUB1.3.bam\"\n }\n ],\n \"genomeFastaFiles\": {\n \"class\": \"File\",\n \"path\": \"57e53cb8e4b002eed2cbf48b\",\n \"name\": \"HG19_Broad_variant.fasta\"\n },\n \"sjdbGTFfile\": [\n {\n \"name\": \"Homo_sapiens.GRCh37.75.gtf\",\n \"class\": \"File\",\n \"path\": \"57e53cb8e4b002eed2cbf489\"\n }\n ]\n }\n}", "language": "json", "name": "Create a draft task request body" } ] } [/block] The response body will indicate if your draft task was successfully created. You'll also see the `id` for your draft task. Copy this to your clipboard, as we'll use it in the next step. Note that you'll also see error messages if you've made a mistake in entering your inputs. [block:code] { "codes": [ { "code": "{\n \"href\": \"https://cgc-api.sbgenomics.com/v2/tasks/e3a88ab3-829a-485c-995a-3acd817ee98c\",\n \"id\": \"e3a88ab3-829a-485c-995a-3acd817ee98c\",\n \"name\": \"api batch tutorial task\",\n \"status\": \"DRAFT\",\n \"project\": \"rfranklin/batch-tutorial\",\n \"app\": \"rfranklin/batch-tutorial/rna-seq-alignment-star/1\",\n \"type\": \"v2\",\n \"created_by\": \"rfranklin\",\n \"start_time\": \"2016-09-23T18:43:24Z\",\n \"batch\": true,\n \"batch_input\": \"input_file\",\n \"batch_by\": {\n \"type\": \"CRITERIA\",\n \"criteria\": [\n \"metadata.sample_id\"\n ]\n },\n \"errors\": [],\n \"warnings\": [],\n \"inputs\": {\n <snip>\n }\n}", "language": "json", "name": "Response body" } ] } [/block] Note that `batch` is set to `true`. This indicates we've created a draft batch task. The response also reiterates the criteria by which we're batching. Now, we're ready to run the task. <div align="right"><a href="#top">top</a></div> <a name="run-a-task"></a> ##Step 7: Run a task To run a task on the CGC, you'll need your draft task's `id`, obtained in the step above. Then, make the API request to [run a task](perform-an-action-on-a-specific-task), specifying the `id` of the draft task, as shown below. [block:code] { "codes": [ { "code": "POST /v2/tasks/e3a88ab3-829a-485c-995a-3acd817ee98c/actions/run\" HTTP/1.1\nHost: cgc-api.sbgenomics.com\nX-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74", "language": "http", "name": "Run a task" } ] } [/block] Your response body will contain information about your task as well as its status. Learn more about what happens when you [run a task](blog:what-happens-when-i-run-a-task). [block:code] { "codes": [ { "code": "\n{\n \"href\": \"https://cgc-api.sbgenomics.com/v2/tasks/e3a88ab3-829a-485c-995a-3acd817ee98c\",\n \"id\": \"e3a88ab3-829a-485c-995a-3acd817ee98c\",\n \"name\": \"api batch tutorial task\",\n \"status\": \"CREATING\",\n \"project\": \"rfranklin/batch-tutorial\",\n \"app\": \"rfranklin/batch-tutorial/rna-seq-alignment-star/1\",\n \"type\": \"v2\",\n \"created_by\": \"rfranklin\",\n \"executed_by\": \"rfranklin\",\n \"start_time\": \"2016-09-23T18:43:24Z\",\n \"batch\": true,\n \"batch_input\": \"input_file\",\n \"batch_by\": {\n \"type\": \"CRITERIA\",\n \"criteria\": [\n \"metadata.sample_id\"\n ]\n },\n \"errors\": [],\n \"warnings\": [],\n \"inputs\": {\n <snip>\n },\n}", "language": "json", "name": "Response body" } ] } [/block] Copy down the `id` of the parent task from the response body. You'll use this in the next step to obtain your task outputs. You'll be notified by email once your task has completed. <div align="right"><a href="#top">top</a></div> <a name="get-task-outputs"></a> ##Step 8: Get task outputs Once your task has completed, you can get your task outputs. First, we obtain the task ids of the child tasks. Then, we make the API request to [get details of a task](get-details-of-a-task). <div align="right"><a href="#top">top</a></div> <a name="list-the-child-tasks"></a> ###8a: List the child tasks Before we can obtain the outputs of each child task, we have to obtain their task ids by making the API request to [list tasks](list-tasks-you-can-access). To list all tasks associated with a parent task, set the parameter `parent` to the task `id` of the parent task obtained in the step above. For instance, in the example below, `parent` is set to `e3a88ab3-829a-485c-995a-3acd817ee98c`. [block:code] { "codes": [ { "code": "GET /v2/tasks?parent=e3a88ab3-829a-485c-995a-3acd817ee98c HTTP/1.1\nHost: cgc-api.sbgenomics.com\nX-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74", "language": "http", "name": "Get child tasks" } ] } [/block] The response body returns a list of the child tasks, including the `id` of each child task, the `name` of the parent task, and the `project` the tasks belong to. Copy the `id` of each child task to a clipboard. We'll use this in the next step. [block:code] { "codes": [ { "code": "{\n \"href\": \"https://cgc-api.sbgenomics.com/v2/tasks?parent=e3a88ab3-829a-485c-995a-3acd817ee98c&offset=0&limit=3\",\n \"items\": [\n {\n \"href\": \"https://cgc-api.sbgenomics.com/v2/tasks/330e9764-319c-4523-bb5b-953644a1b119\",\n \"id\": \"330e9764-319c-4523-bb5b-953644a1b119\",\n \"name\": \"api batch tutorial task\",\n \"project\": \"rfranklin/batch-tutorial\"\n },\n {\n \"href\": \"https://cgc-api.sbgenomics.com/v2/tasks/b10144f0-1cda-48e1-87f3-e66f2cf4aa2d\",\n \"id\": \"b10144f0-1cda-48e1-87f3-e66f2cf4aa2d\",\n \"name\": \"api batch tutorial task\",\n \"project\": \"rfranklin/batch-tutorial\"\n },\n {\n \"href\": \"https://cgc-api.sbgenomics.com/v2/tasks/74b642da-e647-4b91-89d0-81ae308abcbd\",\n \"id\": \"74b642da-e647-4b91-89d0-81ae308abcbd\",\n \"name\": \"api batch tutorial task\",\n \"project\": \"rfranklin/batch-tutorial\"\n }\n ],\n \"links\": []\n}", "language": "json", "name": "Response body" } ] } [/block] <div align="right"><a href="#top">top</a></div> <a name="obtain-the-outputs-of-a-child-task"></a> ###8b: Obtain the outputs of a child task For each child task above, make the following API request to [get details of a task](get-details-of-a-task) to obtain its outputs. Be sure to pass along the child task's `id`, obtained in the step above, in the path. Add the parameter `fields=outputs` to filter the response body to only display the outputs, as shown below. [block:code] { "codes": [ { "code": "GET /v2/tasks/330e9764-319c-4523-bb5b-953644a1b119?fields=outputs HTTP/1.1\nHost: cgc-api.sbgenomics.com\nX-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74", "language": "http", "name": "Get the outputs of a child task" } ] } [/block] The response body returns the outputs of your task, including file ids (`path`) in case you wish to perform further analyses on these files. [block:code] { "codes": [ { "code": "{\n \"outputs\": {\n \"log_files\": [\n {\n \"path\": \"57e58b05e4b0ebec9056ec72\",\n \"name\": \"G30603.TUHR4TKB.1.converted.pe.Log.final.out\",\n \"class\": \"File\"\n },\n {\n \"path\": \"57e58b05e4b0b3cd0ec80c15\",\n \"name\": \"G30603.TUHR4TKB.1.converted.pe.Log.out\",\n \"class\": \"File\"\n },\n {\n \"path\": \"57e58b05e4b0ebec9056ec74\",\n \"name\": \"G30603.TUHR4TKB.1.converted.pe.Log.progress.out\",\n \"class\": \"File\"\n }\n ],\n \"reads_per_gene\": {},\n \"unmapped_reads\": [\n {\n \"path\": \"57e58b06e4b0b3cd0ec80c17\",\n \"name\": \"G30603.TUHR4TKB.1.converted.pe.Unmapped.out.mate1.fastq\",\n \"class\": \"File\"\n },\n {\n \"path\": \"57e58b06e4b0ebec9056ec76\",\n \"name\": \"G30603.TUHR4TKB.1.converted.pe.Unmapped.out.mate2.fastq\",\n \"class\": \"File\"\n }\n ],\n \"chimeric_junctions\": {},\n \"sorted_bam\": {\n \"path\": \"57e58db2e4b0ebec9056f2c0\",\n \"name\": \"G30603.TUHR4TKB.1.converted.pe.Aligned.out.sorted.bam\",\n \"secondaryFiles\": [\n {\n \"path\": \"57e58db2e4b0b3cd0ec810ef\",\n \"size\": 4018336,\n \"name\": \"G30603.TUHR4TKB.1.converted.pe.Aligned.out.sorted.bam.bai\",\n \"class\": \"File\"\n }\n ],\n \"class\": \"File\"\n },\n \"chimeric_alignments\": {},\n \"transcriptome_aligned_reads\": {\n \"path\": \"57e58b06e4b0b3cd0ec80c19\",\n \"name\": \"G30603.TUHR4TKB.1.converted.pe.Aligned.toTranscriptome.out.bam\",\n \"class\": \"File\"\n },\n \"intermediate_genome\": {},\n \"splice_junctions\": {\n \"path\": \"57e58b07e4b0ebec9056ec78\",\n \"name\": \"G30603.TUHR4TKB.1.converted.pe.SJ.out.tab\",\n \"class\": \"File\"\n }\n }\n}", "language": "json", "name": "Response body" } ] } [/block] Repeat this process for the other child tasks to obtain their respective outputs. That’s it! We've executed a batch analysis and obtained some results. <div align="right"><a href="#top">top</a></div>