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 module: Add fastx/collapser (nf-core#5250)
* Add fastx_collapser module * docs: Specify it's a decompressed file * Update modules/nf-core/fastx/collapser/meta.yml Co-authored-by: Friederike Hanssen <Friederike.hanssen@qbic.uni-tuebingen.de> --------- Co-authored-by: Friederike Hanssen <Friederike.hanssen@qbic.uni-tuebingen.de>
- Loading branch information
1 parent
3cf1e42
commit 322fa94
Showing
6 changed files
with
237 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,9 @@ | ||
--- | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json | ||
name: "fastx_collapser" | ||
channels: | ||
- conda-forge | ||
- bioconda | ||
- defaults | ||
dependencies: | ||
- "bioconda::fastx_toolkit=0.0.14" |
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,46 @@ | ||
process FASTX_COLLAPSER { | ||
tag "$meta.id" | ||
label 'process_medium' | ||
|
||
conda "${moduleDir}/environment.yml" | ||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? | ||
'https://depot.galaxyproject.org/singularity/fastx_toolkit:0.0.14--hdbdd923_11': | ||
'biocontainers/fastx_toolkit:0.0.14--hdbdd923_11' }" | ||
|
||
input: | ||
tuple val(meta), path(fastx) | ||
|
||
output: | ||
tuple val(meta), path("${prefix}.fasta"), emit: fasta | ||
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}" | ||
""" | ||
fastx_collapser \\ | ||
$args \\ | ||
-i $fastx \\ | ||
-o ${prefix}.fasta | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
fastx: \$(echo \$(fastx_collapser -h) | sed -nE 's/.*([0-9]+\\.[0-9]+\\.[0-9]+).*/\\1/p' )) | ||
END_VERSIONS | ||
""" | ||
|
||
stub: | ||
def args = task.ext.args ?: '' | ||
prefix = task.ext.prefix ?: "${meta.id}" | ||
""" | ||
touch ${prefix}.fasta | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
fastx: \$(echo \$(fastx_collapser -h) | sed -nE 's/.*([0-9]+\\.[0-9]+\\.[0-9]+).*/\\1/p' )) | ||
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,51 @@ | ||
--- | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json | ||
name: "fastx_collapser" | ||
description: Collapses identical sequences in a FASTQ/A file into a single sequence (while maintaining reads counts) | ||
keywords: | ||
- collapse | ||
- genomics | ||
- fasta | ||
- fastq | ||
tools: | ||
- "fastx": | ||
description: "A collection of command line tools for Short-Reads FASTA/FASTQ files preprocessing" | ||
homepage: "http://hannonlab.cshl.edu/fastx_toolkit/" | ||
documentation: "http://hannonlab.cshl.edu/fastx_toolkit/commandline.html" | ||
tool_dev_url: "https://github.com/agordon/fastx_toolkit" | ||
licence: ["AGPL"] | ||
|
||
input: | ||
# Only when we have meta | ||
- meta: | ||
type: map | ||
description: | | ||
Groovy Map containing sample information | ||
e.g. `[ id:'sample1', single_end:false ]` | ||
- fastx: | ||
type: file | ||
description: Decompressed FASTA/FASTQ input file | ||
pattern: "*.{fastq,fasta}" | ||
|
||
output: | ||
- meta: | ||
type: map | ||
description: | | ||
Groovy Map containing sample information | ||
e.g. `[ id:'sample1', single_end:false ]` | ||
- versions: | ||
type: file | ||
description: File containing software versions | ||
pattern: "versions.yml" | ||
|
||
- fasta: | ||
type: file | ||
description: Collapsed FASTA file | ||
pattern: "*.fasta" | ||
|
||
authors: | ||
- "@jvfe" | ||
maintainers: | ||
- "@jvfe" |
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,61 @@ | ||
// nf-core modules test fastx/collapser | ||
nextflow_process { | ||
|
||
name "Test Process FASTX_COLLAPSER" | ||
script "../main.nf" | ||
process "FASTX_COLLAPSER" | ||
|
||
tag "modules" | ||
tag "modules_nfcore" | ||
tag "fastx" | ||
tag "fastx/collapser" | ||
|
||
test("homo_sapiens - fasta") { | ||
|
||
when { | ||
process { | ||
""" | ||
input[0] = [ | ||
[ id:'test' ], // meta map | ||
file(params.test_data['homo_sapiens']['pacbio']['ccs_fa'], checkIfExists: true) | ||
] | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
{ assert path(process.out.fasta[0][1]).text.contains(">1-1") }, | ||
{ assert process.out.fasta[0][1] ==~ ".*/test.fasta" }, | ||
{ assert snapshot(process.out).match() } | ||
) | ||
} | ||
|
||
} | ||
|
||
test("homo_sapiens - fasta - stub") { | ||
|
||
options "-stub" | ||
|
||
when { | ||
process { | ||
""" | ||
input[0] = [ | ||
[ id:'test'], // meta map | ||
file(params.test_data['homo_sapiens']['pacbio']['ccs_fa'], checkIfExists: true) | ||
] | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
{ assert snapshot(process.out).match() } | ||
) | ||
} | ||
|
||
} | ||
|
||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 @@ | ||
fastx/collapser: | ||
- "modules/nf-core/fastx/collapser/**" |