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

Change-Id: Ie01605ef2531d992fb85c07bae5cfaabda626ea6
-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 18d24784b2..1729066a10 100644
--- a/gnu/packages/bioconductor.scm
+++ b/gnu/packages/bioconductor.scm
@@ -81,9 +81,35 @@
         (base32 "1brzrnafvyh76h8a663gk5lprhixxpi9xi65vwgxwf7jh6yw0was"))))
     (properties `((upstream-name . "HPO.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/HPO.db/cache"))
+                     (file (string-append cache "/118333")))
+                (mkdir-p cache)
+                (copy-file #$(this-package-native-input "HPO.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)
+       ("HPO.sqlite"
+        ,(origin
+           (method url-fetch)
+           (uri "https://annotationhub.bioconductor.org/fetch/118333")
+           (file-name "HPO.sqlite")
+           (sha256
+            (base32 "1wwdwf27iil0p41183qgygh2ifphhmlljjkgjm2h8sr25qycf0md"))))))
     (home-page "https://bioconductor.org/packages/HPO.db")
     (synopsis
      "Annotation maps describing the entire Human Phenotype Ontology")