2021-08-02 07:40:57 +00:00
process UNZIP {
tag "$archive"
2022-09-07 08:33:05 +00:00
label 'process_single'
2021-08-02 07:40:57 +00:00
conda (params.enable_conda ? "bioconda::p7zip=15.09" : null)
2021-11-26 07:58:40 +00:00
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/p7zip:15.09--h2d50403_4' :
'quay.io/biocontainers/p7zip:15.09--h2d50403_4' }"
2021-08-02 07:40:57 +00:00
input:
2022-03-21 13:49:28 +00:00
tuple val(meta), path(archive)
2021-08-02 07:40:57 +00:00
output:
2022-03-21 13:49:28 +00:00
tuple val(meta), path("${archive.baseName}/"), emit: unzipped_archive
path "versions.yml" , emit: versions
2021-08-02 07:40:57 +00:00
2022-02-04 08:53:32 +00:00
when:
task.ext.when == null || task.ext.when
2021-08-02 07:40:57 +00:00
script:
2021-11-26 07:58:40 +00:00
def args = task.ext.args ?: ''
2021-08-02 07:40:57 +00:00
if ( archive instanceof List && archive.name.size > 1 ) { exit 1, "[UNZIP] error: 7za only accepts a single archive as input. Please check module input." }
"""
7za \\
e \\
-o"${archive.baseName}"/ \\
2021-11-26 07:58:40 +00:00
$args \\
2021-08-02 07:40:57 +00:00
$archive
2021-09-27 08:41:24 +00:00
cat <<-END_VERSIONS > versions.yml
2021-11-26 07:58:40 +00:00
"${task.process}":
2021-09-28 05:56:27 +00:00
7za: \$(echo \$(7za --help) | sed 's/.*p7zip Version //; s/(.*//')
2021-09-27 08:41:24 +00:00
END_VERSIONS
2021-08-02 07:40:57 +00:00
"""
}