Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# toolbox v0.1.1

## NEW FEATURES
`gunzip`: Add gunzip functionality to decompress gzip-compressed files.


## MINOR CHANGES

* Updated the test CI (PR #6).
Expand Down
96 changes: 96 additions & 0 deletions src/gunzip/config.vsh.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: gunzip
description: Decompress files compressed with gzip
keywords: [ "decompress", "gzip", "gunzip", "*.gz" ]
links:
homepage: https://www.gnu.org/software/gzip/manual/
documentation: https://www.gnu.org/software/gzip/manual/gzip.html
repository: https://cgit.git.savannah.gnu.org/cgit/gzip.git/
issue_tracker: https://savannah.gnu.org/bugs/?group=gzip # Tracker turned off by group.
license: GPL-3.0
requirements:
commands: [ gunzip ]

argument_groups:
- name: Inputs
arguments:
- name: --input
type: file
direction: input
description: Path of file to be decompressed
required: true

- name: Outputs
arguments:
- name: --output
type: file
direction: output
required: true
description: Decompressed file

- name: Arguments
arguments:
- name: --force
alternatives: -f
type: boolean_true
description: force overwrite of output file and compress links
- name: --keep
alternatives: -k
type: boolean_true
description: keep input files
- name: --list
alternatives: -l
type: boolean_true
description: list compressed file contents
- name: --no_name
alternatives: -n
type: boolean_true
description: do not save or restore the original name and time stamp
- name: --name
alternatives: -N
type: boolean_true
description: save or restore the original name and time stamp
- name: --quiet
alternatives: -q
type: boolean_true
description: suppress all warnings
- name: --recursive
alternatives: -r
type: boolean_true
description: operate recursively on directories
- name: --suffix
alternatives: -S
type: string
description: Uncompress all files in the current working directory whose suffix matches a given pattern
- name: --synchronous
type: boolean_true
description: synchronous output (safer if system crashes, but slower)
- name: --test
alternatives: -t
type: boolean_true
description: test compressed file integrity
- name: --verbose
alternatives: -v
type: boolean_true
description: verbose mode

resources:
- type: bash_script
path: script.sh

test_resources:
- type: bash_script
path: test.sh
- type: file
path: test_data

engines:
- type: docker
image: quay.io/biocontainers/gzip:1.11
setup:
- type: docker
run: |
gunzip --version | sed 's/gunzip, version\s\(.*\)/gunzip: "\1"/' > /var/software_versions.txt

runners:
- type: executable
- type: nextflow
7 changes: 7 additions & 0 deletions src/gunzip/help.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cat <<EOF > src/gunzip/help.txt
```sh
gunzip --help
```
EOF

docker run quay.io/biocontainers/gzip:1.11 gunzip --help >> src/gunzip/help.txt
32 changes: 32 additions & 0 deletions src/gunzip/script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

## VIASH START
## VIASH END

set -eo pipefail

[[ "$par_force" == "false" ]] && unset par_force
[[ "$par_keep" == "false" ]] && unset par_keep
[[ "$par_list" == "false" ]] && unset par_list
[[ "$par_no_name" == "false" ]] && unset par_no_name
[[ "$par_name" == "false" ]] && unset par_name
[[ "$par_quiet" == "false" ]] && unset par_quiet
[[ "$par_recursive" == "false" ]] && unset par_recursive
[[ "$par_suffix" == "false" ]] && unset par_suffix
[[ "$par_synchronous" == "false" ]] && unset par_synchronous
[[ "$par_test" == "false" ]] && unset par_test
[[ "$par_verbose" == "false" ]] && unset par_verbose

gunzip -c \
${par_force:+-f } \
${par_keep:+-k } \
${par_list:+-l } \
${par_no_name:+-n } \
${par_name:+-N } \
${par_quiet:+-q } \
${par_recursive:+-r } \
${par_suffix:+-S "${par_suffix}"} \
${par_synchronous: } \
${par_test:+-t } \
${par_verbose:+-v } \
"$par_input" > "$par_output"
11 changes: 11 additions & 0 deletions src/gunzip/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
set -e

## VIASH START
## VIASH END

"$meta_executable" --input "$meta_resources_dir/test_data/test.vcf.gz" --output "test.vcf"

echo ">> Checking output of decompressing"
[ ! -f "test.vcf" ] && echo "Output file test.vcf does not exist" && exit 1

echo "> Test successful"
13 changes: 13 additions & 0 deletions src/gunzip/test_data/script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# bgzip test data

# Test data was obtained from https://github.com/snakemake/snakemake-wrappers/tree/master/bio/bgzip/test.

if [ ! -d /tmp/snakemake-wrappers ]; then
git clone --depth 1 --single-branch --branch master https://github.com/snakemake/snakemake-wrappers /tmp/snakemake-wrappers
fi

cp -r /tmp/snakemake-wrappers/bio/bgzip/test/test.vcf src/gunzip/test_data/test.vcf

gzip src/gunzip/test_data/test.vcf

rm -rf /tmp/snakemake-wrappers
Binary file added src/gunzip/test_data/test.vcf.gz
Binary file not shown.
Loading