-
Notifications
You must be signed in to change notification settings - Fork 875
new module: yte #5886
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
famosab
wants to merge
8
commits into
nf-core:master
Choose a base branch
from
famosab:yte
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
new module: yte #5886
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f805a61
new module yte
famosab 9b8bb54
expand meta
famosab 5ae9f78
Merge branch 'master' into yte
famosab b3b6241
add comment to exmplaing test
famosab c38503a
add commands to include mapping to yte
famosab 33c437b
Merge branch 'master' into yte
famosab 4f6dc00
update tests
famosab 7f36977
finalize module
famosab File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
channels: | ||
- conda-forge | ||
- bioconda | ||
dependencies: | ||
- conda-forge::yte=1.9.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
process YTE { | ||
tag "$meta.id" | ||
label 'process_single' | ||
|
||
// WARN: Version information not provided by tool on CLI. Please update version string below when bumping container versions. | ||
conda "${moduleDir}/environment.yml" | ||
|
||
// TODO: update container to 1.9.0 | ||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? | ||
'oras://community.wave.seqera.io/library/yte:1.5.4--2466971526dcd2a8': | ||
'community.wave.seqera.io/library/yte:1.5.4--36d16ca4bab836c1' }" | ||
|
||
input: | ||
tuple val(meta), path(template) | ||
path(map_file) | ||
val(map) | ||
|
||
output: | ||
tuple val(meta), path("*.yaml"), emit: rendered | ||
path "versions.yml" , emit: versions | ||
|
||
when: | ||
task.ext.when == null || task.ext.when | ||
|
||
script: | ||
def args = task.ext.args ?: '' | ||
def prefix = task.ext.prefix ?: "${meta.id}" | ||
|
||
// Use map_file if provided, otherwise use map to create key=value pairs for mapping command | ||
def mapping_cmd = map_file ? "--variable-file ${map_file}" : "--variables " + map.collect { k, v -> "${k}=${v}" }.join(' ') | ||
VERSION = "1.5.4" // WARN: Version information not provided by tool on CLI. Please update this string when bumping | ||
""" | ||
yte ${mapping_cmd} < ${template} > ${prefix}.yaml | ||
|
||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
yte: $VERSION | ||
END_VERSIONS | ||
""" | ||
|
||
stub: | ||
def args = task.ext.args ?: '' | ||
def prefix = task.ext.prefix ?: "${meta.id}" | ||
VERSION = "1.5.4" // WARN: Version information not provided by tool on CLI. Please update this string when bumping | ||
""" | ||
touch ${prefix}.yaml | ||
|
||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
yte: $VERSION | ||
END_VERSIONS | ||
""" | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: yte | ||
description: A YAML template engine with Python expressions | ||
keywords: | ||
- yaml | ||
- template | ||
- python | ||
tools: | ||
- yte: | ||
description: "A YAML template engine with Python expressions" | ||
homepage: "https://yte-template-engine.github.io/" | ||
documentation: "https://yte-template-engine.github.io/" | ||
tool_dev_url: "https://github.com/yte-template-engine/yte" | ||
licence: ["MIT"] | ||
identifier: "" | ||
|
||
input: | ||
- - meta: | ||
type: map | ||
description: | | ||
Groovy Map containing sample information | ||
e.g. `[ id:'template1' ]` | ||
- template: | ||
type: file | ||
description: YTE template | ||
pattern: "*.{yaml}" | ||
ontologies: | ||
- edam: http://edamontology.org/format_3750 # YAML | ||
- - map_file: | ||
type: file | ||
description: YAML file containing a map to be used in the template | ||
pattern: "*.{yaml}" | ||
ontologies: | ||
- edam: http://edamontology.org/format_3750 # YAML | ||
- - map: | ||
type: map | ||
description: | | ||
Groovy Map containing mapping information to be used in the template | ||
e.g. `[ key: value ]` with key being a wildcard in the template | ||
|
||
output: | ||
- rendered: | ||
- meta: | ||
type: map | ||
description: Groovy Map containing sample information | ||
- "*.yaml": | ||
type: file | ||
description: Rendered YAML file | ||
pattern: "*.yaml" | ||
ontologies: | ||
- edam: http://edamontology.org/format_3750 # YAML | ||
- versions: | ||
- versions.yml: | ||
type: file | ||
description: File containing software versions | ||
pattern: "versions.yml" | ||
ontologies: | ||
- edam: http://edamontology.org/format_3750 # YAML | ||
|
||
authors: | ||
- "@famosab" | ||
maintainers: | ||
- "@famosab" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
nextflow_process { | ||
|
||
name "Test Process YTE" | ||
script "../main.nf" | ||
process "YTE" | ||
|
||
tag "modules" | ||
tag "modules_nfcore" | ||
tag "yte" | ||
|
||
test("yaml - map") { | ||
|
||
when { | ||
process { | ||
""" | ||
input[0] = [ | ||
[ id:'template' ], // meta map | ||
file('https://raw.githubusercontent.com/nf-core/test-datasets/1d7285ed7dea21f2d4079f7daa196b9f17bc6e85/data/generic/config/config_template.yte.yaml', checkIfExists: true) | ||
] | ||
input[1] = [] | ||
input[2] = [ 'sex': 'female' ] // map | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
{ assert snapshot(process.out).match() } | ||
) | ||
} | ||
|
||
} | ||
|
||
test("yaml - map - stub") { | ||
|
||
options "-stub" | ||
|
||
when { | ||
process { | ||
""" | ||
input[0] = [ | ||
[ id:'template' ], // meta map | ||
file('https://raw.githubusercontent.com/nf-core/test-datasets/1d7285ed7dea21f2d4079f7daa196b9f17bc6e85/data/generic/config/config_template.yte.yaml', checkIfExists: true) | ||
] | ||
input[1] = [] | ||
input[2] = [ 'sex': 'female' ] // map | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
{ assert snapshot(process.out).match() } | ||
) | ||
} | ||
|
||
} | ||
|
||
test("yaml - map_file") { | ||
|
||
when { | ||
process { | ||
""" | ||
input[0] = [ | ||
[ id:'template' ], // meta map | ||
file('https://raw.githubusercontent.com/nf-core/test-datasets/1d7285ed7dea21f2d4079f7daa196b9f17bc6e85/data/generic/config/config_template.yte.yaml', checkIfExists: true) | ||
] | ||
input[1] = [file ('https://raw.githubusercontent.com/nf-core/test-datasets/811dd3fa80dbac64b14f07413ad78bb2bebe0323/data/generic/config/yte_map_file.yaml', checkIfExists: true)] | ||
input[2] = [] // map | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
{ assert snapshot(process.out).match() } | ||
) | ||
} | ||
|
||
} | ||
|
||
test("yaml - map_file - stub") { | ||
|
||
options "-stub" | ||
|
||
when { | ||
process { | ||
""" | ||
input[0] = [ | ||
[ id:'template' ], // meta map | ||
file('https://raw.githubusercontent.com/nf-core/test-datasets/1d7285ed7dea21f2d4079f7daa196b9f17bc6e85/data/generic/config/config_template.yte.yaml', checkIfExists: true) | ||
] | ||
input[1] = [file ('https://raw.githubusercontent.com/nf-core/test-datasets/811dd3fa80dbac64b14f07413ad78bb2bebe0323/data/generic/config/yte_map_file.yaml', checkIfExists: true)] | ||
input[2] = [] // map | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
{ assert snapshot(process.out).match() } | ||
) | ||
} | ||
|
||
} | ||
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{ | ||
"yaml - no_template": { | ||
"content": [ | ||
{ | ||
"0": [ | ||
[ | ||
{ | ||
"id": "no_template" | ||
}, | ||
"no_template.yaml:md5,a22cd4fd5af79c7c1f17f5decbfc1a8e" | ||
] | ||
], | ||
"1": [ | ||
"versions.yml:md5,efd610134e8fc0892fddb2c50121e097" | ||
], | ||
"rendered": [ | ||
[ | ||
{ | ||
"id": "no_template" | ||
}, | ||
"no_template.yaml:md5,a22cd4fd5af79c7c1f17f5decbfc1a8e" | ||
] | ||
], | ||
"versions": [ | ||
"versions.yml:md5,efd610134e8fc0892fddb2c50121e097" | ||
] | ||
} | ||
], | ||
"meta": { | ||
"nf-test": "0.8.4", | ||
"nextflow": "24.04.2" | ||
}, | ||
"timestamp": "2024-06-26T15:39:14.259911" | ||
}, | ||
"yaml - no_template - stub": { | ||
"content": [ | ||
{ | ||
"0": [ | ||
[ | ||
{ | ||
"id": "no_template" | ||
}, | ||
"no_template.yaml:md5,d41d8cd98f00b204e9800998ecf8427e" | ||
] | ||
], | ||
"1": [ | ||
"versions.yml:md5,efd610134e8fc0892fddb2c50121e097" | ||
], | ||
"rendered": [ | ||
[ | ||
{ | ||
"id": "no_template" | ||
}, | ||
"no_template.yaml:md5,d41d8cd98f00b204e9800998ecf8427e" | ||
] | ||
], | ||
"versions": [ | ||
"versions.yml:md5,efd610134e8fc0892fddb2c50121e097" | ||
] | ||
} | ||
], | ||
"meta": { | ||
"nf-test": "0.8.4", | ||
"nextflow": "24.04.2" | ||
}, | ||
"timestamp": "2024-06-26T15:39:18.386795" | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.