-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from mirpedrol/fix-linting
fix nf-core linting
- Loading branch information
Showing
19 changed files
with
1,307 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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,2 @@ | ||
.nf-test.log | ||
.nf-test/ |
This file contains 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,9 @@ | ||
--- | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json | ||
name: "pigz_compress" | ||
channels: | ||
- conda-forge | ||
- bioconda | ||
- defaults | ||
dependencies: | ||
- "pigz=2.8" |
This file contains 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,45 @@ | ||
process PIGZ_COMPRESS { | ||
tag "$meta.id" | ||
label 'process_low' | ||
|
||
conda "${moduleDir}/environment.yml" | ||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? | ||
'https://depot.galaxyproject.org/singularity/pigz:2.8': | ||
'biocontainers/pigz:2.8' }" | ||
|
||
input: | ||
tuple val(meta), path(raw_file) | ||
|
||
output: | ||
tuple val(meta), path("$archive"), emit: archive | ||
path "versions.yml" , emit: versions | ||
|
||
when: | ||
task.ext.when == null || task.ext.when | ||
|
||
script: | ||
def args = task.ext.args ?: '' | ||
archive = raw_file.toString() + ".gz" | ||
""" | ||
# Note: needs --stdout for pigz to avoid the following issue: | ||
# pigz: skipping: ${raw_file} is a symbolic link | ||
pigz --processes $task.cpus --stdout --force ${args} ${raw_file} > ${archive} | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
pigz:\$(echo \$(pigz --version 2>&1) | sed 's/^.*pigz\\w*//' ) | ||
END_VERSIONS | ||
""" | ||
|
||
stub: | ||
def args = task.ext.args ?: '' | ||
archive = raw_file.toString() + ".gz" | ||
""" | ||
touch ${archive} | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
pigz:\$(echo \$(pigz --version 2>&1) | sed 's/^.*pigz\\w*//' ) | ||
END_VERSIONS | ||
""" | ||
} |
This file contains 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,43 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/mirpedrol/class-modules/main/modules/yaml-schema.json | ||
name: "pigz_compress" | ||
description: Compresses files with pigz. | ||
keywords: | ||
- compress | ||
- gzip | ||
- parallelized | ||
tools: | ||
- "pigz": | ||
description: "Parallel implementation of the gzip algorithm." | ||
homepage: "https://zlib.net/pigz/" | ||
documentation: "https://zlib.net/pigz/pigz.pdf" | ||
identifier: "" | ||
input: | ||
- - meta: | ||
type: map | ||
description: | | ||
Groovy Map containing sample information | ||
e.g. `[ id:'sample1', single_end:false ]` | ||
- raw_file: | ||
type: file | ||
description: File to be compressed | ||
pattern: "*.*" | ||
output: | ||
- archive: | ||
- meta: | ||
type: map | ||
description: | | ||
Groovy Map containing sample information | ||
e.g. `[ id:'sample1', single_end:false ]` | ||
- $archive: | ||
type: file | ||
description: The compressed file | ||
pattern: "*.gz" | ||
- versions: | ||
- versions.yml: | ||
type: file | ||
description: File containing software versions | ||
pattern: "versions.yml" | ||
authors: | ||
- "@leoisl" | ||
maintainers: | ||
- "@leoisl" |
This file contains 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,49 @@ | ||
nextflow_process { | ||
name "Test Process PIGZ_COMPRESS" | ||
script "../main.nf" | ||
process "PIGZ_COMPRESS" | ||
|
||
tag "modules" | ||
tag "modules_classmodules" | ||
tag "pigz" | ||
tag "pigz/compress" | ||
|
||
test("sarscov2 - genome - fasta") { | ||
when { | ||
process { | ||
""" | ||
input[0] = [ | ||
[ id:'test'], // meta map | ||
file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) | ||
] | ||
""" | ||
} | ||
} | ||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
{ assert snapshot(process.out).match() } | ||
) | ||
} | ||
} | ||
|
||
test("sarscov2 - genome - fasta - stub") { | ||
options "-stub-run" | ||
when { | ||
process { | ||
""" | ||
input[0] = [ | ||
[ id:'test'], // meta map | ||
file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) | ||
] | ||
""" | ||
} | ||
} | ||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
{ assert snapshot(file(process.out.archive[0][1]).name).match() } | ||
) | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
modules/class-modules/pigz/compress/tests/main.nf.test.snap
This file contains 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,37 @@ | ||
{ | ||
"sarscov2 - genome - fasta": { | ||
"content": [ | ||
{ | ||
"0": [ | ||
[ | ||
{ | ||
"id": "test" | ||
}, | ||
"genome.fasta.gz:md5,6e9fe4042a72f2345f644f239272b7e6" | ||
] | ||
], | ||
"1": [ | ||
"versions.yml:md5,ca30e9e1ffa1394ba7eefdac8cf3a3ad" | ||
], | ||
"archive": [ | ||
[ | ||
{ | ||
"id": "test" | ||
}, | ||
"genome.fasta.gz:md5,6e9fe4042a72f2345f644f239272b7e6" | ||
] | ||
], | ||
"versions": [ | ||
"versions.yml:md5,ca30e9e1ffa1394ba7eefdac8cf3a3ad" | ||
] | ||
} | ||
], | ||
"timestamp": "2023-12-11T22:39:53.350546" | ||
}, | ||
"sarscov2 - genome - fasta - stub": { | ||
"content": [ | ||
"genome.fasta.gz" | ||
], | ||
"timestamp": "2023-12-11T22:52:24.309192" | ||
} | ||
} |
This file contains 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,2 @@ | ||
pigz/compress: | ||
- "modules/nf-core/pigz/compress/**" |
This file contains 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
This file contains 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
This file contains 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
This file contains 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,11 @@ | ||
name: untar | ||
|
||
channels: | ||
- conda-forge | ||
- bioconda | ||
- defaults | ||
|
||
dependencies: | ||
- conda-forge::grep=3.11 | ||
- conda-forge::sed=4.7 | ||
- conda-forge::tar=1.34 |
This file contains 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,63 @@ | ||
process UNTAR { | ||
tag "$archive" | ||
label 'process_single' | ||
|
||
conda "${moduleDir}/environment.yml" | ||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? | ||
'https://depot.galaxyproject.org/singularity/ubuntu:20.04' : | ||
'nf-core/ubuntu:20.04' }" | ||
|
||
input: | ||
tuple val(meta), path(archive) | ||
|
||
output: | ||
tuple val(meta), path("$prefix"), emit: untar | ||
path "versions.yml" , emit: versions | ||
|
||
when: | ||
task.ext.when == null || task.ext.when | ||
|
||
script: | ||
def args = task.ext.args ?: '' | ||
def args2 = task.ext.args2 ?: '' | ||
prefix = task.ext.prefix ?: ( meta.id ? "${meta.id}" : archive.baseName.toString().replaceFirst(/\.tar$/, "")) | ||
|
||
""" | ||
mkdir $prefix | ||
## Ensures --strip-components only applied when top level of tar contents is a directory | ||
## If just files or multiple directories, place all in prefix | ||
if [[ \$(tar -taf ${archive} | grep -o -P "^.*?\\/" | uniq | wc -l) -eq 1 ]]; then | ||
tar \\ | ||
-C $prefix --strip-components 1 \\ | ||
-xavf \\ | ||
$args \\ | ||
$archive \\ | ||
$args2 | ||
else | ||
tar \\ | ||
-C $prefix \\ | ||
-xavf \\ | ||
$args \\ | ||
$archive \\ | ||
$args2 | ||
fi | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
untar: \$(echo \$(tar --version 2>&1) | sed 's/^.*(GNU tar) //; s/ Copyright.*\$//') | ||
END_VERSIONS | ||
""" | ||
|
||
stub: | ||
prefix = task.ext.prefix ?: ( meta.id ? "${meta.id}" : archive.toString().replaceFirst(/\.[^\.]+(.gz)?$/, "")) | ||
""" | ||
mkdir $prefix | ||
touch ${prefix}/file.txt | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
untar: \$(echo \$(tar --version 2>&1) | sed 's/^.*(GNU tar) //; s/ Copyright.*\$//') | ||
END_VERSIONS | ||
""" | ||
} |
Oops, something went wrong.