https://github.com/anton-khodak/cwl-expression-library
A collection of handy Javascript functions which can be imported in a CWL expression and used for manipulating CWL File objects
https://github.com/anton-khodak/cwl-expression-library
cwl
Last synced: 12 months ago
JSON representation
A collection of handy Javascript functions which can be imported in a CWL expression and used for manipulating CWL File objects
- Host: GitHub
- URL: https://github.com/anton-khodak/cwl-expression-library
- Owner: anton-khodak
- License: apache-2.0
- Created: 2017-04-20T13:54:32.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2019-01-31T14:48:22.000Z (about 7 years ago)
- Last Synced: 2025-02-13T21:36:35.839Z (about 1 year ago)
- Topics: cwl
- Language: JavaScript
- Homepage:
- Size: 7.81 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
CWL expression library aims to provide a collection of handy Javascript functions which can be imported
in a CWL expression and used for manipulating CWL File objects.
# Usage
To use the library you need to copy file *file_utils.js* to your repository and then import it into your CWL code
in the `expressionLib` field of `InlineJavascriptRequirement`
```
cwlVersion: v1.0
class: Workflow
requirements:
- class: InlineJavascriptRequirement
expressionLib:
- $import: file_utils.js
```
after that you can use the functions from `file_utils.js` inside your expressions. Example:
```
outputs:
sortedFiles:
type: File[]
outputBinding:
outputEval: $(orderBy(inputs.fastqSeqs, "treatment", "asc"))
```
# API
File **updateMetadata(File, key, value)** - returns File object with updated metadata *key* with a new *value*
File **inheritMetadata(File, [sourceFiles])** - returns File object with updated metadata with set of metadata keys
which are same for all *sourceFiles* in list
[File] **toArray(File or [File])** - wraps a File object into Array if not Array already
[[File]] **groupBy([File], key)** - returns list of list of Files grouped by metadata *key*
[File] **orderBy([File], key)** - order list by metadata *key*