mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-12-22 11:08:17 +00:00
Add options for output file type
This commit is contained in:
parent
1c99ffd876
commit
589ce2d73a
4 changed files with 58 additions and 12 deletions
|
@ -10,7 +10,7 @@
|
|||
// bwa mem | samtools view -B -T ref.fasta
|
||||
|
||||
process VSEARCH_USEARCHGLOBAL {
|
||||
tag '$queryfasta'
|
||||
tag "$meta.id"
|
||||
label 'process_low'
|
||||
|
||||
conda (params.enable_conda ? "bioconda::vsearch=2.21.1" : null)
|
||||
|
@ -19,29 +19,53 @@ process VSEARCH_USEARCHGLOBAL {
|
|||
'quay.io/biocontainers/vsearch:2.21.1--h95f258a_0' }"
|
||||
|
||||
input:
|
||||
path queryfasta
|
||||
tuple val(meta), path(queryfasta)
|
||||
path db
|
||||
val outprefix
|
||||
val outoption
|
||||
val user_columns
|
||||
|
||||
// TODO nf-core: Where applicable please provide/convert compressed files as input/output
|
||||
// e.g. "*.fastq.gz" and NOT "*.fastq", "*.bam" and NOT "*.sam" etc.
|
||||
|
||||
output:
|
||||
path ("*.tsv") , emit: tsv
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
tuple val(meta), path('*.aln') , optional: true, emit: aln
|
||||
tuple val(meta), path('*.biom') , optional: true, emit: biom
|
||||
tuple val(meta), path('*.sam') , optional: true, emit: sam
|
||||
tuple val(meta), path('*.tsv') , optional: true, emit: tsv
|
||||
tuple val(meta), path('*.uc') , optional: true, emit: uc
|
||||
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 columns = user_columns ? "--userfields ${user_columns}" : ''
|
||||
switch ( outoption ) {
|
||||
case "alnout": outfmt = "--alnout"; out_ext = 'aln'; break
|
||||
case "biomout": outfmt = "--biomout"; out_ext = 'biom'; break
|
||||
case "blast6out": outfmt = "--blast6out"; out_ext = 'blast6out.tsv'; break
|
||||
case "mothur_shared_out": outfmt = "--mothur_shared_out"; out_ext = 'mothur.tsv'; break
|
||||
case "otutabout": outfmt = "--otutabout"; out_ext = 'otu.tsv'; break
|
||||
case "samout": outfmt = "--samout"; out_ext = 'sam'; break
|
||||
case "uc": outfmt = "--uc"; out_ext = 'uc'; break
|
||||
case "userout": outfmt = "--userout"; out_ext = 'user.tsv'; break
|
||||
case "lcaout": outfmt = "--lcaout"; out_ext = 'lca.tsv'; break
|
||||
default:
|
||||
outfmt = "--alnout";
|
||||
out_ext = 'aln';
|
||||
log.warn("Unknown output file format provided (${outoption}): selectingpairwise alignments (alnout)");
|
||||
break
|
||||
}
|
||||
"""
|
||||
vsearch \\
|
||||
--usearch_global $queryfasta \\
|
||||
--db $db \\
|
||||
--threads $task.cpus \\
|
||||
$args \\
|
||||
--blast6out ${outprefix}.tsv
|
||||
${columns} \\
|
||||
${outfmt} ${prefix}.${out_ext}
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
|
|
|
@ -8,5 +8,17 @@ workflow test_vsearch_usearchglobal {
|
|||
|
||||
query = file(params.test_data['sarscov2']['genome']['transcriptome_fasta'], checkIfExists: true)
|
||||
db = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
|
||||
VSEARCH_USEARCHGLOBAL ( query, db, "blast6out_results" )
|
||||
|
||||
outoption = "xcfert" // Nonsense text to check default case.
|
||||
columns = ""
|
||||
VSEARCH_USEARCHGLOBAL ( [ [id:'test'], query ], db, outoption, columns )
|
||||
}
|
||||
|
||||
workflow test_vsearch_usearchglobal_userout {
|
||||
|
||||
query = file(params.test_data['sarscov2']['genome']['transcriptome_fasta'], checkIfExists: true)
|
||||
db = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
|
||||
outoption = "userout"
|
||||
columns = "query+target+id"
|
||||
VSEARCH_USEARCHGLOBAL ( [ [id:'test'], query ], db, outoption, columns )
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
process {
|
||||
ext.args = '--id 0.985'
|
||||
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,17 @@
|
|||
- name: vsearch usearchglobal test_vsearch_usearchglobal
|
||||
command: nextflow run ./tests/modules/vsearch/usearchglobal -entry test_vsearch_usearchglobal -c ./tests/config/nextflow.config -c ./tests/modules/vsearch/usearchglobal/nextflow.config
|
||||
tags:
|
||||
- vsearch
|
||||
- vsearch/usearchglobal
|
||||
files:
|
||||
- path: output/vsearch/blast6out_results.tsv
|
||||
md5sum: 09733131643f1d951321a6e17a35eb8c
|
||||
- path: output/vsearch/test.aln
|
||||
md5sum: 7b7479c16e0ecb503913da8bde48d6c5
|
||||
|
||||
- name: vsearch usearchglobal test_vsearch_usearchglobal_userout
|
||||
command: nextflow run ./tests/modules/vsearch/usearchglobal -entry test_vsearch_usearchglobal_userout -c ./tests/config/nextflow.config -c ./tests/modules/vsearch/usearchglobal/nextflow.config
|
||||
tags:
|
||||
- vsearch
|
||||
- vsearch/usearchglobal
|
||||
files:
|
||||
- path: output/vsearch/test.user.tsv
|
||||
md5sum: b6cc50f7c8d18cb82e74dab70ed4baab
|
||||
|
|
Loading…
Reference in a new issue