From 5cb70b0a8bd7b917b493521720a7c06c206d2ad4 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Sat, 7 Dec 2024 14:04:50 +0100 Subject: [PATCH 1/6] Fix running tests by disabling wfa2lib in CTestCustom.cmake --- CMakeLists.txt | 3 ++- CTestCustom.cmake | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b312c804..e1572c9a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,7 +87,7 @@ if (BUILD_DEPS) ExternalProject_Add(htslib URL https://github.com/samtools/htslib/releases/download/1.20/htslib-1.20.tar.bz2 PREFIX ${CMAKE_CURRENT_BINARY_DIR}/htslib - CONFIGURE_COMMAND autoreconf -i && ./configure --prefix=${CMAKE_CURRENT_BINARY_DIR}/htslib --disable-libcurl --disable-s3 + CONFIGURE_COMMAND autoreconf -i && ./configure --prefix=${CMAKE_CURRENT_BINARY_DIR}/htslib --disable-libcurl --disable-s3 BUILD_COMMAND $(MAKE) INSTALL_COMMAND $(MAKE) install BUILD_IN_SOURCE 1 @@ -171,6 +171,7 @@ target_link_libraries(wfmash Threads::Threads ) +# This is to disable tests defined in CTestCustom.cmake: configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake ${CMAKE_BINARY_DIR}) add_test( diff --git a/CTestCustom.cmake b/CTestCustom.cmake index d0e6213f..991b9e91 100644 --- a/CTestCustom.cmake +++ b/CTestCustom.cmake @@ -1,3 +1,4 @@ -CTestCustom.cmake - - +# Disable tests for the following modules: +set(CTEST_CUSTOM_TESTS_IGNORE + wfa2lib +) From 610461f650d7a4df3925c523ad2bdb2da312e92c Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Sat, 7 Dec 2024 14:25:10 +0100 Subject: [PATCH 2/6] Ignore generated file src/common/wflign/src/wflign_git_version.hpp --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 1d114bca..00340731 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,7 @@ build .\#* src/common/WFA2-lib/bin/ src/wfmash_git_version.hpp +src/common/wflign/src/wflign_git_version.hpp test/ .idea/ From dd123329d47b500746a1829457aa7ad1534733c0 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Sat, 7 Dec 2024 14:32:05 +0100 Subject: [PATCH 3/6] README: update test info and guix instructions guix.scm and guix-static.scm: comment out jemalloc dependency since we don't use it --- README.md | 6 ++++-- guix-static.scm | 6 +++--- guix.scm | 4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 7b593134..37538e80 100644 --- a/README.md +++ b/README.md @@ -208,10 +208,10 @@ This will install the `wfmash` binary and any required libraries to the default #### Tests -To build and run tests: +To build and run tests, change to build directory and ```sh -cmake --build build --target test +ctest . ``` #### Notes for distribution @@ -262,6 +262,8 @@ If you have `guix`: guix build -f guix.scm ``` +To build guix in a development container, see the instructions in the header of [guix.scm](./guix.scm). + #### Docker and Singularity images with nix Nix is also able to build an Docker image, which can then be loaded by Docker and converted to a Singularity image. diff --git a/guix-static.scm b/guix-static.scm index 797ffd93..fe30457b 100644 --- a/guix-static.scm +++ b/guix-static.scm @@ -17,7 +17,7 @@ ;; ;; mkdir -p /usr/bin ; ln -s $GUIX_ENVIRONMENT/bin/env /usr/bin/env ;; -;; by Pjotr Prins (c) 2023 +;; by Pjotr Prins (c) 2023-2024 (use-modules ((guix licenses) #:prefix license:) @@ -74,7 +74,7 @@ ;; ("clang" ,clang) ; add this to test clang builds ;; ("lld" ,lld) ; add this to test clang builds ("gcc" ,gcc-12) - ("gsl-static" ,gsl-static) + ("gsl-static" ,gsl "static") ("gmp" ,gmp) ("make" ,gnu-make) ("pkg-config" ,pkg-config) @@ -94,4 +94,4 @@ (home-page "https://github.com/waveygang/wfmash") (license license:expat))) -wfmash-git \ No newline at end of file +wfmash-git diff --git a/guix.scm b/guix.scm index ed354ee6..3105d22d 100644 --- a/guix.scm +++ b/guix.scm @@ -12,7 +12,7 @@ ;; mkdir build ;; cd build ;; cmake .. -;; make +;; make -j 12 ;; ;; For the tests you may need /usr/bin/env. Inside the container: ;; @@ -66,7 +66,7 @@ ("gmp" ,gmp) ("make" ,gnu-make) ("pkg-config" ,pkg-config) - ("jemalloc" ,jemalloc) + ; ("jemalloc" ,jemalloc) ("htslib" ,htslib) ("git" ,git) ; ("bc" ,bc) ; for tests From ccd594f73f81b0de73c35e81f627a7b823651428 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Sat, 7 Dec 2024 17:39:14 +0100 Subject: [PATCH 4/6] guix.scm: updated guix package and both building wfmash and the development container should work. See the instructions in the header. --- guix.scm | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/guix.scm b/guix.scm index 3105d22d..28210def 100644 --- a/guix.scm +++ b/guix.scm @@ -22,18 +22,16 @@ (use-modules ((guix licenses) #:prefix license:) + (guix build-system cmake) (guix gexp) - (guix packages) (guix git-download) - (guix build-system cmake) - ; (guix gexp) + (guix packages) (guix utils) (gnu packages algebra) (gnu packages base) (gnu packages bioinformatics) (gnu packages build-tools) (gnu packages compression) - ; (gnu packages curl) (gnu packages gcc) (gnu packages jemalloc) (gnu packages llvm) @@ -54,32 +52,31 @@ (define-public wfmash-git (package (name "wfmash-git") - (version (git-version "0.10.7" "HEAD" %git-commit)) + (version (git-version "0.21" "HEAD" %git-commit)) (source (local-file %source-dir #:recursive? #t)) (build-system cmake-build-system) + (arguments + `(#:tests? #f)) ; disable tests until I fix finding the binary wfmash (inputs `( - ;; ("clang" ,clang) ; add this to test clang builds - ;; ("lld" ,lld) ; add this to test clang builds + ("bzip2" ,bzip2) + ("coreutils" ,coreutils) ; for echo and env in tests ("gcc" ,gcc-12) - ("gsl" ,gsl) + ("git" ,git) ("gmp" ,gmp) + ("gsl" ,gsl) + ("htslib" ,htslib) + ("libdeflate" ,libdeflate) ("make" ,gnu-make) ("pkg-config" ,pkg-config) - ; ("jemalloc" ,jemalloc) - ("htslib" ,htslib) - ("git" ,git) - ; ("bc" ,bc) ; for tests - ("coreutils" ,coreutils) ; for echo and env in tests - ; ("curl" ,curl) - ; ("parallel" ,parallel) ; for wfmash-parallel - ("bzip2" ,bzip2) ("xz" ,xz) - ("zlib" ,zlib) - ("libdeflate" ,libdeflate))) + ("zlib" ,zlib))) (synopsis "wfmash") (description - "wfmash.") + "wfmash is an aligner for pangenomes that combines efficient homology +mapping with base-level alignment. It uses MashMap to find approximate +mappings between sequences, then applies WFA (Wave Front Alignment) to +obtain base-level alignments.") (home-page "https://github.com/waveygang/wfmash") (license license:expat))) From 1be75b6029cdd8c0e9df2698f2a707889806844b Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Sat, 7 Dec 2024 17:40:03 +0100 Subject: [PATCH 5/6] guix-static.scm: Fixed building a static wfmash binary and libs. See the header of the file for instructions. --- guix-static.scm | 58 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 40 insertions(+), 18 deletions(-) diff --git a/guix-static.scm b/guix-static.scm index fe30457b..4b9960a3 100644 --- a/guix-static.scm +++ b/guix-static.scm @@ -10,7 +10,7 @@ ;; ;; mkdir build ;; cd build -;; cmake .. +;; cmake -DBUILD_STATIC=1 .. ;; make ;; ;; For the tests you may need /usr/bin/env. Inside the container: @@ -21,18 +21,17 @@ (use-modules ((guix licenses) #:prefix license:) + (guix build-system cmake) + (guix download) (guix gexp) - (guix packages) (guix git-download) - (guix build-system cmake) - ; (guix gexp) + (guix packages) (guix utils) (gnu packages algebra) (gnu packages base) (gnu packages bioinformatics) (gnu packages build-tools) (gnu packages compression) - ; (gnu packages curl) (gnu packages gcc) (gnu packages jemalloc) (gnu packages llvm) @@ -45,12 +44,31 @@ (ice-9 popen) (ice-9 rdelim)) +(define-public libdeflate-static + (package + (inherit libdeflate) + (name "libdeflate-static") + (version "1.19") + (arguments + (list #:configure-flags + #~(list "-DLIBDEFLATE_BUILD_STATIC_LIB=YES" + "-DLIBDEFLATE_BUILD_TESTS=YES"))))) + ;; A minimal version of htslib that does not depend on curl and openssl. This ;; reduces the number of higher order dependencies in static linking. (define-public htslib-static (package (inherit htslib) (name "htslib-static") + (version "1.19") + (source (origin + (method url-fetch) + (uri (string-append + "https://github.com/samtools/htslib/releases/download/" + version "/htslib-" version ".tar.bz2")) + (sha256 + (base32 + "0dh79lwpspwwfbkmllrrhbk8nkvlfc5b5ib4d0xg5ld79w6c8lc7")))) (arguments (substitute-keyword-arguments (package-arguments htslib) ((#:configure-flags flags ''()) @@ -66,31 +84,35 @@ (define-public wfmash-git (package (name "wfmash-git") - (version (git-version "0.10.7" "HEAD" %git-commit)) + (version (git-version "0.21" "HEAD" %git-commit)) (source (local-file %source-dir #:recursive? #t)) (build-system cmake-build-system) + (arguments + `(#:configure-flags + ,#~(list "-DBUILD_STATIC=1" "-DCMAKE_INSTALL_RPATH=") ; force cmake static build and do not rewrite RPATH + #:tests? #f)) ; disable tests until I fix finding the binary wfmash (inputs `( - ;; ("clang" ,clang) ; add this to test clang builds - ;; ("lld" ,lld) ; add this to test clang builds + ("bzip2-static" ,bzip2 "static") ; libz2 part of htslib for static builds + ("coreutils" ,coreutils) ; for echo and env in tests ("gcc" ,gcc-12) - ("gsl-static" ,gsl "static") + ("git" ,git) ("gmp" ,gmp) + ("gsl-static" ,gsl "static") + ("gsl" ,gsl) + ("htslib-static" ,htslib-static) + ("jemalloc" ,jemalloc) + ("libdeflate-static" ,libdeflate-static) ("make" ,gnu-make) ("pkg-config" ,pkg-config) - ("jemalloc" ,jemalloc) - ("htslib" ,htslib-static) - ("git" ,git) - ; ("bc" ,bc) ; for tests - ("coreutils" ,coreutils) ; for echo and env in tests - ; ("curl" ,curl) - ; ("parallel" ,parallel) ; for wfmash-parallel - ("bzip2-static" ,bzip2 "static") ; libz2 part of htslib for static builds ("xz-static" ,xz "static") ; for static builds ("zlib-static" ,zlib "static"))) (synopsis "wfmash") (description - "wfmash.") + "wfmash is an aligner for pangenomes that combines efficient homology +mapping with base-level alignment. It uses MashMap to find approximate +mappings between sequences, then applies WFA (Wave Front Alignment) to +obtain base-level alignments.") (home-page "https://github.com/waveygang/wfmash") (license license:expat))) From 45c34b8d375a63d4c4ddf037cf5ef5986ce9438e Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Tue, 22 Oct 2024 17:26:50 +0100 Subject: [PATCH 6/6] do not hard-code wfmash executable cmake substitutes the correct path for executables (such as wfmash) that were declared using add_executable. Hard-coding the path to the executable in a specific build directory breaks the build for other build directories. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e1572c9a..42965998 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -176,7 +176,7 @@ configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake ${CMAKE_BINARY_DIR}) add_test( NAME wfmash-test - COMMAND ./build/bin/wfmash data/LPA.subset.fa.gz -p 80 -n 5 -t 8 + COMMAND wfmash data/LPA.subset.fa.gz -p 80 -n 5 -t 8 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) install(TARGETS wfmash DESTINATION bin)