From b9672b553e9204ed4ea62b087aa00a01ca3f385f Mon Sep 17 00:00:00 2001 From: Usman Rashid Date: Thu, 2 May 2024 17:57:52 +1200 Subject: [PATCH] Added tirlearner --- .../tirlearner/environment.yml | 9 + modules/edta-components/tirlearner/main.nf | 64 ++++++ modules/edta-components/tirlearner/meta.yml | 64 ++++++ .../tirlearner/tests/main.nf.test | 68 +++++++ .../tirlearner/tests/main.nf.test.snap | 164 +++++++++++++++ .../edta-components/tirlearner/tests/tags.yml | 2 + modules/environment-schema.json | 34 ++++ modules/meta-schema.json | 186 ++++++++++++++++++ modules/nf-core/gunzip/environment.yml | 7 + modules/nf-core/gunzip/main.nf | 48 +++++ modules/nf-core/gunzip/meta.yml | 39 ++++ modules/nf-core/gunzip/tests/main.nf.test | 36 ++++ .../nf-core/gunzip/tests/main.nf.test.snap | 31 +++ modules/nf-core/gunzip/tests/tags.yml | 2 + modules/yaml-schema.json | 1 + nf-core-hybridisation.sh | 4 + nf-core-modules/.nf-core.yml | 1 + nf-core-modules/main.nf | 0 nf-core-modules/modules.json | 17 ++ .../modules/nf-core/gunzip/environment.yml | 7 + .../modules/nf-core/gunzip/main.nf | 48 +++++ .../modules/nf-core/gunzip/meta.yml | 39 ++++ .../modules/nf-core/gunzip/tests/main.nf.test | 36 ++++ .../nf-core/gunzip/tests/main.nf.test.snap | 31 +++ .../modules/nf-core/gunzip/tests/tags.yml | 2 + nf-core-modules/nextflow.config | 0 tests/config/test_data.config | 2 +- 27 files changed, 941 insertions(+), 1 deletion(-) create mode 100644 modules/edta-components/tirlearner/environment.yml create mode 100644 modules/edta-components/tirlearner/main.nf create mode 100644 modules/edta-components/tirlearner/meta.yml create mode 100644 modules/edta-components/tirlearner/tests/main.nf.test create mode 100644 modules/edta-components/tirlearner/tests/main.nf.test.snap create mode 100644 modules/edta-components/tirlearner/tests/tags.yml create mode 100644 modules/environment-schema.json create mode 100644 modules/meta-schema.json create mode 100644 modules/nf-core/gunzip/environment.yml create mode 100644 modules/nf-core/gunzip/main.nf create mode 100644 modules/nf-core/gunzip/meta.yml create mode 100644 modules/nf-core/gunzip/tests/main.nf.test create mode 100644 modules/nf-core/gunzip/tests/main.nf.test.snap create mode 100644 modules/nf-core/gunzip/tests/tags.yml create mode 120000 modules/yaml-schema.json create mode 100644 nf-core-modules/.nf-core.yml create mode 100644 nf-core-modules/main.nf create mode 100644 nf-core-modules/modules.json create mode 100644 nf-core-modules/modules/nf-core/gunzip/environment.yml create mode 100644 nf-core-modules/modules/nf-core/gunzip/main.nf create mode 100644 nf-core-modules/modules/nf-core/gunzip/meta.yml create mode 100644 nf-core-modules/modules/nf-core/gunzip/tests/main.nf.test create mode 100644 nf-core-modules/modules/nf-core/gunzip/tests/main.nf.test.snap create mode 100644 nf-core-modules/modules/nf-core/gunzip/tests/tags.yml create mode 100644 nf-core-modules/nextflow.config diff --git a/modules/edta-components/tirlearner/environment.yml b/modules/edta-components/tirlearner/environment.yml new file mode 100644 index 0000000..36344b7 --- /dev/null +++ b/modules/edta-components/tirlearner/environment.yml @@ -0,0 +1,9 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +name: "tirlearner" +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - "bioconda::tir-learner=3.0.1" diff --git a/modules/edta-components/tirlearner/main.nf b/modules/edta-components/tirlearner/main.nf new file mode 100644 index 0000000..4da9520 --- /dev/null +++ b/modules/edta-components/tirlearner/main.nf @@ -0,0 +1,64 @@ +process TIRLEARNER { + tag "$meta.id" + label 'process_high' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/tir-learner:3.0.1--hdfd78af_0': + 'biocontainers/tir-learner:3.0.1--hdfd78af_0' }" + + input: + tuple val(meta), path(fasta) + val species + + output: + tuple val(meta), path("${prefix}.fa") , emit: fasta + tuple val(meta), path("${prefix}.gff3") , emit: gff + tuple val(meta), path("${prefix}.filtered.fa") , emit: filtered_fasta + tuple val(meta), path("${prefix}.filtered.gff3"), emit: filtered_gff + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" + if ( "$fasta" == "${prefix}.fa" ) error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!" + """ + TIR-Learner \\ + -f $fasta \\ + -s $species \\ + -t $task.cpus \\ + -o $prefix \\ + $args + + mv "${prefix}/TIR-Learner-Result/TIR-Learner_FinalAnn.fa" "${prefix}.fa" + mv "${prefix}/TIR-Learner-Result/TIR-Learner_FinalAnn.gff3" "${prefix}.gff3" + + mv "${prefix}/TIR-Learner-Result/TIR-Learner_FinalAnn_filter.fa" "${prefix}.filtered.fa" + mv "${prefix}/TIR-Learner-Result/TIR-Learner_FinalAnn_filter.gff3" "${prefix}.filtered.gff3" + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + TIR-Learner: \$(TIR-Learner -v | head -n 1 | sed 's/TIR-Learner //') + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" + if ( "$fasta" == "${prefix}.fa" ) error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!" + """ + touch "${prefix}.fa" + touch "${prefix}.gff3" + + touch "${prefix}.filtered.fa" + touch "${prefix}.filtered.gff3" + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + TIR-Learner: \$(TIR-Learner -v | head -n 1 | sed 's/TIR-Learner //') + END_VERSIONS + """ +} diff --git a/modules/edta-components/tirlearner/meta.yml b/modules/edta-components/tirlearner/meta.yml new file mode 100644 index 0000000..cb0af30 --- /dev/null +++ b/modules/edta-components/tirlearner/meta.yml @@ -0,0 +1,64 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "tirlearner" +description: | + Ensemble Method for TIR Transposable Element Annotation +keywords: + - genomics + - annotation + - repeat + - transposable +tools: + - "TIR-Learner": + description: TIR-Learner + homepage: "https://github.com/lutianyu2001/TIR-Learner" + documentation: "https://github.com/lutianyu2001/TIR-Learner" + tool_dev_url: "https://github.com/lutianyu2001/TIR-Learner" + doi: "10.1016/j.molp.2019.02.008" + licence: ["GPLv3"] +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - fasta: + type: file + description: Genome sequences in fasta format + pattern: "*.{fsa,fa,fasta}" + - species: + type: string + description: | + "maize", "rice" or "others" +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - fasta: + type: file + description: Putative TIRs in fasta format + pattern: "*.fa" + - gff: + type: file + description: Putative TIRs in GFF3 format + pattern: "*.gff3" + - filtered_fasta: + type: file + description: Filtered TIRs in fasta format + pattern: "*.fa" + - filtered_gff: + type: file + description: Filtered TIRs in GFF3 format + pattern: "*.gff3" + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@jguhlin" + - "@GallVp" +maintainers: + - "@jguhlin" + - "@GallVp" diff --git a/modules/edta-components/tirlearner/tests/main.nf.test b/modules/edta-components/tirlearner/tests/main.nf.test new file mode 100644 index 0000000..0bb94d3 --- /dev/null +++ b/modules/edta-components/tirlearner/tests/main.nf.test @@ -0,0 +1,68 @@ +nextflow_process { + + name "Test Process TIRLEARNER" + script "../main.nf" + process "TIRLEARNER" + + tag "modules" + tag "modules_nfcore" + tag "tirlearner" + tag "gunzip/main" + + setup { + run('GUNZIP') { + script "../../../nf-core/gunzip/main" + + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.test_data['actinidia_chinensis']['genome']['genome_1_fasta_gz'], checkIfExists: true) + ] + """ + } + } + } + + test("actinidia_chinensis-genome_1_fasta_gz-success") { + + when { + process { + """ + input[0] = GUNZIP.out.gunzip + input[1] = 'others' + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("stub") { + + options "-stub" + + when { + process { + """ + input[0] = GUNZIP.out.gunzip + input[1] = 'others' + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } +} diff --git a/modules/edta-components/tirlearner/tests/main.nf.test.snap b/modules/edta-components/tirlearner/tests/main.nf.test.snap new file mode 100644 index 0000000..e245b2d --- /dev/null +++ b/modules/edta-components/tirlearner/tests/main.nf.test.snap @@ -0,0 +1,164 @@ +{ + "actinidia_chinensis-genome_1_fasta_gz-success": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.fa:md5,65987decb67d1e3f95b993f86d14c0d0" + ] + ], + "1": [ + [ + { + "id": "test" + }, + "test.gff3:md5,90bf040e7b29763351237207297dc801" + ] + ], + "2": [ + [ + { + "id": "test" + }, + "test.filtered.fa:md5,65987decb67d1e3f95b993f86d14c0d0" + ] + ], + "3": [ + [ + { + "id": "test" + }, + "test.filtered.gff3:md5,90bf040e7b29763351237207297dc801" + ] + ], + "4": [ + "versions.yml:md5,3d4a9683fc634e22fd79a4fbe0b23a30" + ], + "fasta": [ + [ + { + "id": "test" + }, + "test.fa:md5,65987decb67d1e3f95b993f86d14c0d0" + ] + ], + "filtered_fasta": [ + [ + { + "id": "test" + }, + "test.filtered.fa:md5,65987decb67d1e3f95b993f86d14c0d0" + ] + ], + "filtered_gff": [ + [ + { + "id": "test" + }, + "test.filtered.gff3:md5,90bf040e7b29763351237207297dc801" + ] + ], + "gff": [ + [ + { + "id": "test" + }, + "test.gff3:md5,90bf040e7b29763351237207297dc801" + ] + ], + "versions": [ + "versions.yml:md5,3d4a9683fc634e22fd79a4fbe0b23a30" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-05-02T16:35:56.356956" + }, + "stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.fa:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test" + }, + "test.gff3:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + [ + { + "id": "test" + }, + "test.filtered.fa:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + [ + { + "id": "test" + }, + "test.filtered.gff3:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "4": [ + "versions.yml:md5,3d4a9683fc634e22fd79a4fbe0b23a30" + ], + "fasta": [ + [ + { + "id": "test" + }, + "test.fa:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "filtered_fasta": [ + [ + { + "id": "test" + }, + "test.filtered.fa:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "filtered_gff": [ + [ + { + "id": "test" + }, + "test.filtered.gff3:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "gff": [ + [ + { + "id": "test" + }, + "test.gff3:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,3d4a9683fc634e22fd79a4fbe0b23a30" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-05-02T16:36:08.718538" + } +} \ No newline at end of file diff --git a/modules/edta-components/tirlearner/tests/tags.yml b/modules/edta-components/tirlearner/tests/tags.yml new file mode 100644 index 0000000..190430a --- /dev/null +++ b/modules/edta-components/tirlearner/tests/tags.yml @@ -0,0 +1,2 @@ +tirlearner: + - "modules/edta-components/tirlearner/**" diff --git a/modules/environment-schema.json b/modules/environment-schema.json new file mode 100644 index 0000000..ca7bdf6 --- /dev/null +++ b/modules/environment-schema.json @@ -0,0 +1,34 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "title": "conda environment yaml", + "description": "Validate the environment.yml file for an nf-core module", + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the component, same as in the meta.yml" + }, + "channels": { + "type": "array", + "items": [ + { + "enum": ["conda-forge"] + }, + { + "enum": ["bioconda"] + }, + { + "enum": ["defaults"] + } + ], + "minItems": 3 + }, + "dependencies": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["name", "channels", "dependencies"] +} diff --git a/modules/meta-schema.json b/modules/meta-schema.json new file mode 100644 index 0000000..0b855d7 --- /dev/null +++ b/modules/meta-schema.json @@ -0,0 +1,186 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "title": "Meta yaml", + "description": "Validate the meta yaml file for an nf-core module", + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the module" + }, + "description": { + "type": "string", + "description": "Description of the module" + }, + "keywords": { + "type": "array", + "description": "Keywords for the module", + "items": { + "type": "string" + }, + "minItems": 3 + }, + "authors": { + "type": "array", + "description": "Authors of the module", + "items": { + "type": "string" + } + }, + "maintainers": { + "type": "array", + "description": "Maintainers of the module", + "items": { + "type": "string" + } + }, + "input": { + "type": "array", + "description": "Input channels for the module", + "items": { + "type": "object", + "patternProperties": { + ".*": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Type of the input channel", + "enum": ["map", "file", "directory", "string", "integer", "float", "boolean", "list"] + }, + "description": { + "type": "string", + "description": "Description of the input channel" + }, + "pattern": { + "type": "string", + "description": "Pattern of the input channel, given in Java glob syntax" + }, + "default": { + "type": ["string", "number", "boolean", "array", "object"], + "description": "Default value for the input channel" + }, + "enum": { + "type": "array", + "description": "List of allowed values for the input channel", + "items": { + "type": ["string", "number", "boolean", "array", "object"] + }, + "uniqueItems": true + } + }, + "required": ["type", "description"] + } + } + } + }, + "output": { + "type": "array", + "description": "Output channels for the module", + "items": { + "type": "object", + "patternProperties": { + ".*": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Type of the output channel", + "enum": ["map", "file", "directory", "string", "integer", "float", "boolean", "list"] + }, + "description": { + "type": "string", + "description": "Description of the output channel" + }, + "pattern": { + "type": "string", + "description": "Pattern of the input channel, given in Java glob syntax" + }, + "enum": { + "type": "array", + "description": "List of allowed values for the output channel", + "items": { + "type": ["string", "number", "boolean", "array", "object"] + }, + "uniqueItems": true + } + }, + "required": ["type", "description"] + } + } + } + }, + "tools": { + "type": "array", + "description": "Tools used by the module", + "items": { + "type": "object", + "patternProperties": { + ".*": { + "type": "object", + "properties": { + "description": { + "type": "string", + "description": "Description of the output channel" + }, + "homepage": { + "type": "string", + "description": "Homepage of the tool", + "pattern": "^(http|https)://.*$" + }, + "documentation": { + "type": "string", + "description": "Documentation of the tool", + "pattern": "^(http|https|ftp)://.*$" + }, + "tool_dev_url": { + "type": "string", + "description": "URL of the development version of the tool's documentation", + "pattern": "^(http|https)://.*$" + }, + "doi": { + "description": "DOI of the tool", + "anyOf": [ + { + "type": "string", + "pattern": "^10\\.\\d{4,9}\\/[^,]+$" + }, + { + "type": "string", + "enum": ["no DOI available"] + } + ] + }, + "licence": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Licence of the tool", + "minItems": 1, + "uniqueItems": true, + "message": "Licence must be an array of one or more entries, e.g. [\"MIT\"]" + } + }, + "required": ["description"], + "anyOf": [ + { + "required": ["homepage"] + }, + { + "required": ["documentation"] + }, + { + "required": ["tool_dev_url"] + }, + { + "required": ["doi"] + } + ] + } + } + } + } + }, + "required": ["name", "description", "keywords", "authors", "output", "tools"] +} diff --git a/modules/nf-core/gunzip/environment.yml b/modules/nf-core/gunzip/environment.yml new file mode 100644 index 0000000..25910b3 --- /dev/null +++ b/modules/nf-core/gunzip/environment.yml @@ -0,0 +1,7 @@ +name: gunzip +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - conda-forge::sed=4.7 diff --git a/modules/nf-core/gunzip/main.nf b/modules/nf-core/gunzip/main.nf new file mode 100644 index 0000000..468a6f2 --- /dev/null +++ b/modules/nf-core/gunzip/main.nf @@ -0,0 +1,48 @@ +process GUNZIP { + 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("$gunzip"), emit: gunzip + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + gunzip = archive.toString() - '.gz' + """ + # Not calling gunzip itself because it creates files + # with the original group ownership rather than the + # default one for that user / the work directory + gzip \\ + -cd \\ + $args \\ + $archive \\ + > $gunzip + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + gunzip: \$(echo \$(gunzip --version 2>&1) | sed 's/^.*(gzip) //; s/ Copyright.*\$//') + END_VERSIONS + """ + + stub: + gunzip = archive.toString() - '.gz' + """ + touch $gunzip + cat <<-END_VERSIONS > versions.yml + "${task.process}": + gunzip: \$(echo \$(gunzip --version 2>&1) | sed 's/^.*(gzip) //; s/ Copyright.*\$//') + END_VERSIONS + """ +} diff --git a/modules/nf-core/gunzip/meta.yml b/modules/nf-core/gunzip/meta.yml new file mode 100644 index 0000000..231034f --- /dev/null +++ b/modules/nf-core/gunzip/meta.yml @@ -0,0 +1,39 @@ +name: gunzip +description: Compresses and decompresses files. +keywords: + - gunzip + - compression + - decompression +tools: + - gunzip: + description: | + gzip is a file format and a software application used for file compression and decompression. + documentation: https://www.gnu.org/software/gzip/manual/gzip.html + licence: ["GPL-3.0-or-later"] +input: + - meta: + type: map + description: | + Optional groovy Map containing meta information + e.g. [ id:'test', single_end:false ] + - archive: + type: file + description: File to be compressed/uncompressed + pattern: "*.*" +output: + - gunzip: + type: file + description: Compressed/uncompressed file + pattern: "*.*" + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@joseespinosa" + - "@drpatelh" + - "@jfy133" +maintainers: + - "@joseespinosa" + - "@drpatelh" + - "@jfy133" diff --git a/modules/nf-core/gunzip/tests/main.nf.test b/modules/nf-core/gunzip/tests/main.nf.test new file mode 100644 index 0000000..6406008 --- /dev/null +++ b/modules/nf-core/gunzip/tests/main.nf.test @@ -0,0 +1,36 @@ +nextflow_process { + + name "Test Process GUNZIP" + script "../main.nf" + process "GUNZIP" + tag "gunzip" + tag "modules_nfcore" + tag "modules" + + test("Should run without failures") { + + when { + params { + outdir = "$outputDir" + } + process { + """ + input[0] = Channel.of([ + [], + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) + ] + ) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/gunzip/tests/main.nf.test.snap b/modules/nf-core/gunzip/tests/main.nf.test.snap new file mode 100644 index 0000000..720fd9f --- /dev/null +++ b/modules/nf-core/gunzip/tests/main.nf.test.snap @@ -0,0 +1,31 @@ +{ + "Should run without failures": { + "content": [ + { + "0": [ + [ + [ + + ], + "test_1.fastq:md5,4161df271f9bfcd25d5845a1e220dbec" + ] + ], + "1": [ + "versions.yml:md5,54376d32aca20e937a4ec26dac228e84" + ], + "gunzip": [ + [ + [ + + ], + "test_1.fastq:md5,4161df271f9bfcd25d5845a1e220dbec" + ] + ], + "versions": [ + "versions.yml:md5,54376d32aca20e937a4ec26dac228e84" + ] + } + ], + "timestamp": "2023-10-17T15:35:37.690477896" + } +} \ No newline at end of file diff --git a/modules/nf-core/gunzip/tests/tags.yml b/modules/nf-core/gunzip/tests/tags.yml new file mode 100644 index 0000000..fd3f691 --- /dev/null +++ b/modules/nf-core/gunzip/tests/tags.yml @@ -0,0 +1,2 @@ +gunzip: + - modules/nf-core/gunzip/** diff --git a/modules/yaml-schema.json b/modules/yaml-schema.json new file mode 120000 index 0000000..d84030e --- /dev/null +++ b/modules/yaml-schema.json @@ -0,0 +1 @@ +meta-schema.json \ No newline at end of file diff --git a/nf-core-hybridisation.sh b/nf-core-hybridisation.sh index f1f641a..a92fb0c 100755 --- a/nf-core-hybridisation.sh +++ b/nf-core-hybridisation.sh @@ -1 +1,5 @@ #!/usr/bin/env bash + +# Modules for tests +mkdir -p ./modules/nf-core/gunzip +cp -r ./nf-core-modules/modules/nf-core/gunzip/ ./modules/nf-core/gunzip/ diff --git a/nf-core-modules/.nf-core.yml b/nf-core-modules/.nf-core.yml new file mode 100644 index 0000000..3805dc8 --- /dev/null +++ b/nf-core-modules/.nf-core.yml @@ -0,0 +1 @@ +repository_type: pipeline diff --git a/nf-core-modules/main.nf b/nf-core-modules/main.nf new file mode 100644 index 0000000..e69de29 diff --git a/nf-core-modules/modules.json b/nf-core-modules/modules.json new file mode 100644 index 0000000..47010cc --- /dev/null +++ b/nf-core-modules/modules.json @@ -0,0 +1,17 @@ +{ + "name": "", + "homePage": "", + "repos": { + "https://github.com/nf-core/modules.git": { + "modules": { + "nf-core": { + "gunzip": { + "branch": "master", + "git_sha": "3a5fef109d113b4997c9822198664ca5f2716208", + "installed_by": ["modules"] + } + } + } + } + } +} diff --git a/nf-core-modules/modules/nf-core/gunzip/environment.yml b/nf-core-modules/modules/nf-core/gunzip/environment.yml new file mode 100644 index 0000000..25910b3 --- /dev/null +++ b/nf-core-modules/modules/nf-core/gunzip/environment.yml @@ -0,0 +1,7 @@ +name: gunzip +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - conda-forge::sed=4.7 diff --git a/nf-core-modules/modules/nf-core/gunzip/main.nf b/nf-core-modules/modules/nf-core/gunzip/main.nf new file mode 100644 index 0000000..468a6f2 --- /dev/null +++ b/nf-core-modules/modules/nf-core/gunzip/main.nf @@ -0,0 +1,48 @@ +process GUNZIP { + 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("$gunzip"), emit: gunzip + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + gunzip = archive.toString() - '.gz' + """ + # Not calling gunzip itself because it creates files + # with the original group ownership rather than the + # default one for that user / the work directory + gzip \\ + -cd \\ + $args \\ + $archive \\ + > $gunzip + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + gunzip: \$(echo \$(gunzip --version 2>&1) | sed 's/^.*(gzip) //; s/ Copyright.*\$//') + END_VERSIONS + """ + + stub: + gunzip = archive.toString() - '.gz' + """ + touch $gunzip + cat <<-END_VERSIONS > versions.yml + "${task.process}": + gunzip: \$(echo \$(gunzip --version 2>&1) | sed 's/^.*(gzip) //; s/ Copyright.*\$//') + END_VERSIONS + """ +} diff --git a/nf-core-modules/modules/nf-core/gunzip/meta.yml b/nf-core-modules/modules/nf-core/gunzip/meta.yml new file mode 100644 index 0000000..231034f --- /dev/null +++ b/nf-core-modules/modules/nf-core/gunzip/meta.yml @@ -0,0 +1,39 @@ +name: gunzip +description: Compresses and decompresses files. +keywords: + - gunzip + - compression + - decompression +tools: + - gunzip: + description: | + gzip is a file format and a software application used for file compression and decompression. + documentation: https://www.gnu.org/software/gzip/manual/gzip.html + licence: ["GPL-3.0-or-later"] +input: + - meta: + type: map + description: | + Optional groovy Map containing meta information + e.g. [ id:'test', single_end:false ] + - archive: + type: file + description: File to be compressed/uncompressed + pattern: "*.*" +output: + - gunzip: + type: file + description: Compressed/uncompressed file + pattern: "*.*" + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@joseespinosa" + - "@drpatelh" + - "@jfy133" +maintainers: + - "@joseespinosa" + - "@drpatelh" + - "@jfy133" diff --git a/nf-core-modules/modules/nf-core/gunzip/tests/main.nf.test b/nf-core-modules/modules/nf-core/gunzip/tests/main.nf.test new file mode 100644 index 0000000..6406008 --- /dev/null +++ b/nf-core-modules/modules/nf-core/gunzip/tests/main.nf.test @@ -0,0 +1,36 @@ +nextflow_process { + + name "Test Process GUNZIP" + script "../main.nf" + process "GUNZIP" + tag "gunzip" + tag "modules_nfcore" + tag "modules" + + test("Should run without failures") { + + when { + params { + outdir = "$outputDir" + } + process { + """ + input[0] = Channel.of([ + [], + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) + ] + ) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/nf-core-modules/modules/nf-core/gunzip/tests/main.nf.test.snap b/nf-core-modules/modules/nf-core/gunzip/tests/main.nf.test.snap new file mode 100644 index 0000000..720fd9f --- /dev/null +++ b/nf-core-modules/modules/nf-core/gunzip/tests/main.nf.test.snap @@ -0,0 +1,31 @@ +{ + "Should run without failures": { + "content": [ + { + "0": [ + [ + [ + + ], + "test_1.fastq:md5,4161df271f9bfcd25d5845a1e220dbec" + ] + ], + "1": [ + "versions.yml:md5,54376d32aca20e937a4ec26dac228e84" + ], + "gunzip": [ + [ + [ + + ], + "test_1.fastq:md5,4161df271f9bfcd25d5845a1e220dbec" + ] + ], + "versions": [ + "versions.yml:md5,54376d32aca20e937a4ec26dac228e84" + ] + } + ], + "timestamp": "2023-10-17T15:35:37.690477896" + } +} \ No newline at end of file diff --git a/nf-core-modules/modules/nf-core/gunzip/tests/tags.yml b/nf-core-modules/modules/nf-core/gunzip/tests/tags.yml new file mode 100644 index 0000000..fd3f691 --- /dev/null +++ b/nf-core-modules/modules/nf-core/gunzip/tests/tags.yml @@ -0,0 +1,2 @@ +gunzip: + - modules/nf-core/gunzip/** diff --git a/nf-core-modules/nextflow.config b/nf-core-modules/nextflow.config new file mode 100644 index 0000000..e69de29 diff --git a/tests/config/test_data.config b/tests/config/test_data.config index 4633ce9..3c20520 100644 --- a/tests/config/test_data.config +++ b/tests/config/test_data.config @@ -661,7 +661,7 @@ params { } 'actinidia_chinensis' { 'genome' { - genome_21_fasta_gz = "${params.test_data_base}/data/genomics/eukaryotes/actinidia_chinensis/genome/chr1/genome.fasta.gz" + genome_1_fasta_gz = "${params.test_data_base}/data/genomics/eukaryotes/actinidia_chinensis/genome/chr1/genome.fasta.gz" } } 'generic' {