about summary refs log tree commit diff
diff options
context:
space:
mode:
authorpjotrp2026-04-03 14:56:57 +0200
committerpjotrp2026-04-03 14:56:57 +0200
commit05b1a2bab0867b31ad740d15a5d52528c463a461 (patch)
tree0f089a64f1a98da92a292bfabcd4fa7e7cc1d7d0
parent996d9fcd40efce6e69892613c3258862bbf66bea (diff)
downloadguix-bioinformatics-05b1a2bab0867b31ad740d15a5d52528c463a461.tar.gz
Get pangenome tools going again
-rw-r--r--gn/packages/pangenome-rust.scm119
-rw-r--r--gn/packages/pangenome.scm245
-rw-r--r--gn/packages/patches/seqwish-paryfor-riscv.patch20
-rw-r--r--gn/packages/patches/seqwish-shared-library.patch195
4 files changed, 579 insertions, 0 deletions
diff --git a/gn/packages/pangenome-rust.scm b/gn/packages/pangenome-rust.scm
index e318da7..fb1a9c3 100644
--- a/gn/packages/pangenome-rust.scm
+++ b/gn/packages/pangenome-rust.scm
@@ -2294,6 +2294,14 @@
   (crate-source "env_logger" "0.11.10"
                 "0smmk1hqzk7z91rg7fdq98d03gh9kidkd0ymim43zb4n457w0886"))
 
+
+(define rust-simd-adler32-0.3.9
+  (crate-source "simd-adler32" "0.3.9"
+                "0532ysdwcvzyp2bwpk8qz0hijplcdwpssr5gy5r7qwqqy5z5qgbh"))
+
+(define rust-vcf-0.6.1
+  (crate-source "vcf" "0.6.1"
+                "0dc0p00a19rpmhrqcshrn2qg5l716b5s1fy8vpd3p32bw77vpbs0"))
 (define-cargo-inputs lookup-cargo-inputs
   (gfainject =>
     (list rust-adler-1.0.2
@@ -3070,6 +3078,84 @@
           rust-windows-x86-64-gnullvm-0.53.1
           rust-windows-x86-64-msvc-0.53.1
           rust-wyhash-0.5.0))
+  (vcfbub =>
+    (list rust-adler2-2.0.1
+          rust-ansi-term-0.12.1
+          rust-atty-0.2.14
+          rust-bitflags-1.3.2
+          rust-cfg-if-1.0.4
+          rust-clap-2.34.0
+          rust-crc32fast-1.5.0
+          rust-flate2-1.1.9
+          rust-hermit-abi-0.1.19
+          rust-libc-0.2.184
+          rust-memchr-2.8.0
+          rust-minimal-lexical-0.2.1
+          rust-miniz-oxide-0.8.9
+          rust-nom-7.1.3
+          rust-once-cell-1.21.4
+          rust-proc-macro2-1.0.106
+          rust-quote-1.0.45
+          rust-simd-adler32-0.3.9
+          rust-strsim-0.8.0
+          rust-syn-2.0.117
+          rust-textwrap-0.11.0
+          rust-thiserror-1.0.69
+          rust-thiserror-impl-1.0.69
+          rust-unicode-ident-1.0.24
+          rust-unicode-width-0.1.14
+          rust-vcf-0.6.1
+          rust-vec-map-0.8.2
+          rust-winapi-0.3.9
+          rust-winapi-i686-pc-windows-gnu-0.4.0
+          rust-winapi-x86-64-pc-windows-gnu-0.4.0))
+  (gafpack =>
+    (list rust-aho-corasick-1.1.4
+          rust-anstream-1.0.0
+          rust-anstyle-1.0.14
+          rust-anstyle-parse-1.0.0
+          rust-anstyle-query-1.1.5
+          rust-anstyle-wincon-3.0.11
+          rust-anyhow-1.0.102
+          rust-arrayvec-0.5.2
+          rust-bitflags-1.3.2
+          rust-bstr-0.2.17
+          rust-bytemuck-1.25.0
+          rust-bytemuck-derive-1.10.2
+          rust-cfg-if-1.0.4
+          rust-clap-4.6.0
+          rust-clap-builder-4.6.0
+          rust-clap-derive-4.6.0
+          rust-clap-lex-1.1.0
+          rust-colorchoice-1.0.5
+          rust-fnv-1.0.7
+          rust-gfa-0.10.1
+          rust-heck-0.5.0
+          rust-is-terminal-polyfill-1.70.2
+          rust-lazy-static-1.5.0
+          rust-lexical-core-0.7.6
+          rust-libc-0.2.184
+          rust-memchr-2.8.0
+          rust-memmap-0.7.0
+          rust-nom-5.1.3
+          rust-once-cell-polyfill-1.70.2
+          rust-proc-macro2-1.0.106
+          rust-quote-1.0.45
+          rust-regex-1.12.3
+          rust-regex-automata-0.4.14
+          rust-regex-syntax-0.8.10
+          rust-ryu-1.0.23
+          rust-static-assertions-1.1.0
+          rust-strsim-0.11.1
+          rust-syn-2.0.117
+          rust-unicode-ident-1.0.24
+          rust-utf8parse-0.2.2
+          rust-version-check-0.9.5
+          rust-winapi-0.3.9
+          rust-winapi-i686-pc-windows-gnu-0.4.0
+          rust-winapi-x86-64-pc-windows-gnu-0.4.0
+          rust-windows-link-0.2.1
+          rust-windows-sys-0.61.2))
   (gfautil =>
     (list rust-aho-corasick-1.1.4
           rust-android-system-properties-0.1.5
@@ -3706,3 +3792,36 @@ Graphical Fragment Assembly} files and related formats.")
      "GFAffix identifies walk-preserving shared affixes in variation graphs and
 collapses them into a non-redundant graph structure.")
     (license license:expat)))
+
+(define-public gafpack
+  (let ((commit "ad31875b6914d964c6fd72d1bf334f0843538fb6")
+        (revision "1"))
+    (package
+      (name "gafpack")
+      (version (git-version "0.0.0" revision commit))
+      (source (local-file "/fast/pjotr/tmp/claude/factory/gafpack"
+                          #:recursive? #t))
+      (build-system cargo-build-system)
+      (arguments (list #:install-source? #f))
+      (inputs (cargo-inputs 'gafpack #:module '(gn packages pangenome-rust)))
+      (home-page "https://github.com/ekg/gafpack")
+      (synopsis "Convert variation graph alignments to coverage maps over nodes")
+      (description
+       "Gafpack converts alignments to pangenome variation graphs to coverage
+maps useful in haplotype-based genotyping.")
+      (license license:expat))))
+
+(define-public vcfbub
+  (package
+    (name "vcfbub")
+    (version "0.1.0")
+    (source (local-file "/fast/pjotr/tmp/claude/factory/vcfbub"
+                        #:recursive? #t))
+    (build-system cargo-build-system)
+    (arguments (list #:install-source? #f))
+    (inputs (cargo-inputs 'vcfbub #:module '(gn packages pangenome-rust)))
+    (home-page "https://github.com/pangenome/vcfbub")
+    (synopsis "Popping bubbles in vg deconstruct VCFs")
+    (description "vcfbub filters VCF records by snarl tree level and allele
+size, keeping nested bubbles when parent bubbles are popped.")
+    (license license:expat)))
diff --git a/gn/packages/pangenome.scm b/gn/packages/pangenome.scm
index 324019e..f253458 100644
--- a/gn/packages/pangenome.scm
+++ b/gn/packages/pangenome.scm
@@ -8,6 +8,7 @@
   #:use-module (guix git-download)
   #:use-module (guix gexp)
   #:use-module (guix build-system cmake)
+  #:use-module (guix build-system copy)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system go)
   #:use-module (gnu packages base)
@@ -23,8 +24,14 @@
   #:use-module (gnu packages datastructures)
   #:use-module (gnu packages jemalloc)
   #:use-module (gnu packages mpi)
+  #:use-module (gnu packages algebra)
+  #:use-module (gnu packages graph)
+  #:use-module (gnu packages guile)
+  #:use-module (gnu packages parallel)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages time)
+  #:use-module (gn packages pangenome-rust)
   #:use-module (gnu packages python-xyz))
 
 ;; gfautil has been moved to (gn packages pangenome-rust)
@@ -465,3 +472,241 @@ pangene.")
     (description "odgi provides an efficient and succinct dynamic DNA sequence
 graph model, as well as algorithms for pangenome analysis.")
     (license license:expat)))
+
+(define-public seqwish
+  (package
+    (name "seqwish")
+    (version "0.7.11")
+    (source (origin
+             (method git-fetch)
+             (uri (git-reference
+                   (url "https://github.com/ekg/seqwish.git")
+                   (commit (string-append "v" version))
+                   (recursive? #t)))
+             (file-name (git-file-name name version))
+             (sha256
+              (base32 "18wsrvqf0nsfk29v3ggdq2r4q15d4n4sq8v228qq1jsybbjlkgsa"))
+             (patches
+              (list (local-file "patches/seqwish-paryfor-riscv.patch")
+                    (local-file "patches/seqwish-shared-library.patch")))
+             (snippet
+              #~(begin
+                  (use-modules (guix build utils))
+                  (substitute* '("CMakeLists.txt"
+                                 "deps/atomic_queue/Makefile"
+                                 "deps/mmmulti/deps/DYNAMIC/CMakeLists.txt"
+                                 "deps/mmmulti/deps/atomic_queue/Makefile"
+                                 "deps/mmmulti/deps/ips4o/CMakeLists.txt")
+                    (("-march=native") "")
+                    (("-mcx16") ""))
+                  (substitute* '("deps/mmmulti/deps/sdsl-lite/CMakeLists.txt"
+                                 "deps/sdsl-lite/CMakeLists.txt")
+                    (("-msse4.2 -march=native") ""))))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:configure-flags
+       '("-DSEQWISH_LINK_SHARED_LIBRARY=ON"
+         "-DCMAKE_C_FLAGS=-mcx16"
+         "-DCMAKE_CXX_FLAGS=-mcx16")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'set-version
+           (lambda _
+             (mkdir-p "include")
+             (substitute* "CMakeLists.txt"
+               (("^execute_process") "#execute_process"))
+             (with-output-to-file "include/seqwish_git_version.hpp"
+               (lambda ()
+                 (format #t "#define SEQWISH_GIT_VERSION \"~a\"~%" ,version)))))
+         (add-after 'unpack 'link-with-some-shared-libraries
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* '("CMakeLists.txt"
+                            "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"))))))
+         (replace 'check
+           (lambda* (#:key tests? #:allow-other-keys)
+             (setenv "PATH" (string-append (getcwd) ":" (getenv "PATH")))
+             (when tests?
+               (with-directory-excursion "../source/test"
+                 (invoke "make"))))))))
+    (inputs
+     (list jemalloc
+           libdivsufsort
+           openmpi
+           sdsl-lite
+           zlib))
+    (native-inputs
+     (list perl))
+    (home-page "https://github.com/ekg/seqwish")
+    (synopsis "Alignment to variation graph inducer")
+    (description "Seqwish implements a lossless conversion from pairwise
+alignments between sequences to a variation graph encoding the sequences and
+their alignments.")
+    (license license:expat)))
+(define-public smoothxg
+  (package
+    (name "smoothxg")
+    (version "0.8.2")
+    (source (origin
+             (method url-fetch)
+             (uri (string-append "https://github.com/pangenome/smoothxg"
+                                 "/releases/download/v" version
+                                 "/smoothxg-v" version ".tar.gz"))
+             (sha256
+              (base32 "1hqaa6l904zl01rsmw5vzx2kvcncl97i5kln850snywyv33skxp6"))
+             (snippet
+              #~(begin
+                  (use-modules (guix build utils))
+                  (substitute* (find-files "." "CMakeLists.txt")
+                    (("spoa_optimize_for_native ON")
+                     "spoa_optimize_for_native OFF")
+                    (("-msse4\\.2") "")
+                    (("-march=native") ""))))))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+       #:make-flags
+       #~(list (string-append "CC = " #$(cc-for-target)))
+       #:phases
+       #~(modify-phases %standard-phases
+           (add-after 'unpack 'link-with-some-shared-libraries
+             (lambda* (#:key inputs #:allow-other-keys)
+               (substitute* '("CMakeLists.txt"
+                              "deps/mmmulti/CMakeLists.txt"
+                              "deps/odgi/deps/mmmulti/CMakeLists.txt")
+                 (("\".*libsdsl\\.a\"") "\"-lsdsl\"")
+                 (("\".*libdivsufsort\\.a\"") "\"-ldivsufsort\"")
+                 (("\".*libdivsufsort64\\.a\"") "\"-ldivsufsort64\"")
+                 (("\".*libodgi\\.a\"") "\"-lodgi\"")
+                 (("\\$\\{sdsl-lite_INCLUDE\\}")
+                  (search-input-directory inputs "/include/sdsl"))
+                 (("\\$\\{sdsl-lite-divsufsort_INCLUDE\\}")
+                  (dirname
+                    (search-input-file inputs "/include/divsufsort.h")))
+                 (("\\$\\{odgi_INCLUDE\\}")
+                  (search-input-directory inputs "/include/odgi")))))
+           (add-before 'build 'build-abPOA
+             (lambda* (#:key make-flags #:allow-other-keys)
+               ;; This helps with portability to other architectures.
+               (with-directory-excursion
+                 (string-append "../smoothxg-v" #$version "/deps/abPOA")
+                 (substitute* "Makefile"
+                   (("-march=native") "")
+                   (("-march=armv8-a\\+simd") ""))
+                 (apply invoke "make" "libabpoa" make-flags)))))))
+    (inputs
+     (list jemalloc
+           libdivsufsort
+           odgi
+           openmpi
+           pybind11
+           python
+           sdsl-lite
+           zlib
+           (list zstd "lib")))
+    (native-inputs
+     (list pkg-config))
+    (home-page "https://github.com/ekg/smoothxg")
+    (synopsis
+     "Linearize and simplify variation graphs using blocked partial order alignment")
+    (description "Pangenome graphs built from raw sets of alignments may have
+complex local structures generated by common patterns of genome variation.
+These local nonlinearities can introduce difficulty in downstream analyses,
+visualization, and interpretation of variation graphs.
+
+@command{smoothxg} finds blocks of paths that are collinear within a variation
+graph.  It applies partial order alignment to each block, yielding an acyclic
+variation graph.  Then, to yield a smoothed graph, it walks the original paths
+to lace these subgraphs together.  The resulting graph only contains cyclic or
+inverting structures larger than the chosen block size, and is otherwise
+manifold linear.  In addition to providing a linear structure to the graph,
+smoothxg can be used to extract the consensus pangenome graph by applying the
+heaviest bundle algorithm to each chain.
+
+To find blocks, smoothxg applies a greedy algorithm that assumes that the graph
+nodes are sorted according to their occurence in the graph's embedded paths.
+The path-guided stochastic gradient descent based 1D sort implemented in
+@command{odgi sort -Y} is designed to provide this kind of sort.")
+    (properties `((tunable? . #t)))
+    (license license:expat)))
+
+;; TODO: Unbundle BBHash, parallel-hashmap, zstr
+
+(define-public pggb
+  (package
+    (name "pggb")
+    (version "0.7.4")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/pangenome/pggb")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1mzyr15l40hrjkdzrq49xzbby9a3a70j7glwf74k9z53firp0pf6"))))
+    (build-system copy-build-system)
+    (arguments
+     (list
+      #:install-plan
+      #~'(("pggb" "bin/")
+          ("partition-before-pggb" "bin/")
+          ("scripts/" "bin/")
+          ("scripts" "bin/scripts"))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'force-python3
+            (lambda _
+              (substitute* (find-files "scripts" "\\.py$")
+                (("/usr/bin/python") "/usr/bin/python3"))))
+          (add-after 'install 'wrap-scripts
+            (lambda* (#:key inputs outputs #:allow-other-keys)
+              (let ((out (assoc-ref outputs "out")))
+                (for-each
+                 (lambda (file)
+                   (wrap-script file
+                                `("PATH" ":" prefix
+                                  ,(map (lambda (input) (string-append input "/bin"))
+                                        (list #$(this-package-input "bc")
+                                              #$(this-package-input "bedtools")
+                                              #$(this-package-input "gfaffix")
+                                              #$(this-package-input "htslib")
+                                              #$(this-package-input "odgi")
+                                              #$(this-package-input "parallel")
+                                              #$(this-package-input "pigz")
+                                              #$(this-package-input "python")
+                                              #$(this-package-input "samtools")
+                                              #$(this-package-input "seqwish")
+                                              #$(this-package-input "smoothxg")
+                                              #$(this-package-input "time")
+                                              #$(this-package-input "wfmash"))))))
+                 (list (string-append out "/bin/pggb")
+                       (string-append out "/bin/partition-before-pggb")))))))))
+    (inputs
+     (list bc
+           bedtools
+           gfaffix
+           guile-3.0
+           htslib
+           odgi
+           parallel
+           pigz
+           python
+           python-igraph
+           samtools
+           seqwish
+           smoothxg
+           time
+           wfmash))
+    (home-page "https://doi.org/10.1101/2023.04.05.535718")
+    (synopsis "PanGenome Graph Builder")
+    (description "pggb builds pangenome variation graphs from a set of input
+sequences using wfmash, seqwish, smoothxg, and gfaffix.")
+    (license license:expat)))
diff --git a/gn/packages/patches/seqwish-paryfor-riscv.patch b/gn/packages/patches/seqwish-paryfor-riscv.patch
new file mode 100644
index 0000000..cecf806
--- /dev/null
+++ b/gn/packages/patches/seqwish-paryfor-riscv.patch
@@ -0,0 +1,20 @@
+diff --git a/deps/paryfor/paryfor.hpp b/deps/paryfor/paryfor.hpp
+index b8ced09..0536580 100644
+--- a/deps/paryfor/paryfor.hpp
++++ b/deps/paryfor/paryfor.hpp
+@@ -51,6 +51,15 @@ static inline void spin_loop_pause() noexcept {
+ }
+ } // namespace atomic_queue
+ } // namespace paryfor
++#elif defined(__riscv) && (__riscv_xlen == 64)
++namespace paryfor {
++namespace atomic_queue {
++constexpr int CACHE_LINE_SIZE = 64;
++static inline void spin_loop_pause() noexcept {
++    asm volatile ("nop" ::: "memory");
++}
++}
++}
+ #else
+ #error "Unknown CPU architecture."
+ #endif
diff --git a/gn/packages/patches/seqwish-shared-library.patch b/gn/packages/patches/seqwish-shared-library.patch
new file mode 100644
index 0000000..be982de
--- /dev/null
+++ b/gn/packages/patches/seqwish-shared-library.patch
@@ -0,0 +1,195 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 09eafb5..a39f90f 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -7,6 +7,8 @@ project(seqwish)
+ # We build using c++14
+ set(CMAKE_CXX_STANDARD 14)
+ 
++include(GNUInstallDirs)
++
+ set(THREADS_PREFER_PTHREAD_FLAG ON)
+ find_package(Threads REQUIRED)
+ 
+@@ -26,6 +28,8 @@ if(NOT DEFINED EXTRA_FLAGS)
+           "Extra compilation flags for C and CXX." FORCE)
+ endif()
+ 
++set(SEQWISH_LINK_SHARED_LIBRARY OFF CACHE BOOL "Do not link against the libseqwish shared library")
++
+ if (${CMAKE_BUILD_TYPE} MATCHES Release)
+   set(EXTRA_FLAGS "-Ofast ${EXTRA_FLAGS}")
+   set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG") # reset CXX_FLAGS to replace -O3 with -Ofast
+@@ -82,7 +86,7 @@ include(${CMAKE_ROOT}/Modules/ExternalProject.cmake)
+ # sdsl-lite (full build using its cmake config)
+ ExternalProject_Add(sdsl-lite
+   SOURCE_DIR "${CMAKE_SOURCE_DIR}/deps/sdsl-lite"
+-  CMAKE_ARGS "${CMAKE_ARGS};-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>"
++  CMAKE_ARGS "${CMAKE_ARGS};-DCMAKE_CXX_FLAGS=-fPIC;-DCMAKE_C_FLAGS=-fPIC;-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>"
+   UPDATE_COMMAND ""
+   INSTALL_COMMAND "")
+ ExternalProject_Get_property(sdsl-lite INSTALL_DIR)
+@@ -203,27 +207,125 @@ set(mio_INCLUDE "${SOURCE_DIR}/include")
+ #set(CMAKE_BUILD_TYPE Debug)
+ set(CMAKE_BUILD_TYPE Release)
+ 
++# set up our target libraries and specify its dependencies and includes
++add_library( libseqwish_static
++  ${CMAKE_SOURCE_DIR}/src/utils.cpp
++  ${CMAKE_SOURCE_DIR}/src/tempfile.cpp
++  ${CMAKE_SOURCE_DIR}/src/main.cpp
++  ${CMAKE_SOURCE_DIR}/src/seqindex.cpp
++  ${CMAKE_SOURCE_DIR}/src/paf.cpp
++  ${CMAKE_SOURCE_DIR}/src/sxs.cpp
++  ${CMAKE_SOURCE_DIR}/src/cigar.cpp
++  ${CMAKE_SOURCE_DIR}/src/alignments.cpp
++  ${CMAKE_SOURCE_DIR}/src/pos.cpp
++  ${CMAKE_SOURCE_DIR}/src/match.cpp
++  ${CMAKE_SOURCE_DIR}/src/transclosure.cpp
++  ${CMAKE_SOURCE_DIR}/src/links.cpp
++  ${CMAKE_SOURCE_DIR}/src/compact.cpp
++  ${CMAKE_SOURCE_DIR}/src/dna.cpp
++  ${CMAKE_SOURCE_DIR}/src/gfa.cpp
++  ${CMAKE_SOURCE_DIR}/src/vgp.cpp
++  ${CMAKE_SOURCE_DIR}/src/exists.cpp
++  ${CMAKE_SOURCE_DIR}/src/time.cpp
++  ${CMAKE_SOURCE_DIR}/src/mmap.cpp
++  )
++add_dependencies(libseqwish_static tayweeargs)
++add_dependencies(libseqwish_static sdsl-lite)
++add_dependencies(libseqwish_static gzipreader)
++add_dependencies(libseqwish_static mmmulti)
++add_dependencies(libseqwish_static iitii)
++add_dependencies(libseqwish_static ips4o)
++add_dependencies(libseqwish_static bbhash)
++add_dependencies(libseqwish_static atomicbitvector)
++add_dependencies(libseqwish_static atomicqueue)
++add_dependencies(libseqwish_static ska)
++add_dependencies(libseqwish_static paryfor)
++add_dependencies(libseqwish_static mio)
++target_include_directories(libseqwish_static PUBLIC
++  "${sdsl-lite_INCLUDE}"
++  "${sdsl-lite-divsufsort_INCLUDE}"
++  "${tayweeargs_INCLUDE}"
++  "${gzipreader_INCLUDE}"
++  "${ips4o_INCLUDE}"
++  "${mmmulti_INCLUDE}"
++  "${iitii_INCLUDE}"
++  "${bbhash_INCLUDE}"
++  "${atomicbitvector_INCLUDE}"
++  "${atomicqueue_INCLUDE}"
++  "${ska_INCLUDE}"
++  "${paryfor_INCLUDE}"
++  "${mio_INCLUDE}")
++target_link_libraries(libseqwish_static
++  "${sdsl-lite_LIB}/libsdsl.a"
++  "${sdsl-lite-divsufsort_LIB}/libdivsufsort.a"
++  "${sdsl-lite-divsufsort_LIB}/libdivsufsort64.a"
++  "-latomic"
++  Threads::Threads
++  jemalloc
++  z)
++set_target_properties(libseqwish_static PROPERTIES OUTPUT_NAME "seqwish")
++
++add_library( libseqwish SHARED
++  ${CMAKE_SOURCE_DIR}/src/utils.cpp
++  ${CMAKE_SOURCE_DIR}/src/tempfile.cpp
++  ${CMAKE_SOURCE_DIR}/src/main.cpp
++  ${CMAKE_SOURCE_DIR}/src/seqindex.cpp
++  ${CMAKE_SOURCE_DIR}/src/paf.cpp
++  ${CMAKE_SOURCE_DIR}/src/sxs.cpp
++  ${CMAKE_SOURCE_DIR}/src/cigar.cpp
++  ${CMAKE_SOURCE_DIR}/src/alignments.cpp
++  ${CMAKE_SOURCE_DIR}/src/pos.cpp
++  ${CMAKE_SOURCE_DIR}/src/match.cpp
++  ${CMAKE_SOURCE_DIR}/src/transclosure.cpp
++  ${CMAKE_SOURCE_DIR}/src/links.cpp
++  ${CMAKE_SOURCE_DIR}/src/compact.cpp
++  ${CMAKE_SOURCE_DIR}/src/dna.cpp
++  ${CMAKE_SOURCE_DIR}/src/gfa.cpp
++  ${CMAKE_SOURCE_DIR}/src/vgp.cpp
++  ${CMAKE_SOURCE_DIR}/src/exists.cpp
++  ${CMAKE_SOURCE_DIR}/src/time.cpp
++  ${CMAKE_SOURCE_DIR}/src/mmap.cpp
++  ${CMAKE_SOURCE_DIR}/src/version.cpp
++  )
++add_dependencies(libseqwish tayweeargs)
++add_dependencies(libseqwish sdsl-lite)
++add_dependencies(libseqwish gzipreader)
++add_dependencies(libseqwish mmmulti)
++add_dependencies(libseqwish iitii)
++add_dependencies(libseqwish ips4o)
++add_dependencies(libseqwish bbhash)
++add_dependencies(libseqwish atomicbitvector)
++add_dependencies(libseqwish atomicqueue)
++add_dependencies(libseqwish ska)
++add_dependencies(libseqwish paryfor)
++add_dependencies(libseqwish mio)
++target_include_directories(libseqwish PUBLIC
++  "${sdsl-lite_INCLUDE}"
++  "${sdsl-lite-divsufsort_INCLUDE}"
++  "${tayweeargs_INCLUDE}"
++  "${gzipreader_INCLUDE}"
++  "${ips4o_INCLUDE}"
++  "${mmmulti_INCLUDE}"
++  "${iitii_INCLUDE}"
++  "${bbhash_INCLUDE}"
++  "${atomicbitvector_INCLUDE}"
++  "${atomicqueue_INCLUDE}"
++  "${ska_INCLUDE}"
++  "${paryfor_INCLUDE}"
++  "${mio_INCLUDE}")
++target_link_libraries(libseqwish
++  "${sdsl-lite_LIB}/libsdsl.a"
++  "${sdsl-lite-divsufsort_LIB}/libdivsufsort.a"
++  "${sdsl-lite-divsufsort_LIB}/libdivsufsort64.a"
++  "-latomic"
++  Threads::Threads
++  jemalloc
++  z)
++set_target_properties(libseqwish PROPERTIES OUTPUT_NAME "seqwish")
++
+ # set up our target executable and specify its dependencies and includes
+ add_executable(seqwish
+-  ${CMAKE_SOURCE_DIR}/src/utils.cpp
+-  ${CMAKE_SOURCE_DIR}/src/tempfile.cpp
+   ${CMAKE_SOURCE_DIR}/src/main.cpp
+-  ${CMAKE_SOURCE_DIR}/src/seqindex.cpp
+-  ${CMAKE_SOURCE_DIR}/src/paf.cpp
+-  ${CMAKE_SOURCE_DIR}/src/sxs.cpp
+-  ${CMAKE_SOURCE_DIR}/src/cigar.cpp
+-  ${CMAKE_SOURCE_DIR}/src/alignments.cpp
+-  ${CMAKE_SOURCE_DIR}/src/pos.cpp
+-  ${CMAKE_SOURCE_DIR}/src/match.cpp
+-  ${CMAKE_SOURCE_DIR}/src/transclosure.cpp
+-  ${CMAKE_SOURCE_DIR}/src/links.cpp
+-  ${CMAKE_SOURCE_DIR}/src/compact.cpp
+-  ${CMAKE_SOURCE_DIR}/src/dna.cpp
+-  ${CMAKE_SOURCE_DIR}/src/gfa.cpp
+-  ${CMAKE_SOURCE_DIR}/src/vgp.cpp
+-  ${CMAKE_SOURCE_DIR}/src/exists.cpp
+-  ${CMAKE_SOURCE_DIR}/src/time.cpp
+-  ${CMAKE_SOURCE_DIR}/src/mmap.cpp
+   ${CMAKE_SOURCE_DIR}/src/version.cpp
+   )
+ add_dependencies(seqwish tayweeargs)
+@@ -252,6 +354,11 @@ target_include_directories(seqwish PUBLIC
+   "${ska_INCLUDE}"
+   "${paryfor_INCLUDE}"
+   "${mio_INCLUDE}")
++if( SEQWISH_LINK_SHARED_LIBRARY )
++    target_link_libraries( seqwish libseqwish )
++else()
++    target_link_libraries( seqwish libseqwish_static )
++endif()
+ target_link_libraries(seqwish
+   "${sdsl-lite_LIB}/libsdsl.a"
+   "${sdsl-lite-divsufsort_LIB}/libdivsufsort.a"
+@@ -269,4 +376,6 @@ endif()
+ file(MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/include)
+ execute_process(COMMAND bash ${CMAKE_SOURCE_DIR}/scripts/generate_git_version.sh ${CMAKE_SOURCE_DIR}/include)
+ 
+-install(TARGETS seqwish DESTINATION bin)
++install(TARGETS seqwish DESTINATION "${CMAKE_INSTALL_BIDIR}")
++install(TARGETS libseqwish LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
++install(TARGETS libseqwish_static ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")