1
0
Fork 0
mirror of https://github.com/MillironX/taxprofiler.git synced 2024-11-13 05:53:09 +00:00

Update UNTAR module

This commit is contained in:
James Fellows Yates 2023-05-02 13:19:35 +02:00
parent 727291999b
commit 661cfbe012
3 changed files with 18 additions and 18 deletions

View file

@ -173,7 +173,7 @@
},
"multiqc": {
"branch": "master",
"git_sha": "ee80d14721e76e2e079103b8dcd5d57129e584ba",
"git_sha": "f2d63bd5b68925f98f572eed70993d205cc694b7",
"installed_by": ["modules"]
},
"porechop/porechop": {
@ -214,7 +214,7 @@
},
"untar": {
"branch": "master",
"git_sha": "c8e35eb2055c099720a75538d1b8adb3fb5a464c",
"git_sha": "b9829e1064382745d8dff7f1d74d2138d2864f71",
"installed_by": ["modules"]
}
}

View file

@ -2,17 +2,17 @@ process UNTAR {
tag "$archive"
label 'process_single'
conda "conda-forge::sed=4.7"
conda "conda-forge::sed=4.7 bioconda::grep=3.4 conda-forge::tar=1.34"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/ubuntu:20.04' :
'ubuntu:20.04' }"
'docker.io/ubuntu:20.04' }"
input:
tuple val(meta), path(archive)
output:
tuple val(meta), path("$untar"), emit: untar
path "versions.yml" , emit: versions
tuple val(meta), path("$prefix"), emit: untar
path "versions.yml" , emit: versions
when:
task.ext.when == null || task.ext.when
@ -20,31 +20,29 @@ process UNTAR {
script:
def args = task.ext.args ?: ''
def args2 = task.ext.args2 ?: ''
untar = archive.toString() - '.tar.gz'
prefix = task.ext.prefix ?: ( meta.id ? "${meta.id}" : archive.baseName.toString().replaceFirst(/\.tar$/, ""))
"""
mkdir output
mkdir $prefix
## Ensures --strip-components only applied when top level of tar contents is a directory
## If just files or multiple directories, place all in output
if [[ \$(tar -tzf ${archive} | grep -o -P "^.*?\\/" | uniq | wc -l) -eq 1 ]]; then
## If just files or multiple directories, place all in prefix
if [[ \$(tar -taf ${archive} | grep -o -P "^.*?\\/" | uniq | wc -l) -eq 1 ]]; then
tar \\
-C output --strip-components 1 \\
-xzvf \\
-C $prefix --strip-components 1 \\
-xavf \\
$args \\
$archive \\
$args2
else
tar \\
-C output \\
-xzvf \\
-C $prefix \\
-xavf \\
$args \\
$archive \\
$args2
fi
mv output ${untar}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
untar: \$(echo \$(tar --version 2>&1) | sed 's/^.*(GNU tar) //; s/ Copyright.*\$//')
@ -52,9 +50,10 @@ process UNTAR {
"""
stub:
untar = archive.toString() - '.tar.gz'
prefix = task.ext.prefix ?: ( meta.id ? "${meta.id}" : archive.toString().replaceFirst(/\.[^\.]+(.gz)?$/, ""))
"""
touch $untar
mkdir $prefix
touch ${prefix}/file.txt
cat <<-END_VERSIONS > versions.yml
"${task.process}":

View file

@ -3,6 +3,7 @@ description: Extract files.
keywords:
- untar
- uncompress
- extract
tools:
- untar:
description: |