about summary refs log tree commit diff
path: root/gn
diff options
context:
space:
mode:
authorpjotrp2026-04-15 10:32:11 +0200
committerpjotrp2026-04-15 10:32:11 +0200
commitb816d1ee91db57de62cef0a6abc0fb45cbbac8ee (patch)
tree130a7a444a394d9f317c3d4ed5c10420dff09f69 /gn
parent903a054c61cccb13fd37033d002755cef6367a0c (diff)
downloadguix-bioinformatics-b816d1ee91db57de62cef0a6abc0fb45cbbac8ee.tar.gz
Added vg package back in
Diffstat (limited to 'gn')
-rw-r--r--gn/packages/pangenome.scm265
1 files changed, 265 insertions, 0 deletions
diff --git a/gn/packages/pangenome.scm b/gn/packages/pangenome.scm
index f0a3cc7..a11bde2 100644
--- a/gn/packages/pangenome.scm
+++ b/gn/packages/pangenome.scm
@@ -34,9 +34,21 @@
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
   #:use-module (gnu packages time)
+  #:use-module (gnu packages bash)
   #:use-module (gnu packages check)
+  #:use-module (gnu packages curl)
+  #:use-module (gnu packages documentation)
+  #:use-module (gnu packages elf)
+  #:use-module (gnu packages gtk)
   #:use-module (gnu packages haskell-xyz)
+  #:use-module (gnu packages ncurses)
+  #:use-module (gnu packages protobuf)
+  #:use-module (gnu packages rdf)
   #:use-module (gnu packages ruby)
+  #:use-module (gnu packages ruby-xyz)
+  #:use-module (gnu packages tls)
+  #:use-module (gnu packages vim)
+  #:use-module (gnu packages web)
   #:use-module (gnu packages zig)
   #:use-module (gn packages pangenome-rust)
   #:use-module (gnu packages python-xyz))
@@ -858,6 +870,259 @@ format, and a collection of command-line utilities for executing complex
 manipulations on VCF files.")
       (license license:expat))))
 
+(define-public vg
+  (package
+    (name "vg")
+    (version "1.72.0")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (string-append "https://github.com/vgteam/vg/releases/download/v"
+                            version "/vg-v" version ".tar.gz"))
+        (sha256
+         (base32 "17s5vd4ry8hys6jkramdkspw5w287airfca68gb6fiapcavqaz0w"))
+        (snippet
+         #~(begin
+             (use-modules (guix build utils))
+             (substitute* (find-files "." "(CMakeLists\\.txt|Makefile)")
+               (("-march=native") "")
+               (("-mtune=native") "")
+               (("-msse4.2") "")
+               (("-mcx16") ""))))))
+    (build-system gnu-build-system)
+    (arguments
+     (list
+      #:make-flags
+      #~(list (string-append "CC=" #$(cc-for-target))
+              (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib"))
+      #:phases
+      #~(modify-phases %standard-phases
+          (delete 'configure)    ; no configure script
+          (add-after 'unpack 'patch-source
+            (lambda* (#:key inputs #:allow-other-keys)
+              ;; Add subdirectory include paths for system packages
+              (let ((extra-includes
+                     (string-join
+                      (list (search-input-directory inputs "/include/vcflib")
+                            (search-input-directory inputs "/include/fastahack")
+                            (search-input-directory inputs "/include/cairo")
+                            (search-input-directory inputs "/include/raptor2"))
+                      ":")))
+                (setenv "CPLUS_INCLUDE_PATH"
+                        (string-append extra-includes
+                                       ":" (or (getenv "CPLUS_INCLUDE_PATH") "")))
+                (setenv "C_INCLUDE_PATH"
+                        (string-append extra-includes
+                                       ":" (or (getenv "C_INCLUDE_PATH") ""))))
+              (substitute* "Makefile"
+                ;; PKG_CONFIG_DEPS - use external vcflib and fastahack
+                (("cairo libzstd")
+                 "cairo htslib libzstd libdw libelf protobuf raptor2 sdsl-lite tabixpp vcflib fastahack libdeflate libwfa2")
+
+                ;; Skip the part where we link static libraries special
+                (("-Wl,-B.*") "\n")
+
+                (("\\$\\(CWD\\)/\\$\\(LIB_DIR\\)/libtabixpp\\.a") "$(LIB_DIR)/libtabixpp.a")
+                ((" \\$\\(LIB_DIR\\)/libtabixpp\\.a")
+                 (string-append " " (search-input-file inputs "/lib/libtabixpp.so")))
+                (("\\$\\(LIB_DIR\\)/pkgconfig/tabixpp\\.pc")
+                 (string-append " " (search-input-file inputs "/lib/pkgconfig/tabixpp.pc")))
+
+                (("\\$\\(CWD\\)/\\$\\(LIB_DIR\\)/libhts\\.a") "$(LIB_DIR)/libhts.a")
+                ((" \\$\\(LIB_DIR\\)/libhts\\.a")
+                 (string-append " " (search-input-file inputs "/lib/libhts.so")))
+                (("\\$\\(LIB_DIR\\)/pkgconfig/htslib\\.pc")
+                 (string-append " " (search-input-file inputs "/lib/pkgconfig/htslib.pc")))
+
+                (("\\$\\(CWD\\)/\\$\\(LIB_DIR\\)/libdeflate\\.a") "$(LIB_DIR)/libdeflate.a")
+                ((" \\$\\(LIB_DIR\\)/libdeflate\\.a")
+                 (string-append " " (search-input-file inputs "/lib/libdeflate.so")))
+
+                ;; Use external vcflib
+                ((" \\$\\(LIB_DIR\\)/libvcflib.a")
+                 (string-append " " (search-input-file inputs "/lib/libvcflib.so")))
+                ((" \\$\\(BIN_DIR\\)/vcf2tsv")
+                 (string-append " " (search-input-file inputs "/bin/vcf2tsv")))
+
+                ((" \\$\\(FASTAHACK_DIR\\)/fastahack")
+                 (string-append " " (search-input-file inputs "/bin/fastahack")))
+                (("\\+= \\$\\(OBJ_DIR\\)/Fasta\\.o") "+=")
+                ;; Add fastahack, smithwaterman, cairo to linker flags
+                (("-lvcflib") "-lvcflib -lfastahack -lsmithwaterman -lcairo")
+
+                ((" \\$\\(LIB_DIR\\)/libsnappy.a")
+                 (string-append " " (search-input-file inputs "/lib/libsnappy.so")))
+
+                ;; Only link against the libraries in the elfutils package.
+                (("-ldwfl -ldw -ldwelf -lelf -lebl") "-ldw -lelf")
+                ((" \\$\\(LIB_DIR\\)/libelf.a")
+                 (string-append " " (search-input-file inputs "/lib/libelf.so")))
+                ((" \\$\\(LIB_DIR\\)/libdw.a")
+                 (string-append " " (search-input-file inputs "/lib/libdw.so")))
+
+                ((" \\$\\(LIB_DIR\\)/%divsufsort.a")
+                 (string-append " " (dirname
+                                     (search-input-file inputs "/lib/libdivsufsort.so"))
+                                "%divsufsort.so"))
+                ((" \\$\\(LIB_DIR\\)/libdivsufsort.a")
+                 (string-append " " (search-input-file inputs "/lib/libdivsufsort.so")))
+                ((" \\$\\(LIB_DIR\\)/%divsufsort64.a")
+                 (string-append " " (dirname
+                                     (search-input-file inputs "/lib/libdivsufsort64.so"))
+                                "%divsufsort64.so"))
+                ((" \\$\\(LIB_DIR\\)/libdivsufsort64.a")
+                 (string-append " " (search-input-file inputs "/lib/libdivsufsort64.so")))
+
+                ((" \\$\\(LIB_DIR\\)/libjemalloc.a")
+                 (string-append " " (search-input-file inputs "/lib/libjemalloc.a")))
+
+                ((" \\$\\(INC_DIR\\)/sparsehash")
+                 (string-append " " (search-input-directory inputs "/include/sparsehash")))
+
+                ((" \\$\\(INC_DIR\\)/raptor2")
+                 (string-append " " (search-input-directory inputs "/include/raptor2")))
+                ((" \\$\\(LIB_DIR\\)/libraptor2.a")
+                 (string-append " " (search-input-file inputs "/lib/libraptor2.so")))
+                ((" \\$\\(BIN_DIR\\)/rapper")
+                 (string-append " " (search-input-file inputs "/bin/rapper"))))
+              ;; Create obj and lib directories. They do not exist in
+              ;; the release tarball.
+              (mkdir "deps/libbdsg/bdsg/obj")
+              (mkdir "deps/libbdsg/lib")
+              ;; Do not remove obj and lib directories in the clean target.
+              (substitute* "deps/libbdsg/Makefile"
+                (("\\[ ! -e \\$\\(OBJ_DIR\\) \\][^\n]*") "")
+                (("\\[ ! -e \\$\\(LIB_DIR\\) \\][^\n]*") ""))))
+          (add-after 'unpack 'link-with-some-shared-libraries
+            (lambda* (#:key inputs #:allow-other-keys)
+              (substitute* '("deps/mmmultimap/CMakeLists.txt"
+                             "deps/xg/CMakeLists.txt"
+                             "deps/xg/deps/mmmulti/CMakeLists.txt")
+                (("\".*libsdsl\\.a\"") "\"-lsdsl\"")
+                (("\".*libdivsufsort\\.a\"") "\"-ldivsufsort\"")
+                (("\".*libdivsufsort64\\.a\"") "\"-ldivsufsort64\"")
+                (("\\$\\{sdsl-lite_INCLUDE\\}")
+                 (search-input-directory inputs "/include/sdsl"))
+                (("\\$\\{sdsl-lite-divsufsort_INCLUDE\\}")
+                 (dirname
+                  (search-input-file inputs "/include/divsufsort.h"))))))
+          (add-after 'unpack 'dont-build-shared-vgio
+            (lambda _
+              ;; vg will link with libvgio and fail the 'validate-runpath phase.
+              (substitute* "deps/libvgio/CMakeLists.txt"
+                (("TARGETS vgio vgio_static") "TARGETS vgio_static"))))
+          (add-after 'unpack 'adjust-tests
+            (lambda* (#:key inputs #:allow-other-keys)
+              (let ((bash-tap (assoc-ref inputs "bash-tap")))
+                (substitute* (find-files "test/t")
+                  (("BASH_TAP_ROOT.*")
+                   (string-append "BASH_TAP_ROOT=" bash-tap "/bin\n"))
+                  ((".*bash-tap-bootstrap")
+                   (string-append ". " bash-tap "/bin/bash-tap-bootstrap")))
+                (substitute* "test/t/02_vg_construct.t"
+                  (("../deps/fastahack/fastahack") (which "fastahack"))
+                  (("../bin/vcf2tsv") (which "vcf2tsv")))
+                ;; Skip failing tests
+                (substitute* "test/t/02_vg_construct.t"
+                  ((".*self-inconsistent.*") "is $(true) \"\" \"\"\n"))
+                (substitute* "test/t/07_vg_map.t"
+                  (("identity\\) 1 \"") "identity) 1.0 \""))
+                (substitute* '("test/t/07_vg_map.t"
+                               "test/t/33_vg_mpmap.t")
+                  ((".*node id.*") "is $(true) \"\" \"\"\n"))
+                (substitute* "test/t/48_vg_convert.t"
+                  (("true \"vg.*") "true \"true\"\n"))
+                (substitute* "test/t/50_vg_giraffe.t"
+                  ((".*A long read can.*") "is $(true) \"\" \"\"\n")
+                  ((".*A long read has.*") "is $(true) \"\" \"\"\n")
+                  ((".*Long read minimizer.*") "is $(true) \"\" \"\"\n"))
+                ;; Don't test the docs, we're not providing npm
+                (substitute* "Makefile"
+                  ((".*test-docs.*") "")))))
+          (add-after 'build 'build-manpages
+            (lambda* (#:key make-flags #:allow-other-keys)
+              ;; vg is not in PATH. Replace it with full path.
+              (substitute* "doc/vgmanmd.py"
+                (("'vg'") "'./bin/vg'"))
+              (apply invoke "make" "man" make-flags)))
+          (replace 'install
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let ((out (assoc-ref outputs "out")))
+                (install-file "bin/vg" (string-append out "/bin"))
+                (install-file "lib/libhandlegraph.so" (string-append out "/lib"))
+                (for-each
+                 (lambda (file)
+                   (install-file file (string-append out "/share/man/man1")))
+                 (find-files "doc/man" "\\.1$"))))))
+      #:test-target "test"))
+    (native-inputs
+     (append
+       (if (supported-package? ruby-asciidoctor)
+         (list ruby-asciidoctor)
+         '())
+       (list asciidoc
+             bash-tap
+             bc
+             cmake-minimal
+             ghc-pandoc
+             jq
+             perl
+             pkg-config
+             python
+             samtools
+             util-linux
+             which
+             xxd)))
+    (inputs
+     (list boost
+           cairo
+           curl
+           elfutils
+           fastahack
+           htslib
+           jansson
+           jemalloc
+           libdeflate
+           libdivsufsort
+           ncurses
+           openmpi
+           openssl
+           protobuf
+           raptor2
+           sdsl-lite
+           smithwaterman
+           snappy
+           sparsehash
+           tabixpp
+           vcflib
+           wfa2-lib/cmake
+           zlib
+           (list zstd "lib")))
+    (home-page "https://www.biostars.org/t/vg/")
+    (synopsis "Tools for working with genome variation graphs")
+    (description "Variation graphs provide a succinct encoding of the sequences
+of many genomes.  A variation graph (in particular as implemented in vg) is
+composed of:
+@enumerate
+@item nodes, which are labeled by sequences and ids
+@item edges, which connect two nodes via either of their respective ends
+@item paths, describe genomes, sequence alignments, and annotations (such as
+gene models and transcripts) as walks through nodes connected by edges
+@end enumerate
+This model is similar to sequence graphs that have been used in assembly and
+multiple sequence alignment.")
+    (properties `((release-monitoring-url . "https://github.com/vgteam/vg/releases")
+                  (tunable? . #t)))
+    (license
+      (list
+        license:expat
+        license:bsd-2
+        license:bsd-3
+        license:asl2.0
+        license:gpl3+
+        license:zlib
+        license:boost1.0))))
+
 (define-public pangenomes
   (package
     (name "pangenomes")