Skip to content

Commit

Permalink
Merge pull request #302 from pjotrp/main
Browse files Browse the repository at this point in the history
Guix static build for wfmash. Fixing tests and working on guix instructions/scripts
  • Loading branch information
AndreaGuarracino authored Dec 7, 2024
2 parents 643af3e + 45c34b8 commit 606f55c
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 47 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -171,11 +171,12 @@ 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(
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)
Expand Down
7 changes: 4 additions & 3 deletions CTestCustom.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CTestCustom.cmake
# Disable tests for the following modules:
set(CTEST_CUSTOM_TESTS_IGNORE
wfa2lib
)
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
62 changes: 42 additions & 20 deletions guix-static.scm
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,28 @@
;;
;; mkdir build
;; cd build
;; cmake ..
;; cmake -DBUILD_STATIC=1 ..
;; make
;;
;; For the tests you may need /usr/bin/env. Inside the container:
;;
;; 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:)
(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)
Expand All @@ -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 ''())
Expand All @@ -66,32 +84,36 @@
(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)))

wfmash-git
wfmash-git
37 changes: 17 additions & 20 deletions guix.scm
Original file line number Diff line number Diff line change
Expand Up @@ -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:
;;
Expand All @@ -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)
Expand All @@ -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)))

Expand Down

0 comments on commit 606f55c

Please sign in to comment.