diff --git a/CHANGELOG.md b/CHANGELOG.md index ebe5b02..929c185 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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). diff --git a/src/gunzip/config.vsh.yaml b/src/gunzip/config.vsh.yaml new file mode 100644 index 0000000..6834423 --- /dev/null +++ b/src/gunzip/config.vsh.yaml @@ -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 diff --git a/src/gunzip/help.txt b/src/gunzip/help.txt new file mode 100644 index 0000000..fe777c0 --- /dev/null +++ b/src/gunzip/help.txt @@ -0,0 +1,7 @@ +cat < src/gunzip/help.txt +```sh +gunzip --help +``` +EOF + +docker run quay.io/biocontainers/gzip:1.11 gunzip --help >> src/gunzip/help.txt \ No newline at end of file diff --git a/src/gunzip/script.sh b/src/gunzip/script.sh new file mode 100755 index 0000000..adb0dc4 --- /dev/null +++ b/src/gunzip/script.sh @@ -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" \ No newline at end of file diff --git a/src/gunzip/test.sh b/src/gunzip/test.sh new file mode 100644 index 0000000..38760ff --- /dev/null +++ b/src/gunzip/test.sh @@ -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" diff --git a/src/gunzip/test_data/script.sh b/src/gunzip/test_data/script.sh new file mode 100644 index 0000000..158d851 --- /dev/null +++ b/src/gunzip/test_data/script.sh @@ -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 diff --git a/src/gunzip/test_data/test.vcf.gz b/src/gunzip/test_data/test.vcf.gz new file mode 100644 index 0000000..766c6de Binary files /dev/null and b/src/gunzip/test_data/test.vcf.gz differ