This is a test version of Biostars. For the public version, visit https://www.biostars.org.
how to use bgzip with tabix docker image

Please suggest how to run bgzip via docker image.

I've secessfully pulled: https://hub.docker.com/r/mgibio/tabix/builds/ but can't figure out how to run bgzip command.

Thanks

software error

1 answer

Considering you are at your project's folder with the input files that you want to pass to bgzip, use the following command to interactively run bgzip in a Docker container interactively and mounting the current directory under /opt/ within the Docker container generate:

docker run -ti -v $PWD:/opt/ --entrypoint '/opt/samtools/bin/bgzip' mgibio/tabix:1.3.1 --help

Version: 1.3.1
Usage:   bgzip [OPTIONS] [FILE] ...
Options:
   -b, --offset INT        decompress at virtual file pointer (0-based uncompressed offset)
   -c, --stdout            write on standard output, keep original files unchanged
   -d, --decompress        decompress
   -f, --force             overwrite files without asking
   -h, --help              give this help
   -i, --index             compress and create BGZF index
   -I, --index-name FILE   name of BGZF index file [file.gz.gzi]
   -r, --reindex           (re)index compressed file
   -s, --size INT          decompress INT bytes (uncompressed size)
   -@, --threads INT       number of compression threads to use [1]

-ti is for interactive run

-v $PWD:/opt/ for mounting the current directory so you can provide input files

--entrypoint '/opt/samtools/bin/bgzip' to set bgzip as the container's entrypoint

mgibio/tabix:1.3.1 is the repo

--help is the arguments you normally would provide

For example to bgzip a VCF file:

docker run -ti -v $PWD:/opt/ --entrypoint '/opt/samtools/bin/bgzip' mgibio/tabix:1.3.1 -c -f /opt/input_vcf_file.vcf > /opt/input_vcf_file.tab.vcf.gz

Log in to answer this question.