Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy test data to container and update documentation #4

Merged
merged 1 commit into from
Oct 7, 2021
Merged
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
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@ LABEL \
RUN apt-get update

RUN mkdir -p /opt/bam-readcount/bin
RUN mkdir -p /opt/bam-readcount/test-data
WORKDIR /opt/bam-readcount
COPY --from=0 /bam-readcount/build/bin/bam-readcount /opt/bam-readcount/bin/bam-readcount
COPY --from=0 /bam-readcount/test-data/ref.* /opt/bam-readcount/test-data/
COPY --from=0 /bam-readcount/test-data/test.bam* /opt/bam-readcount/test-data/
RUN ln -s /opt/bam-readcount/bin/bam-readcount /usr/bin/bam-readcount

ENTRYPOINT ["/usr/bin/bam-readcount"]
72 changes: 69 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,83 @@
docker-bam-readcount
====================

Docker image for `bam-readcount`
Docker image based on Ubuntu Focal with `bam-readcount` `v1.0.0` built
and installed. Note that this does *not* build from `master`, but the
`v1.0.0` tag. Edit the `Dockerfile` to use `master` or a different branch
or tag.

This image is automatically built in DockerHub: https://hub.docker.com/r/mgibio/bam-readcount

Usage
-----
docker pull mgibio/bam-readcount

The `bam-readcount` binary is installed as

/usr/bin/bam-readcount


Resources
---------

https://github.com/genome/bam-readcount
`bam-readcount` source and documentation

https://docs.docker.com/
Docker documentation


Usage (via `ENTRYPOINT`)
------------------------

The Dockerfile sets

ENTRYPOINT ["/usr/bin/bam-readcount"]

so the container can be run as an executable.

For example, to run `bam-readcount` on a FASTA reference `REFERENCE` and
BAM file `BAMFILE` in the current working directory, you can do

# --rm
# Remove container when done
# -v $(pwd):$(pwd)
# Maps the current working directory to the same path inside the container
# -w $(pwd)
# Sets the working directory to the current working directory inside
# the container
docker run --rm -v $(pwd):$(pwd) -w $(pwd) mgibio/bam-readcount -f REFERENCE BAMFILE


Usage (interactive)
-------------------

The `ENTRYPOINT` can be overridden for interactive use.

For example, to run `bam-readcount` on test data included in the container,
do

# --rm
# Remove container when done
# -it
# Docker interactive flags
# --entrypoint /bin/bash
# Set the Bash shell as the entrypoint
docker run --rm -it --entrypoint /bin/bash mgibio/bam-readcount

The container will present an interactive prompt, and the working directory
will be `/opt/bam-readcount`. There is a directory `test-data` there, and
`bam-readcount` can be run on this data with

# -w1
# The test BAM does not have the SM tag; -w1 will report warnings
# only once to avoid a warning for each read
root@3a0a8df8b278:/opt/bam-readcount# bam-readcount -w1 -f test-data/ref.fa test-data/test.bam

To make your own data available for interactive use within the container,
use the Docker `-v` and `-w` flags to map your local directories and
set a working directory, for example to use the current working local
directory

docker run --rm -it -v $(pwd):$(pwd) -w $(pwd) --entrypoint /bin/bash mgibio/bam-readcount