1 # Running and debugging a workflow
3 1. The input parameter file
5 CWL input values are provided in the form of a YAML or JSON file.
6 Create one by right clicking on the explorer, select "New File" and
7 create a called file "main-input.yaml".
9 This file gives the values for parameters declared in the `inputs`
10 section of our workflow. Our workflow takes `fq`, `genome` and `gtf`
13 When setting inputs, Files and Directories are given as an object with
14 `class: File` or `class: Directory`. This distinguishes them from
15 plain strings that may or may not be file paths.
23 location: keep:9178fe1b80a08a422dbe02adfd439764+925/raw_fastq/Mov10_oe_1.subset.fq
24 format: http://edamontology.org/format_1930
27 location: keep:02a12ce9e2707610991bd29d38796b57+2912
30 location: keep:9178fe1b80a08a422dbe02adfd439764+925/reference_data/chr1-hg19_genes.gtf
35 Note: if you don't have example sequence data or the STAR index files, see the Appendix below.
40 location: rnaseq/raw_fastq/Mov10_oe_1.subset.fq
41 format: http://edamontology.org/format_1930
44 location: hg19-chr1-STAR-index
47 location: rnaseq/reference_data/chr1-hg19_genes.gtf
50 2. Running the workflow
54 In vscode, select "main.cwl" and then choose "Terminal -> Run task -> Run CWL workflow on Arvados"
58 Type this into the terminal:
61 cwl-runner main.cwl main-input.yaml
64 3. Debugging the workflow
66 A workflow can fail for many reasons: some possible reasons include
67 bad input, bugs in the code, or running out memory. In this case, the
68 STAR workflow might fail with an out of memory error.
70 To help diagnose these errors, the workflow runner produces logs that
71 record what happened, either in the terminal or the web interface.
73 Some errors you might see in the logs that would indicate an out of
77 EXITING: fatal error trying to allocate genome arrays, exception thrown: std::bad_alloc
78 Possible cause 1: not enough RAM. Check if you have enough RAM 5711762337 bytes
79 Possible cause 2: not enough virtual memory allowed with ulimit. SOLUTION: run ulimit -v 5711762337
85 Container exited with code: 137
88 (Exit code 137 most commonly occurs when a container goes "out of memory" and is terminated by the operating system).
90 If this happens, you will need to request more RAM.
92 4. Setting runtime RAM requirements
94 By default, a step is allocated 256 MB of RAM. From the STAR error message:
96 > Check if you have enough RAM 5711762337 bytes
98 We can see that STAR requires quite a bit more RAM than that. To
99 request more RAM, add a "requirements" section with
100 "ResourceRequirement" to the "STAR" step:
107 run: bio-cwl-tools/STAR/STAR-Align.cwl
110 Resource requirements you can set include:
112 * coresMin: CPU cores
113 * ramMin: RAM (in megabytes)
114 * tmpdirMin: temporary directory available space
115 * outdirMin: output directory available space
117 After setting the RAM requirements, re-run the workflow.
121 The CWL runner will print a results JSON object to standard output. It will look something like this (it may include additional fields).
126 "bam_sorted_indexed": {
127 "location": "file:///home/username/rnaseq-cwl-training-exercises/Aligned.sortedByCoord.out.bam",
128 "basename": "Aligned.sortedByCoord.out.bam",
133 "basename": "Aligned.sortedByCoord.out.bam.bai",
134 "location": "file:///home/username/rnaseq-cwl-training-exercises/Aligned.sortedByCoord.out.bam.bai",
141 "location": "file:///home/username/rnaseq-cwl-training-exercises/Mov10_oe_1.subset_fastqc.html",
142 "basename": "Mov10_oe_1.subset_fastqc.html",
149 This has the same structure as `main-input.yaml`. The each output
150 parameter is listed, with the `location` field of each `File` object
151 indicating where the output file can be found.
155 ## Downloading sample and reference data
157 Start from your rnaseq-cwl-exercises directory.
162 wget --mirror --no-parent --no-host --cut-dirs=1 https://download.pirca.arvadosapi.com/c=9178fe1b80a08a422dbe02adfd439764+925/
165 ## Downloading or generating STAR index
167 Running STAR requires index files generated from the reference.
169 This is a rather large download (4 GB). Depending on your bandwidth, it may be faster to generate it yourself.
173 Go to the "Terminal" tab in the lower vscode panel. If necessary, select `bash` from the dropdown list in the upper right corner.
176 mkdir hg19-chr1-STAR-index
177 cd hg19-chr1-STAR-index
178 wget --mirror --no-parent --no-host --cut-dirs=1 https://download.pirca.arvadosapi.com/c=02a12ce9e2707610991bd29d38796b57+2912/
183 Create `chr1-star-index.yaml`:
188 location: rnaseq/reference_data/chr1.fa
189 format: http://edamontology.org/format_1930
190 IndexName: 'hg19-chr1-STAR-index'
193 location: rnaseq/reference_data/chr1-hg19_genes.gtf
197 Next, go to the "Terminal" tab in the lower vscode panel. If
198 necessary, select `bash` from the dropdown list in the upper right
199 corner. Generate the index with your local cwl-runner.
202 cwl-runner bio-cwl-tools/STAR/STAR-Index.cwl chr1-star-index.yaml