-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
409 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
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: "seqkit_seq" | ||
channels: | ||
- conda-forge | ||
- bioconda | ||
- defaults | ||
dependencies: | ||
- "bioconda::seqkit=2.8.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,63 @@ | ||
process SEQKIT_SEQ { | ||
tag "$meta.id" | ||
label 'process_low' | ||
// File IO can be a bottleneck. See: https://bioinf.shenwei.me/seqkit/usage/#parallelization-of-cpu-intensive-jobs | ||
|
||
conda "${moduleDir}/environment.yml" | ||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? | ||
'https://depot.galaxyproject.org/singularity/seqkit:2.8.1--h9ee0642_0': | ||
'biocontainers/seqkit:2.8.1--h9ee0642_0' }" | ||
|
||
input: | ||
tuple val(meta), path(fastx) | ||
|
||
output: | ||
tuple val(meta), path("${prefix}.*") , emit: fastx | ||
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}" | ||
def extension = "fastq" | ||
if ("$fastx" ==~ /.+\.fasta|.+\.fasta.gz|.+\.fa|.+\.fa.gz|.+\.fas|.+\.fas.gz|.+\.fna|.+\.fna.gz|.+\.fsa|.+\.fsa.gz/ ) { | ||
extension = "fasta" | ||
} | ||
extension = fastx.toString().endsWith('.gz') ? "${extension}.gz" : extension | ||
def call_gzip = extension.endsWith('.gz') ? "| gzip -c $args2" : '' | ||
if("${prefix}.${extension}" == "$fastx") error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!" | ||
""" | ||
seqkit \\ | ||
seq \\ | ||
--threads $task.cpus \\ | ||
$args \\ | ||
$fastx \\ | ||
$call_gzip \\ | ||
> ${prefix}.${extension} | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
seqkit: \$(seqkit version | cut -d' ' -f2) | ||
END_VERSIONS | ||
""" | ||
|
||
stub: | ||
prefix = task.ext.prefix ?: "${meta.id}" | ||
def extension = "fastq" | ||
if ("$fastx" ==~ /.+\.fasta|.+\.fasta.gz|.+\.fa|.+\.fa.gz|.+\.fas|.+\.fas.gz|.+\.fna|.+\.fna.gz|.+\.fsa|.+\.fsa.gz/ ) { | ||
extension = "fasta" | ||
} | ||
extension = fastx.toString().endsWith('.gz') ? "${extension}.gz" : extension | ||
if("${prefix}.${extension}" == "$fastx") error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!" | ||
""" | ||
touch ${prefix}.${extension} | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
seqkit: \$(seqkit version | cut -d' ' -f2) | ||
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,48 @@ | ||
--- | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json | ||
name: "seqkit_seq" | ||
description: Transforms sequences (extract ID, filter by length, remove gaps, reverse complement...) | ||
keywords: | ||
- genomics | ||
- fasta | ||
- fastq | ||
- transform | ||
- filter | ||
- gaps | ||
- complement | ||
tools: | ||
- "seqkit": | ||
description: "A cross-platform and ultrafast toolkit for FASTA/Q file manipulation" | ||
homepage: "https://bioinf.shenwei.me/seqkit/" | ||
documentation: "https://bioinf.shenwei.me/seqkit/usage/" | ||
tool_dev_url: "https://github.com/shenwei356/seqkit" | ||
doi: "10.1371/journal.pone.0163962" | ||
licence: ["MIT"] | ||
input: | ||
- meta: | ||
type: map | ||
description: | | ||
Groovy Map containing sample information | ||
e.g. `[ id:'sample1' ]` | ||
- fastx: | ||
type: file | ||
description: Input fasta/fastq file | ||
pattern: "*.{fsa,fas,fa,fasta,fastq,fq,fsa.gz,fas.gz,fa.gz,fasta.gz,fastq.gz,fq.gz}" | ||
output: | ||
- meta: | ||
type: map | ||
description: | | ||
Groovy Map containing sample information | ||
e.g. `[ id:'sample1' ]` | ||
- fastx: | ||
type: file | ||
description: Output fasta/fastq file | ||
pattern: "*.{fasta,fasta.gz,fastq,fastq.gz}" | ||
- versions: | ||
type: file | ||
description: File containing software versions | ||
pattern: "versions.yml" | ||
authors: | ||
- "@GallVp" | ||
maintainers: | ||
- "@GallVp" |
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,145 @@ | ||
nextflow_process { | ||
|
||
name "Test Process SEQKIT_SEQ" | ||
script "../main.nf" | ||
process "SEQKIT_SEQ" | ||
config './nextflow.config' | ||
|
||
tag "modules" | ||
tag "modules_gallvp" | ||
tag "seqkit" | ||
tag "seqkit/seq" | ||
|
||
test("sarscov2-genome_fasta") { | ||
when { | ||
process { | ||
""" | ||
input[0] = [ | ||
[ id:'test' ], // meta map | ||
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) | ||
] | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
{ assert snapshot(process.out).match() }, | ||
) | ||
} | ||
|
||
} | ||
|
||
test("sarscov2-genome_fasta_gz") { | ||
when { | ||
process { | ||
""" | ||
input[0] = [ | ||
[ id:'test' ], // meta map | ||
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta.gz', checkIfExists: true) | ||
] | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
{ assert snapshot(process.out).match() }, | ||
) | ||
} | ||
|
||
} | ||
|
||
test("sarscov2-test_1_fastq_gz") { | ||
when { | ||
process { | ||
""" | ||
input[0] = [ | ||
[ id:'test' ], // meta map | ||
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() }, | ||
) | ||
} | ||
|
||
} | ||
|
||
test("file_name_conflict-fail_with_error") { | ||
when { | ||
process { | ||
""" | ||
input[0] = [ | ||
[ id:'test_1' ], // meta map | ||
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) | ||
] | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert !process.success }, | ||
{ assert process.stdout.toString().contains("Input and output names are the same") } | ||
) | ||
} | ||
|
||
} | ||
|
||
test("sarscov2-genome_fasta-stub") { | ||
|
||
options '-stub' | ||
|
||
when { | ||
process { | ||
""" | ||
input[0] = [ | ||
[ id:'test' ], // meta map | ||
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) | ||
] | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
{ assert snapshot(process.out).match() }, | ||
) | ||
} | ||
|
||
} | ||
|
||
test("file_name_conflict-fail_with_error-stub") { | ||
|
||
options '-stub' | ||
|
||
when { | ||
process { | ||
""" | ||
input[0] = [ | ||
[ id:'genome' ], // meta map | ||
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) | ||
] | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert !process.success }, | ||
{ assert process.stdout.toString().contains("Input and output names are the same") } | ||
) | ||
} | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.