Mercurial > repos > kkonganti > cfsan_cronology
comparison 0.1.0/modules/gunc/run/main.nf @ 0:c8597e9e1a97
"planemo upload"
author | kkonganti |
---|---|
date | Mon, 27 Nov 2023 12:37:44 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:c8597e9e1a97 |
---|---|
1 process GUNC_RUN { | |
2 tag "$meta.id" | |
3 label 'process_medium' | |
4 | |
5 module (params.enable_module ? "${params.swmodulepath}${params.fs}gunc${params.fs}1.0.5" : null) | |
6 conda (params.enable_conda ? "conda-forge::pandas=1.5.1 bioconda::gunc=1.0.5" : null) | |
7 container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? | |
8 'https://depot.galaxyproject.org/singularity/gunc:1.0.5--pyhdfd78af_0' : | |
9 'quay.io/biocontainers/gunc:1.0.5--pyhdfd78af_0' }" | |
10 | |
11 input: | |
12 tuple val(meta), path(database_path), path(fasta_ford, stageAs: 'fasta_ford.txt') | |
13 | |
14 output: | |
15 tuple val(meta), path("**${params.fs}*maxCSS_level.tsv") , emit: maxcss_level_tsv | |
16 tuple val(meta), path("**${params.fs}*all_levels.tsv") , emit: all_levels_tsv, optional: true | |
17 tuple val(meta), path("**${params.fs}*.maxCSS_level.passed.tsv"), emit: quality_report_passed | |
18 path "versions.yml" , emit: versions | |
19 | |
20 when: | |
21 task.ext.when == null || task.ext.when | |
22 | |
23 script: | |
24 def args = task.ext.args ?: '' | |
25 def prefix = task.ext.prefix ?: "${meta.id}" | |
26 def outdir = prefix + (task.index ?: '') | |
27 def input = "${fasta_ford}" | |
28 def fgq_py_args = [] | |
29 fgq_py_args.addAll([ | |
30 ("${params.fgq_py_gunc_extract}" ? "-extract ${params.fgq_py_gunc_extract}" : "-extract genome"), | |
31 ("${params.fgq_py_gunc_fcn}" ? "-fcn ${params.fgq_py_gunc_fcn}" : "-fcn 'clade_separation_score,contamination_portion'"), | |
32 ("${params.fgq_py_gunc_fcv}" ? "-fcv ${params.fgq_py_gunc_fcv}" : "-fcv '0.05,0.05'"), | |
33 ("${params.fgq_py_gunc_conds}" ? "-conds ${params.fgq_py_gunc_conds}" : "-conds '<=,<='") | |
34 ]) | |
35 if (params.guncrun_in_is_dir) { | |
36 input = "--input_dir ${fasta_ford}" | |
37 } else if (params.guncrun_in_is_fofn) { | |
38 input = "--input_file ${fasta_ford}" | |
39 } else if (params.guncrun_in_is_fasta) { | |
40 input = "--input_fasta ${fasta_ford}" | |
41 } else { | |
42 input = "--input_dir unscaffolded" | |
43 } | |
44 """ | |
45 mkdir -p $outdir || exit 1 | |
46 | |
47 datasets download genome accession \\ | |
48 --dehydrated \\ | |
49 --inputfile $fasta_ford | |
50 | |
51 unzip ncbi_dataset.zip | |
52 | |
53 datasets rehydrate \\ | |
54 --gzip \\ | |
55 --max-workers $task.cpus \\ | |
56 --directory "." | |
57 | |
58 stage_ncbi_dataset_genomes.py -in ncbi_dataset | |
59 | |
60 gunc \\ | |
61 run \\ | |
62 --db_file $database_path \\ | |
63 --threads $task.cpus \\ | |
64 --out_dir $outdir \\ | |
65 $input \\ | |
66 $args | |
67 | |
68 filter_genomes_by_qual.py \\ | |
69 -tsv $outdir${params.fs}GUNC.progenomes_2.1.maxCSS_level.tsv \\ | |
70 -outprefix "${outdir}_" \\ | |
71 ${fgq_py_args.join(' ')} | |
72 | |
73 cat <<-END_VERSIONS > versions.yml | |
74 "${task.process}": | |
75 datasets: \$( datasets --version | sed 's/datasets version: //g' ) | |
76 python: \$( python --version | sed 's/Python //g' ) | |
77 gunc: \$( gunc --version ) | |
78 END_VERSIONS | |
79 """ | |
80 } |