diff --git a/.Rbuildignore b/.Rbuildignore index fb9d7b6..857ec40 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -14,4 +14,5 @@ README.Rmd /cache/ # scripts that are not part of the package -scripts +^docker$ +^scripts$ diff --git a/NAMESPACE b/NAMESPACE index 89a3cb7..1d67ad3 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -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) diff --git a/R/ncbi_db_links.R b/R/ncbi_db_links.R index 3f0bc72..2b7cc58 100644 --- a/R/ncbi_db_links.R +++ b/R/ncbi_db_links.R @@ -1,4 +1,4 @@ -#' 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()}. @@ -6,9 +6,7 @@ #' @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()) diff --git a/R/ncbi_get_uid.R b/R/ncbi_get_uid.R index e46a54e..72619d5 100644 --- a/R/ncbi_get_uid.R +++ b/R/ncbi_get_uid.R @@ -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, diff --git a/R/ncbi_link_uid.R b/R/ncbi_link_uid.R index 408a89b..d206275 100644 --- a/R/ncbi_link_uid.R +++ b/R/ncbi_link_uid.R @@ -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, diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..cacee6f --- /dev/null +++ b/docker/Dockerfile @@ -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 \ No newline at end of file diff --git a/docker/run.sh b/docker/run.sh new file mode 100755 index 0000000..6465aea --- /dev/null +++ b/docker/run.sh @@ -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} \ No newline at end of file diff --git a/man/ncbi_get_uid.Rd b/man/ncbi_get_uid.Rd index 39a1ff4..486704d 100644 --- a/man/ncbi_get_uid.Rd +++ b/man/ncbi_get_uid.Rd @@ -49,9 +49,7 @@ 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") } -} diff --git a/man/ncbi_link_uid.Rd b/man/ncbi_link_uid.Rd index 25d876f..64346bd 100644 --- a/man/ncbi_link_uid.Rd +++ b/man/ncbi_link_uid.Rd @@ -71,8 +71,6 @@ 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") } -}