Solving more complex problems with scripts and toolkits
Overview
Teaching: 0 min
Exercises: 0 minQuestions
How to include and run a script in a step at runtime?
Which requirements need to be specified?
How to capture output of a script?
How to find other tools/solutions for awkward problems?
Objectives
script objectives:
Include and run a script in a step at runtime
Capture output of a script
tools objectives:
know good resources for finding solutions to common problems
By the end of this episode, learners should be able to include and run their own script in a step at runtime and be aware of where they can look for CWL recipes and more help for common, but awkward, tasks.
Exercise 1:
Which
Requirementfrom the following options is used to create a script at runtime?A. InlineJavascriptRequirement B. InitialWorkDirRequirement C. ResourceRequirement D. DockerRequirementSolution
Exercise 2:
Using the template below, add the missing instructions so that a script named
script.shwith the specified contents is created at runtime.InitialWorkDirRequirement: listing: - ------: script.sh ------: | echo "*Documenting input*" && \ echo "Input received: $(inputs.message)" && \ echo "Exit" inputs: message: type: stringSolution:
Exercise 3:
Since we are using
echoin the script (as shown below) - what is the appropriatetypein theoutputssection of following code block to capture standard output?class: CommandLineTool cwlVersion: v1.1 requirements: DockerRequirement: dockerPull: 'debian:stable' InitialWorkDirRequirement: listing: - entryname: script.sh entry: | echo "*Documenting input*" && \ echo "Input received: $(inputs.message)" && \ echo "Exit" inputs: message: type: string stdout: "message.txt" outputs: message: type: ----Your options are: A. File B. Directory C. stdout D. string
Solution:
Exercise 4:
Fix the
baseCommandin following code snippet to execute the script we have created in previous exercises.baseCommand: []Solution:
Exercise 5:
CHALLENGE question. Extend the
outputssection of the following CWLtool definition to capture the script we have created along with tools’ standard output.This will help you inspect the generated script and is useful in more complex situations to troubleshoot related issues.
class: CommandLineTool cwlVersion: v1.1 requirements: DockerRequirement: dockerPull: 'debian:stable' InitialWorkDirRequirement: listing: - entryname: script.sh entry: | echo "*Documenting input*" && \ echo "Input received: $(inputs.message)" && \ echo "Exit" inputs: message: type: string stdout: "message.txt" baseCommand: ["sh", "script.sh"] outputs: message: type: stdoutSolution:
Key Points
First key point. Brief Answer to questions. (FIXME)