mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-12-22 11:08:17 +00:00
added module seqkit replace (#1382)
* added module seqkit replace * added when * removed extra line * Update modules/seqkit/replace/main.nf Co-authored-by: Robert A. Petit III <robbie.petit@gmail.com> * Updated meta * updated indents Co-authored-by: Cipriano <rrn8@cdc.gov> Co-authored-by: Sateesh Peri <33637490+sateeshperi@users.noreply.github.com> Co-authored-by: Robert A. Petit III <robbie.petit@gmail.com>
This commit is contained in:
parent
b82d7abe70
commit
24f0bdd14e
6 changed files with 145 additions and 0 deletions
41
modules/seqkit/replace/main.nf
Normal file
41
modules/seqkit/replace/main.nf
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
process SEQKIT_REPLACE {
|
||||||
|
tag "$meta.id"
|
||||||
|
label 'process_low'
|
||||||
|
|
||||||
|
conda (params.enable_conda ? "bioconda::seqkit=2.1.0" : null)
|
||||||
|
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||||
|
'https://depot.galaxyproject.org/singularity/seqkit:2.1.0--h9ee0642_0':
|
||||||
|
'quay.io/biocontainers/seqkit:2.1.0--h9ee0642_0' }"
|
||||||
|
|
||||||
|
input:
|
||||||
|
tuple val(meta), path(fastx)
|
||||||
|
|
||||||
|
output:
|
||||||
|
tuple val(meta), path("*.fast*"), 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 extension = "fastq"
|
||||||
|
if ("$fastx" ==~ /.+\.fasta|.+\.fasta.gz|.+\.fa|.+\.fa.gz|.+\.fas|.+\.fas.gz|.+\.fna|.+\.fna.gz/) {
|
||||||
|
extension = "fasta"
|
||||||
|
}
|
||||||
|
def endswith = task.ext.suffix ?: "${extension}.gz"
|
||||||
|
"""
|
||||||
|
seqkit \\
|
||||||
|
replace \\
|
||||||
|
${args} \\
|
||||||
|
--threads ${task.cpus} \\
|
||||||
|
-i ${fastx} \\
|
||||||
|
-o ${prefix}.${endswith}
|
||||||
|
|
||||||
|
cat <<-END_VERSIONS > versions.yml
|
||||||
|
"${task.process}":
|
||||||
|
seqkit: \$( seqkit | sed '3!d; s/Version: //' )
|
||||||
|
END_VERSIONS
|
||||||
|
"""
|
||||||
|
}
|
41
modules/seqkit/replace/meta.yml
Normal file
41
modules/seqkit/replace/meta.yml
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
name: seqkit_replace
|
||||||
|
description: Use seqkit to find/replace strings within sequences and sequence headers
|
||||||
|
keywords:
|
||||||
|
- seqkit
|
||||||
|
- replace
|
||||||
|
tools:
|
||||||
|
- seqkit:
|
||||||
|
description: Cross-platform and ultrafast toolkit for FASTA/Q file manipulation, written by Wei Shen.
|
||||||
|
homepage: https://bioinf.shenwei.me/seqkit/usage/
|
||||||
|
documentation: https://bioinf.shenwei.me/seqkit/usage/
|
||||||
|
tool_dev_url: https://github.com/shenwei356/seqkit/
|
||||||
|
doi: "10.1371/journal.pone.016396"
|
||||||
|
|
||||||
|
input:
|
||||||
|
- meta:
|
||||||
|
type: map
|
||||||
|
description: |
|
||||||
|
Groovy Map containing sample information
|
||||||
|
e.g. [ id:'test', single_end:false ]
|
||||||
|
- fastx:
|
||||||
|
type: file
|
||||||
|
description: fasta/q file
|
||||||
|
pattern: "*.{fasta,fastq,fa,fq,fas,fna,faa}*"
|
||||||
|
|
||||||
|
output:
|
||||||
|
- meta:
|
||||||
|
type: map
|
||||||
|
description: |
|
||||||
|
Groovy Map containing sample information
|
||||||
|
e.g. [ id:'test', single_end:false ]
|
||||||
|
- versions:
|
||||||
|
type: file
|
||||||
|
description: File containing software versions
|
||||||
|
pattern: "versions.yml"
|
||||||
|
- fastx:
|
||||||
|
type: file
|
||||||
|
description: fasta/q file with replaced values
|
||||||
|
pattern: "*.{fasta,fastq,fa,fq,fas,fna,faa}*"
|
||||||
|
|
||||||
|
authors:
|
||||||
|
- "@mjcipriano"
|
|
@ -1481,6 +1481,10 @@ seqkit/pair:
|
||||||
- modules/seqkit/pair/**
|
- modules/seqkit/pair/**
|
||||||
- tests/modules/seqkit/pair/**
|
- tests/modules/seqkit/pair/**
|
||||||
|
|
||||||
|
seqkit/replace:
|
||||||
|
- modules/seqkit/replace/**
|
||||||
|
- tests/modules/seqkit/replace/**
|
||||||
|
|
||||||
seqkit/split2:
|
seqkit/split2:
|
||||||
- modules/seqkit/split2/**
|
- modules/seqkit/split2/**
|
||||||
- tests/modules/seqkit/split2/**
|
- tests/modules/seqkit/split2/**
|
||||||
|
|
24
tests/modules/seqkit/replace/main.nf
Normal file
24
tests/modules/seqkit/replace/main.nf
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
#!/usr/bin/env nextflow
|
||||||
|
|
||||||
|
nextflow.enable.dsl = 2
|
||||||
|
|
||||||
|
include { SEQKIT_REPLACE } from '../../../../modules/seqkit/replace/main.nf'
|
||||||
|
include { SEQKIT_REPLACE as SEQKIT_REPLACEUNCOMP } from '../../../../modules/seqkit/replace/main.nf'
|
||||||
|
|
||||||
|
workflow test_seqkit_replace {
|
||||||
|
|
||||||
|
input = [ [ id:'test' ], // meta map
|
||||||
|
[ file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) ]
|
||||||
|
]
|
||||||
|
|
||||||
|
SEQKIT_REPLACE ( input )
|
||||||
|
}
|
||||||
|
|
||||||
|
workflow test_seqkit_replace_uncomp {
|
||||||
|
|
||||||
|
input = [ [ id:'test' ], // meta map
|
||||||
|
[ file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) ]
|
||||||
|
]
|
||||||
|
|
||||||
|
SEQKIT_REPLACEUNCOMP ( input )
|
||||||
|
}
|
14
tests/modules/seqkit/replace/nextflow.config
Normal file
14
tests/modules/seqkit/replace/nextflow.config
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
process {
|
||||||
|
|
||||||
|
withName: 'SEQKIT_REPLACE' {
|
||||||
|
ext.args = "-s -p 'A' -r 'N'"
|
||||||
|
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
|
||||||
|
}
|
||||||
|
|
||||||
|
withName: 'SEQKIT_REPLACEUNCOMP' {
|
||||||
|
ext.args = "-s -p 'T' -r 'N'"
|
||||||
|
ext.suffix = ".fasta"
|
||||||
|
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
21
tests/modules/seqkit/replace/test.yml
Normal file
21
tests/modules/seqkit/replace/test.yml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
- name: seqkit replace test_seqkit_replace
|
||||||
|
command: nextflow run tests/modules/seqkit/replace -entry test_seqkit_replace -c tests/config/nextflow.config
|
||||||
|
tags:
|
||||||
|
- seqkit
|
||||||
|
- seqkit/replace
|
||||||
|
files:
|
||||||
|
- path: output/seqkit/test.fasta.gz
|
||||||
|
md5sum: 053847219695c0a923d02352442d7abf
|
||||||
|
- path: output/seqkit/versions.yml
|
||||||
|
md5sum: dc9d18b7836c9db00a3032fd191bd831
|
||||||
|
|
||||||
|
- name: seqkit replace test_seqkit_replace_uncomp
|
||||||
|
command: nextflow run tests/modules/seqkit/replace -entry test_seqkit_replace_uncomp -c tests/config/nextflow.config
|
||||||
|
tags:
|
||||||
|
- seqkit
|
||||||
|
- seqkit/replace
|
||||||
|
files:
|
||||||
|
- path: output/seqkit/test..fasta
|
||||||
|
md5sum: 05d3294a62c72f5489f067c1da3c2f6c
|
||||||
|
- path: output/seqkit/versions.yml
|
||||||
|
md5sum: 3b88128487ec949f0bdeecebc375c407
|
Loading…
Reference in a new issue