aboutsummaryrefslogtreecommitdiff
path: root/gn/packages/statistics.scm
diff options
context:
space:
mode:
authorEfraim Flashner2020-08-18 08:19:08 -0500
committerEfraim Flashner2020-08-18 08:19:08 -0500
commit3305d6668ca59282cd01e908437570e6d6423ffd (patch)
tree73db8e2f4fc3d372ba5a43d3c8cd63085655c8ad /gn/packages/statistics.scm
parentf3e338e1ede999f63b974c799da30e2a57bfab70 (diff)
downloadguix-bioinformatics-3305d6668ca59282cd01e908437570e6d6423ffd.tar.gz
gn: Add r-minimal-2 and some R packages
Diffstat (limited to 'gn/packages/statistics.scm')
-rw-r--r--gn/packages/statistics.scm151
1 files changed, 150 insertions, 1 deletions
diff --git a/gn/packages/statistics.scm b/gn/packages/statistics.scm
index e910df4..73194fb 100644
--- a/gn/packages/statistics.scm
+++ b/gn/packages/statistics.scm
@@ -12,7 +12,9 @@
#:use-module (gnu packages python)
#:use-module (gnu packages python-science)
#:use-module (gnu packages python-xyz)
- #:use-module (gnu packages statistics))
+ #:use-module (gnu packages statistics)
+ #:use-module (gnu packages texinfo)
+ #:use-module (srfi srfi-1))
(define-public r-hmisc-3
(package
@@ -148,3 +150,150 @@ traits (CTL). The additional correlation information obtained can be
combined with QTL information to perform de novo reconstruction of
interaction networks.")
(license license:gpl3)))
+
+;; r-with-tests is private so we inherit from r-minimal.
+(define r-with-tests-2
+ (package
+ (inherit r-minimal)
+ (name "r-with-tests")
+ (version "2.15.3")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "mirror://cran/src/base"
+ "/R-" (version-major version)
+ "/R-" version ".tar.gz"))
+ (sha256
+ (base32
+ "1mjmq95s5nrwppbzic6lzanjq65j3sxg85l1q09c0fxdin7s70y5"))))
+ (arguments
+ (substitute-keyword-arguments (package-arguments r-minimal)
+ ((#:tests? _ #t) #t)
+ ((#:configure-flags cf)
+ `(cons* "--with-system-zlib"
+ "--with-system-bzlib"
+ "--with-system-pcre"
+ (delete "--without-recommended-packages" ,cf)))
+ ((#:phases phases)
+ `(modify-phases ,phases
+ ;; We can only use some of 'build-reproducibly with this older version.
+ (replace 'build-reproducibly
+ (lambda _
+ ;; The documentation contains time stamps to demonstrate
+ ;; documentation generation in different phases.
+ (substitute* "src/library/tools/man/Rd2HTML.Rd"
+ (("\\\\%Y-\\\\%m-\\\\%d at \\\\%H:\\\\%M:\\\\%S")
+ "(removed for reproducibility)"))
+
+ ;; Remove timestamp from tracing environment. This fixes
+ ;; reproducibility of "methods.rd{b,x}".
+ (substitute* "src/library/methods/R/trace.R"
+ (("dateCreated = Sys.time\\(\\)")
+ "dateCreated = as.POSIXct(\"1970-1-1 00:00:00\", tz = \"UTC\")"))
+
+ ;; Ensure that gzipped files are reproducible.
+ (substitute* '("src/library/grDevices/Makefile.in"
+ "doc/manual/Makefile.in")
+ (("R_GZIPCMD\\)" line)
+ (string-append line " -n")))
+
+ ;; The "srcfile" procedure in "src/library/base/R/srcfile.R"
+ ;; queries the mtime of a given file and records it in an object.
+ ;; This is acceptable at runtime to detect stale source files,
+ ;; but it destroys reproducibility at build time.
+
+ ;; Similarly, the "srcfilecopy" procedure records the current
+ ;; time. We change both of them to respect SOURCE_DATE_EPOCH.
+; (substitute* "src/library/base/R/srcfile.R"
+; (("timestamp <- (timestamp.*|file.mtime.*)" _ time)
+; (string-append "timestamp <- \
+;as.POSIXct(if (\"\" != Sys.getenv(\"SOURCE_DATE_EPOCH\")) {\
+; as.numeric(Sys.getenv(\"SOURCE_DATE_EPOCH\"))\
+;} else { " time "}, origin=\"1970-01-01\")\n")))
+
+ ;; This library is installed using "install_package_description",
+ ;; so we need to pass the "builtStamp" argument.
+ ;(substitute* "src/library/tools/Makefile.in"
+ ; (("(install_package_description\\(.*\"')\\)\"" line prefix)
+ ; (string-append prefix ", builtStamp='1970-01-01')\"")))
+
+ (substitute* "src/library/Recommended/Makefile.in"
+ (("INSTALL_OPTS =" m)
+ (string-append m " --built-timestamp=1970-01-01" m)))
+
+ ;; R bundles an older version of help2man, which does not respect
+ ;; SOURCE_DATE_EPOCH. We cannot just use the latest help2man,
+ ;; because that breaks a test.
+ (with-fluids ((%default-port-encoding "ISO-8859-1"))
+ (substitute* "tools/help2man.pl"
+ (("my \\$date = strftime \"%B %Y\", localtime" line)
+ (string-append line " 1"))))
+ #t))))))
+ (native-inputs
+ `(("texinfo" ,texinfo-4)
+ ,@(alist-delete "texinfo" (package-native-inputs r-minimal))))
+ (properties '((release-date "2013-03-01")))))
+
+(define-public r-minimal-2
+ (package
+ (inherit r-with-tests-2)
+ (name "r-minimal")
+ (arguments
+ (substitute-keyword-arguments (package-arguments r-with-tests-2)
+ ((#:tests? _ #f) #f)
+ ((#:configure-flags flags)
+ ;; Do not build the recommended packages. The build system creates
+ ;; random temporary directories and embeds their names in some
+ ;; package files. We build these packages with the r-build-system
+ ;; instead.
+ `(cons* "--without-recommended-packages" ,flags))))))
+
+(define-public r-2-lattice
+ (package
+ (inherit r-lattice)
+ (name "r-lattice")
+ (version "0.20-31")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (cran-uri "lattice" version))
+ (sha256
+ (base32
+ "1b3m3rg1zd8ssk5jjswk5y93js89vh6939kfajh6i6wphndxigb1"))))
+ (build-system r-build-system)
+ (arguments
+ `(#:r ,r-minimal-2))))
+
+(define-public r-2-matrix
+ (package
+ (inherit r-matrix)
+ (name "r-matrix")
+ (version "1.2-0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (cran-uri "Matrix" version))
+ (sha256
+ (base32
+ "0ywz213p6cpwnklxd81hzdyxjzagaj6cn32ycc5rcnhxy30d7kk5"))))
+ (arguments
+ `(#:r ,r-minimal-2))
+ (propagated-inputs
+ `(("r-lattice" ,r-2-lattice)))))
+
+(define-public r-2-survival
+ (package
+ (inherit r-survival)
+ (name "r-survival")
+ (version "2.41-3")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (cran-uri "survival" version))
+ (sha256
+ (base32
+ "07cnr0hnki6ybbjll54l4s5lllhk19vni5f8m0mvsfp99ls7qygk"))))
+ (arguments
+ `(#:r ,r-minimal-2))
+ (propagated-inputs
+ `(("r-matrix" ,r-2-matrix)))))