|
0
|
1 process DOWNLOAD_REF_GENOME {
|
|
|
2 tag "${meta.id}"
|
|
|
3 label "process_pico"
|
|
|
4
|
|
|
5 module (params.enable_module ? "${params.swmodulepath}${params.fs}python${params.fs}3.8.1" : null)
|
|
|
6 conda (params.enable_conda ? "conda-forge::python=3.10.4 conda-forge::unzip conda-forge::gzip" : null)
|
|
|
7 container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
|
|
8 'https://depot.galaxyproject.org/singularity/ncbi-datasets-pylib:15.31.1--pyhdfd78af_0' :
|
|
|
9 'quay.io/biocontainers/python:3.10.4' }"
|
|
|
10
|
|
|
11 input:
|
|
|
12 val meta
|
|
|
13
|
|
|
14 output:
|
|
|
15 path "*.fna" , emit: fasta
|
|
|
16 path "*.gff" , emit: gff
|
|
|
17 path 'versions.yml', emit: versions
|
|
|
18
|
|
|
19 when:
|
|
|
20 task.ext.when == null || task.ext.when
|
|
|
21
|
|
|
22 script:
|
|
|
23 def args = task.ext.args ?: ''
|
|
|
24 prefix = task.ext.prefix ?: "${meta.id}"
|
|
|
25 """
|
|
|
26 [ -e /usr/local/ssl/cacert.pem ] && export SSL_CERT_FILE=/usr/local/ssl/cacert.pem
|
|
|
27
|
|
|
28 datasets download genome accession --assembly-version latest --include genome,gff3 ${meta.id}
|
|
|
29
|
|
|
30 unzip ncbi_dataset.zip
|
|
|
31
|
|
|
32 stage_ncbi_dataset_genomes.py -in ncbi_dataset -suffix '_genomic.fna' -out "."
|
|
|
33
|
|
|
34 stage_ncbi_dataset_genomes.py -in ncbi_dataset -suffix '.gff' -out "."
|
|
|
35
|
|
|
36 cat <<-END_VERSIONS > versions.yml
|
|
|
37 "${task.process}":
|
|
|
38 datasets: \$( datasets --version | sed 's/datasets version: //g' )
|
|
|
39 python: \$( python --version | sed 's/Python //g' )
|
|
|
40 END_VERSIONS
|
|
|
41
|
|
|
42 zcmd=""
|
|
|
43 zver=""
|
|
|
44
|
|
|
45 if type pigz > /dev/null 2>&1; then
|
|
|
46 zcmd="pigz"
|
|
|
47 zver=\$( echo \$( \$zcmd --version 2>&1 ) | sed -e '1!d' | sed "s/\$zcmd //" )
|
|
|
48 elif type gzip > /dev/null 2>&1; then
|
|
|
49 zcmd="gzip"
|
|
|
50
|
|
|
51 if [ "${workflow.containerEngine}" != "null" ]; then
|
|
|
52 zver=\$( echo \$( \$zcmd --help 2>&1 ) | sed -e '1!d; s/ (.*\$//' )
|
|
|
53 else
|
|
|
54 zver=\$( echo \$( \$zcmd --version 2>&1 ) | sed "s/^.*(\$zcmd) //; s/\$zcmd //; s/ Copyright.*\$//" )
|
|
|
55 fi
|
|
|
56 fi
|
|
|
57
|
|
|
58 cat <<-END_VERSIONS >> versions.yml
|
|
|
59 \$zcmd: \$zver
|
|
|
60 END_VERSIONS
|
|
|
61 """
|
|
|
62
|
|
|
63 } |