Skip to content

Commit

Permalink
Merge pull request #67 from stitam/docker
Browse files Browse the repository at this point in the history
Dockerfile, NAMESPACE, examples
  • Loading branch information
stitam authored Feb 17, 2024
2 parents cf1ebfd + 5fa2dd5 commit c70ea58
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ README.Rmd
/cache/

# scripts that are not part of the package
scripts
^docker$
^scripts$
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export(mgnify_instance)
export(mgnify_list)
export(ncbi_download_genome)
export(ncbi_get_meta)
export(ncbi_get_uid)
export(ncbi_link_uid)
export(ncbi_parse)
export(ncbi_parse_assembly_xml)
Expand Down
4 changes: 1 addition & 3 deletions R/ncbi_db_links.R
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
#' Which NCBI databases can an database be linked to?
#' Which NCBI databases can a database be linked to?
#'
#' This function is a wrapper around \code{rentrez::entrez_db_links()}. Results
#' are cached and reused to validate input for \code{ncbi_link_uid()}.
#' @param db character; the name of an NCBI database
#' @return a character vector of NCBI database names the original database can
#' be linked to.
#' @examples
#' \dontrun{
#' ncbi_db_links("assembly")
#' }
#' @noRd
ncbi_db_links <- function(db) {
if (!dir.exists(tempdir())) dir.create(tempdir())
Expand Down
3 changes: 1 addition & 2 deletions R/ncbi_get_uid.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@
#' However, if the search terms are very long, the function may fail with an
#' error message. In this case, try reducing the \code{batch_size} value.
#' @examples
#' \dontrun{
#' ncbi_get_uid("GCA_003012895.2", db = "assembly")
#' ncbi_get_uid("Autographiviridae OR Podoviridae", db = "biosample")
#' ncbi_get_uid(c("WP_093980916.1", "WP_181249115.1"), db = "protein")
#' }
#' @export
ncbi_get_uid <- function(
term,
db,
Expand Down
2 changes: 0 additions & 2 deletions R/ncbi_link_uid.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@
#' behaviour of the function with web histories is unreliable. The option is
#' there but it is recommended NOT to use web histories with this function.
#' @examples
#' \dontrun{
#' ncbi_link_uid("4253631", "assembly", "biosample")
#' ncbi_link_uid(c("1226742659", "1883410844"), "protein", "nuccore")
#' }
#' @export
ncbi_link_uid <- function(
query,
Expand Down
33 changes: 33 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM debian:bookworm-20240211

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update

# Install system dependencies
RUN apt-get install -y \
libcurl4-openssl-dev

# Install R and R packages from apt
RUN apt-get install -y \
r-base \
r-cran-curl \
r-cran-devtools \
r-cran-dplyr \
r-cran-httr \
r-cran-jsonlite \
r-cran-rentrez \
r-cran-rmarkdown \
r-cran-stringi \
r-cran-stringr \
r-cran-testthat \
r-cran-tibble \
r-cran-tidyr \
r-cran-xml \
r-cran-xml2

# Install webseq
RUN R -e 'options(warn = 2); devtools::install_github("stitam/webseq", upgrade = "never")'

# Set R library path to avoid binding from host system
ENV R_LIBS_USER /usr/local/lib/R/site-library
16 changes: 16 additions & 0 deletions docker/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
account="stitam"
container="webseq"
version="0.1.0.dev"

# build docker image
sudo docker build -f Dockerfile -t ${account}/${container}:${version} .

# OPTION 1 convert docker to singularity in one step
# sudo singularity build ${account}-${container}-${version}.img docker-daemon://${account}/${container}:${version}

# OPTION 2 export docker as tar and then convert to singularity
sudo docker image save ${account}/${container}:${version} -o ${account}-${container}-${version}.tar
sudo singularity build ${account}-${container}-${version}.img docker-archive:${account}-${container}-${version}.tar

# push to Docker Hub
# sudo docker push ${account}/${container}:${version}
2 changes: 0 additions & 2 deletions man/ncbi_get_uid.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions man/ncbi_link_uid.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c70ea58

Please sign in to comment.