forked from nf-core/modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add ska/fasta module * Update modules/nf-core/ska/fasta/main.nf Co-authored-by: Jose Espinosa-Carrasco <[email protected]> * Update modules/nf-core/ska/fasta/main.nf Co-authored-by: Jose Espinosa-Carrasco <[email protected]> * Update modules/nf-core/ska/fasta/main.nf Co-authored-by: Jose Espinosa-Carrasco <[email protected]> * Update modules/nf-core/ska/fasta/meta.yml Co-authored-by: Jose Espinosa-Carrasco <[email protected]> * Update modules/nf-core/ska/fasta/tests/main.nf.test Co-authored-by: Jose Espinosa-Carrasco <[email protected]> * Tweak tests for unstable md5 * Update modules/nf-core/ska/fasta/meta.yml Co-authored-by: Sateesh_Peri <[email protected]> * Update modules/nf-core/ska/fasta/meta.yml Co-authored-by: Sateesh_Peri <[email protected]> * Update modules/nf-core/ska/fasta/meta.yml Co-authored-by: Sateesh_Peri <[email protected]> * Update modules/nf-core/ska/fasta/meta.yml Co-authored-by: Sateesh_Peri <[email protected]> * Delete nxf-tmp.xaQb2l * Update modules/nf-core/ska/fasta/main.nf Co-authored-by: Sateesh_Peri <[email protected]> * Add ripgrep module * Fix meta * Add name safety, add compression to stub --------- Co-authored-by: Jose Espinosa-Carrasco <[email protected]> Co-authored-by: Sateesh_Peri <[email protected]>
- Loading branch information
Showing
5 changed files
with
312 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
channels: | ||
- conda-forge | ||
- bioconda | ||
|
||
dependencies: | ||
- conda-forge::pigz=2.8 | ||
- conda-forge::ripgrep=14.1.1 |
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,55 @@ | ||
process RIPGREP { | ||
tag "$meta.id" | ||
label 'process_low' | ||
|
||
conda "${moduleDir}/environment.yml" | ||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? | ||
'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/de/deecf2e0aab3f4ba7c04eb24724f5c80550e39bec80760b18c7b52f8efa8e6b3/data': | ||
'community.wave.seqera.io/library/pigz_ripgrep:94e5407412b666ab' }" | ||
|
||
input: | ||
tuple val(meta), path(files) | ||
val pattern | ||
val compress | ||
|
||
output: | ||
tuple val(meta), path("*.txt{.gz,}"), emit: txt | ||
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}" | ||
def write_output = compress ? " | pigz -cp ${task.cpus} > ${prefix}.txt.gz" : "> ${prefix}.txt" | ||
if (!compress && files.contains("${prefix}.txt") || compress && files.contains("${prefix}.txt.gz")) { | ||
error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!" | ||
} | ||
""" | ||
rg \\ | ||
$args \\ | ||
--threads $task.cpus \\ | ||
$pattern \\ | ||
$files \\ | ||
$write_output | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
ripgrep: \$(rg --version |& sed '1!d ; s/ripgrep //') | ||
END_VERSIONS | ||
""" | ||
|
||
stub: | ||
def args = task.ext.args ?: '' | ||
def prefix = task.ext.prefix ?: "${meta.id}" | ||
def write_output = compress ? "touch ${prefix}.txt.gz" : "touch ${prefix}.txt" | ||
""" | ||
$write_output | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
ripgrep: \$(rg --version |& sed '1!d ; s/ripgrep //') | ||
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,59 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json | ||
name: "ripgrep" | ||
description: ripgrep recursively searches directories for a regex pattern | ||
keywords: | ||
- search | ||
- regex | ||
- patterns | ||
tools: | ||
- "ripgrep": | ||
description: "ripgrep recursively searches directories for a regex pattern" | ||
homepage: "https://github.com/BurntSushi/ripgrep" | ||
documentation: "https://github.com/BurntSushi/ripgrep" | ||
tool_dev_url: "https://github.com/BurntSushi/ripgrep" | ||
licence: ["MIT", "UNLICENSE"] | ||
identifier: "" | ||
- "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' ]` | ||
- files: | ||
type: file | ||
description: File(s) to be searched | ||
|
||
- - pattern: | ||
type: string | ||
description: Regex pattern to search for | ||
|
||
- - compress: | ||
type: boolean | ||
description: Compress the output file using pigz | ||
default: false | ||
|
||
output: | ||
- txt: | ||
- meta: | ||
type: map | ||
description: Groovy map containing sample information | ||
- "*.txt{.gz,}": | ||
type: file | ||
description: Output file containing the search results | ||
pattern: "*.txt{.gz,}" | ||
- versions: | ||
- versions.yml: | ||
type: file | ||
description: File containing software versions | ||
pattern: "versions.yml" | ||
authors: | ||
- "@itrujnara" | ||
maintainers: | ||
- "@itrujnara" |
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,90 @@ | ||
nextflow_process { | ||
|
||
name "Test Process RIPGREP" | ||
script "../main.nf" | ||
process "RIPGREP" | ||
|
||
tag "modules" | ||
tag "modules_nfcore" | ||
tag "ripgrep" | ||
|
||
test("generic - csv") { | ||
|
||
when { | ||
process { | ||
""" | ||
input[0] = [ | ||
[ id:'test' ], // meta map | ||
file(params.modules_testdata_base_path + 'generic/csv/test.csv', checkIfExists: true), | ||
] | ||
input[1] = 'Robert' // pattern | ||
input[2] = false // compress | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
{ assert snapshot(process.out).match() } | ||
) | ||
} | ||
|
||
} | ||
|
||
test("generic - csv - compress") { | ||
|
||
when { | ||
process { | ||
""" | ||
input[0] = [ | ||
[ id:'test' ], // meta map | ||
file(params.modules_testdata_base_path + 'generic/csv/test.csv', checkIfExists: true), | ||
] | ||
input[1] = 'Robert' // pattern | ||
input[2] = true // compress | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
{ assert snapshot(process.out).match() } | ||
) | ||
} | ||
} | ||
|
||
test("generic - csv - stub") { | ||
|
||
options "-stub" | ||
|
||
when { | ||
process { | ||
""" | ||
input[0] = [ | ||
[ id:'test' ], // meta map | ||
file(params.modules_testdata_base_path + 'generic/csv/test.csv', checkIfExists: true), | ||
] | ||
input[1] = 'Robert' // pattern | ||
input[2] = false // compress | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
{ assert snapshot(process.out).match() } | ||
) | ||
} | ||
|
||
} | ||
|
||
} |
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,101 @@ | ||
{ | ||
"generic - csv": { | ||
"content": [ | ||
{ | ||
"0": [ | ||
[ | ||
{ | ||
"id": "test" | ||
}, | ||
"test.txt:md5,5f32b160f4f228e7abfda2cd988eb164" | ||
] | ||
], | ||
"1": [ | ||
"versions.yml:md5,d8a13e6037909fd47164f64bcdd8afa3" | ||
], | ||
"txt": [ | ||
[ | ||
{ | ||
"id": "test" | ||
}, | ||
"test.txt:md5,5f32b160f4f228e7abfda2cd988eb164" | ||
] | ||
], | ||
"versions": [ | ||
"versions.yml:md5,d8a13e6037909fd47164f64bcdd8afa3" | ||
] | ||
} | ||
], | ||
"meta": { | ||
"nf-test": "0.9.2", | ||
"nextflow": "24.10.3" | ||
}, | ||
"timestamp": "2025-01-08T13:04:56.719646" | ||
}, | ||
"generic - csv - stub": { | ||
"content": [ | ||
{ | ||
"0": [ | ||
[ | ||
{ | ||
"id": "test" | ||
}, | ||
"test.txt:md5,d41d8cd98f00b204e9800998ecf8427e" | ||
] | ||
], | ||
"1": [ | ||
"versions.yml:md5,d8a13e6037909fd47164f64bcdd8afa3" | ||
], | ||
"txt": [ | ||
[ | ||
{ | ||
"id": "test" | ||
}, | ||
"test.txt:md5,d41d8cd98f00b204e9800998ecf8427e" | ||
] | ||
], | ||
"versions": [ | ||
"versions.yml:md5,d8a13e6037909fd47164f64bcdd8afa3" | ||
] | ||
} | ||
], | ||
"meta": { | ||
"nf-test": "0.9.2", | ||
"nextflow": "24.10.3" | ||
}, | ||
"timestamp": "2025-01-08T13:05:05.816873" | ||
}, | ||
"generic - csv - compress": { | ||
"content": [ | ||
{ | ||
"0": [ | ||
[ | ||
{ | ||
"id": "test" | ||
}, | ||
"test.txt.gz:md5,5f32b160f4f228e7abfda2cd988eb164" | ||
] | ||
], | ||
"1": [ | ||
"versions.yml:md5,d8a13e6037909fd47164f64bcdd8afa3" | ||
], | ||
"txt": [ | ||
[ | ||
{ | ||
"id": "test" | ||
}, | ||
"test.txt.gz:md5,5f32b160f4f228e7abfda2cd988eb164" | ||
] | ||
], | ||
"versions": [ | ||
"versions.yml:md5,d8a13e6037909fd47164f64bcdd8afa3" | ||
] | ||
} | ||
], | ||
"meta": { | ||
"nf-test": "0.9.2", | ||
"nextflow": "24.10.3" | ||
}, | ||
"timestamp": "2025-01-08T13:10:17.112725" | ||
} | ||
} |