Skip to content

Instantly share code, notes, and snippets.

@satra
Created December 23, 2015 17:31
Show Gist options
  • Save satra/9d8f8b8bf1ccbf89d5c8 to your computer and use it in GitHub Desktop.
Save satra/9d8f8b8bf1ccbf89d5c8 to your computer and use it in GitHub Desktop.
grep in CWL and json (non CWL)
{
"name": "grep",
"tool-version": "2.21",
"description": "Linux grep tool.",
"command-line": "grep [IGNORE_CASE] [MAX_COUNT] [PATTERN] [FILE] > [STDOUT]",
"docker-image": "ubuntu",
"docker-index": "http://index.docker.io",
"schema-version": "0.2",
"inputs": [
{
"id": "ignore_case_flag",
"name": "Ignore case",
"type": "Flag",
"description": "Ignore case distinctions in both the PATTERN and the input files.",
"command-line-key": "[IGNORE_CASE]",
"optional": true,
"command-line-flag": "-i"
},
{
"id": "max_count",
"name": "Max count",
"type": "Number",
"description": "Stop reading a file after MAX_COUNT matching lines.",
"command-line-key": "[MAX_COUNT]",
"optional": true,
"command-line-flag": "-m"
},
{
"id": "pattern",
"name": "Pattern",
"type": "String",
"description": "Pattern to search for.",
"command-line-key": "[PATTERN]"
},
{
"id": "file",
"name": "Input file",
"type": "File",
"description": "Input file",
"command-line-key": "[FILE]",
"command-line-flag": ""
}
],
"output-files": [
{
"id": "stdout",
"name": "Standard output",
"description": "Standard output",
"command-line-key": "[STDOUT]",
"path-template": "output.txt"
}
]
}
#!/usr/bin/env cwl-runner
$namespaces:
doap: http://usefulinc.com/ns/doap#
cwlVersion: "cwl:draft-3.dev3"
class: CommandLineTool
adms:includedAsset:
doap:name: "grep"
doap:release:
- class: doap:Version
doap:revision: "2.21"
description: |
Linux grep tool.
requirements:
- class: DockerRequirement
dockerImageId: ubuntu
inputs:
- id: "ignore_case_flag"
label: "Ignore case"
type: "boolean"
description: "Ignore case distinctions in both the PATTERN and the input files."
inputBinding:
position: 1
prefix: "-i"
- id: "max_count"
label: "Max count"
type: "int"
description: "Stop reading a file after MAX_COUNT matching lines."
inputBinding:
position: 2
prefix: "-m"
- id: "pattern"
label: "Pattern"
type: "string"
description: "Pattern to search for."
inputBinding:
position: 3
- id: "file"
label: "Input file"
type: File
description: "Input file"
inputBinding:
position: 4
outputs:
- id: "stdout"
type: File
description: "Standard output"
outputBinding:
glob: "output.txt"
stdout: "output.txt"
baseCommand: ["grep"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment