mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-11-10 20:23:10 +00:00
Seqtk rename (#1304)
* Added seqtk/rename module and tests code * Updated files and testing code for seqtk rename * Added meta map to seqtk/rename module def * updated prefix parameter usage * updated test.yml to remove local filepaths --> change to output * Added empty line to main.nf
This commit is contained in:
parent
7560689375
commit
a69faefee8
6 changed files with 131 additions and 0 deletions
40
modules/seqtk/rename/main.nf
Normal file
40
modules/seqtk/rename/main.nf
Normal file
|
@ -0,0 +1,40 @@
|
|||
process SEQTK_RENAME {
|
||||
tag "$meta.id"
|
||||
label 'process_low'
|
||||
|
||||
conda (params.enable_conda ? "bioconda::seqtk=1.3" : null)
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/seqtk:1.3--h5bf99c6_3' :
|
||||
'quay.io/biocontainers/seqtk:1.3--h5bf99c6_3' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(sequences)
|
||||
|
||||
output:
|
||||
tuple val(meta), path("*.gz") , emit: sequences
|
||||
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 extension = "fasta"
|
||||
if ("$sequences" ==~ /.+\.fq|.+\.fq.gz|.+\.fastq|.+\.fastq.gz/) {
|
||||
extension = "fastq"
|
||||
}
|
||||
"""
|
||||
seqtk \\
|
||||
rename \\
|
||||
$args \\
|
||||
$sequences \\
|
||||
$prefix | \\
|
||||
gzip -c --no-name > ${prefix}.renamed.${extension}.gz
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
seqtk: \$(echo \$(seqtk 2>&1) | sed 's/^.*Version: //; s/ .*\$//')
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
42
modules/seqtk/rename/meta.yml
Normal file
42
modules/seqtk/rename/meta.yml
Normal file
|
@ -0,0 +1,42 @@
|
|||
name: seqtk_rename
|
||||
description: Rename sequence names in FASTQ or FASTA files.
|
||||
keywords:
|
||||
- rename
|
||||
tools:
|
||||
- seqtk:
|
||||
description: Seqtk is a fast and lightweight tool for processing sequences in the FASTA or FASTQ format. The seqtk rename command renames sequence names.
|
||||
homepage: https://github.com/lh3/seqtk
|
||||
documentation: https://docs.csc.fi/apps/seqtk/
|
||||
tool_dev_url: https://github.com/lh3/seqtk
|
||||
licence: ['MIT']
|
||||
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test' ]
|
||||
- sequences:
|
||||
type: file
|
||||
description: A FASTQ or FASTA file
|
||||
pattern: "*.{fastq.gz, fastq, fq, fq.gz, fasta, fastq.gz, fa, fa.gz, fas, fas.gz, fna, fna.gz}"
|
||||
|
||||
output:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test' ]
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
- sequences:
|
||||
type: file
|
||||
description: FASTQ/FASTA file containing renamed sequences
|
||||
pattern: "*.{fastq.gz, fasta.gz}"
|
||||
|
||||
authors:
|
||||
- "@hseabolt"
|
||||
- "@mjcipriano"
|
||||
- "@sateeshperi"
|
|
@ -1377,6 +1377,10 @@ seqtk/mergepe:
|
|||
- modules/seqtk/mergepe/**
|
||||
- tests/modules/seqtk/mergepe/**
|
||||
|
||||
seqtk/rename:
|
||||
- modules/seqtk/rename/**
|
||||
- tests/modules/seqtk/rename/**
|
||||
|
||||
seqtk/sample:
|
||||
- modules/seqtk/sample/**
|
||||
- tests/modules/seqtk/sample/**
|
||||
|
|
19
tests/modules/seqtk/rename/main.nf
Normal file
19
tests/modules/seqtk/rename/main.nf
Normal file
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env nextflow
|
||||
|
||||
nextflow.enable.dsl = 2
|
||||
|
||||
include { SEQTK_RENAME } from '../../../../modules/seqtk/rename/main.nf'
|
||||
|
||||
workflow test_seqtk_rename {
|
||||
input = [ [ id:'test' ], // meta map
|
||||
[ file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) ]
|
||||
]
|
||||
SEQTK_RENAME ( input )
|
||||
}
|
||||
|
||||
workflow test_seqtk_rename_fq {
|
||||
input = [ [ id:'test' ], // meta map
|
||||
[ file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) ]
|
||||
]
|
||||
SEQTK_RENAME ( input )
|
||||
}
|
5
tests/modules/seqtk/rename/nextflow.config
Normal file
5
tests/modules/seqtk/rename/nextflow.config
Normal file
|
@ -0,0 +1,5 @@
|
|||
process {
|
||||
|
||||
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
|
||||
|
||||
}
|
21
tests/modules/seqtk/rename/test.yml
Normal file
21
tests/modules/seqtk/rename/test.yml
Normal file
|
@ -0,0 +1,21 @@
|
|||
- name: seqtk rename test_seqtk_rename
|
||||
command: nextflow run tests/modules/seqtk/rename -entry test_seqtk_rename -c tests/config/nextflow.config
|
||||
tags:
|
||||
- seqtk
|
||||
- seqtk/rename
|
||||
files:
|
||||
- path: output/seqtk/test.renamed.fasta.gz
|
||||
md5sum: 7b407952dcf0d925f1996e04a201d05b
|
||||
- path: output/seqtk/versions.yml
|
||||
md5sum: 24127592f1b9e5ee8e5ab04ee748c491
|
||||
|
||||
- name: seqtk rename test_seqtk_rename_fq
|
||||
command: nextflow run tests/modules/seqtk/rename -entry test_seqtk_rename_fq -c tests/config/nextflow.config
|
||||
tags:
|
||||
- seqtk
|
||||
- seqtk/rename
|
||||
files:
|
||||
- path: output/seqtk/test.renamed.fastq.gz
|
||||
md5sum: babdfc2a3940a1e32a63479db2c1d600
|
||||
- path: output/seqtk/versions.yml
|
||||
md5sum: 06c19670eb2b4185e8f4fa5dcf8fb0d5
|
Loading…
Reference in a new issue