diff --git a/Dockerfile b/Dockerfile index d54d6a7..0b9e5ad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] diff --git a/README.md b/README.md index 1c8551d..c2e29d8 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,32 @@ 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 @@ -13,5 +34,50 @@ The Dockerfile sets 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 +