summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2023-11-03 19:08:19 +0100
committerRicardo Wurmus <rekado@elephly.net>2023-11-03 22:49:28 +0100
commitabaca151b2aaf1c6e8d05afed9e14daa9259c66c (patch)
tree1d00848a2de822941b14e5380dcc2547da55d542 /gnu
parentb30127052ecbf581f83bcf18c571bc7cdea52364 (diff)
downloadguix-abaca151b2aaf1c6e8d05afed9e14daa9259c66c.tar.gz
gnu: r-mpo-db: Include HPO sqlite database.
* gnu/packages/bioconductor.scm (r-mpo-db)[arguments]: Bypass fetching of the
database from the internet when in build environment.
[native-inputs]: Add MPO.sqlite.

Change-Id: Ic7228322b89ce78a85a9bd5ffbd985ccd906d268
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/bioconductor.scm28
1 files changed, 27 insertions, 1 deletions
diff --git a/gnu/packages/bioconductor.scm b/gnu/packages/bioconductor.scm
index 1729066a10..8f95fd7e5c 100644
--- a/gnu/packages/bioconductor.scm
+++ b/gnu/packages/bioconductor.scm
@@ -164,9 +164,35 @@ It retrieves this data from the Genome Aggregation Database
         (base32 "0x1rcikg189akbd71yh0p02482km9hry6i69s2srdf5mlgqficvl"))))
     (properties `((upstream-name . "MPO.db")))
     (build-system r-build-system)
+    (arguments
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'avoid-internet-access
+            (lambda* (#:key inputs #:allow-other-keys)
+              (let* ((cache (string-append #$output "/share/MPO.db/cache"))
+                     (file (string-append cache "/118299")))
+                (mkdir-p cache)
+                (copy-file #$(this-package-native-input "MPO.sqlite") file)
+                (substitute* "R/zzz.R"
+                  (("ah <- suppressMessages\\(AnnotationHub\\(\\)\\)" m)
+                   (string-append
+                    "if (Sys.getenv(\"NIX_BUILD_TOP\") == \"\") { " m " };"))
+                  (("dbfile <- ah.*" m)
+                   (string-append
+                    "if (Sys.getenv(\"NIX_BUILD_TOP\") != \"\") { dbfile <- \""
+                    file "\";} else { " m " }\n")))))))))
     (propagated-inputs
      (list r-annotationdbi r-annotationhub r-biocfilecache r-dbi))
-    (native-inputs (list r-knitr))
+    (native-inputs
+     `(("r-knitr" ,r-knitr)
+       ("MPO.sqlite"
+        ,(origin
+           (method url-fetch)
+           (uri "https://annotationhub.bioconductor.org/fetch/118299")
+           (file-name "MPO.sqlite")
+           (sha256
+            (base32 "12rf5dpnjrpw55bgnbn68dni2g0p87nvs9c7mamqk0ayafs61zl0"))))))
     (home-page "https://github.com/YuLab-SMU/MPO.db")
     (synopsis "set of annotation maps describing the Mouse Phenotype Ontology")
     (description