2021-08-02 09:40:57 +02:00
process UNZIP {
tag "$archive"
2022-09-07 10:33:05 +02:00
label 'process_single'
2021-08-02 09:40:57 +02: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 09:40:57 +02:00
input:
2022-03-21 14:49:28 +01:00
tuple val(meta), path(archive)
2021-08-02 09:40:57 +02:00
output:
2022-03-21 14:49:28 +01:00
tuple val(meta), path("${archive.baseName}/"), emit: unzipped_archive
path "versions.yml" , emit: versions
2021-08-02 09:40:57 +02:00
2022-02-04 09:53:32 +01:00
when:
task.ext.when == null || task.ext.when
2021-08-02 09:40:57 +02:00
script:
2021-11-26 07:58:40 +00:00
def args = task.ext.args ?: ''
2021-08-02 09:40:57 +02: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 09:40:57 +02:00
$archive
2021-09-27 10:41:24 +02:00
cat <<-END_VERSIONS > versions.yml
2021-11-26 07:58:40 +00:00
"${task.process}":
2021-09-28 06:56:27 +01:00
7za: \$(echo \$(7za --help) | sed 's/.*p7zip Version //; s/(.*//')
2021-09-27 10:41:24 +02:00
END_VERSIONS
2021-08-02 09:40:57 +02:00
"""
}