From c35f615aea0cbfcbed0cc7c0fde1fc46f7d3edd3 Mon Sep 17 00:00:00 2001 From: Alexis Praga Date: Fri, 19 Apr 2024 15:10:26 +0200 Subject: [PATCH] dragmap: init at 1.3.0 Genomic mapper. Open-source version of DRAGEN. Tests are run during execution with google-tests. --- pkgs/by-name/dr/dragmap/cstdint.patch | 60 +++++++++++++++++++ pkgs/by-name/dr/dragmap/package.nix | 68 ++++++++++++++++++++++ pkgs/by-name/dr/dragmap/stdio-pclose.patch | 12 ++++ 3 files changed, 140 insertions(+) create mode 100644 pkgs/by-name/dr/dragmap/cstdint.patch create mode 100644 pkgs/by-name/dr/dragmap/package.nix create mode 100644 pkgs/by-name/dr/dragmap/stdio-pclose.patch diff --git a/pkgs/by-name/dr/dragmap/cstdint.patch b/pkgs/by-name/dr/dragmap/cstdint.patch new file mode 100644 index 000000000000..b9b0721173d7 --- /dev/null +++ b/pkgs/by-name/dr/dragmap/cstdint.patch @@ -0,0 +1,60 @@ +diff --git a/src/include/map/SeedPosition.hpp b/src/include/map/SeedPosition.hpp +index 30a7d47..c05af16 100644 +--- a/src/include/map/SeedPosition.hpp ++++ b/src/include/map/SeedPosition.hpp +@@ -16,6 +16,7 @@ + #define MAP_SEED_POSITION_HPP + + #include ++#include + + #include "sequences/Seed.hpp" + +diff --git a/src/include/sequences/Read.hpp b/src/include/sequences/Read.hpp +index 460c1cb..c7ff619 100644 +--- a/src/include/sequences/Read.hpp ++++ b/src/include/sequences/Read.hpp +@@ -16,6 +16,7 @@ + #define SEQUENCES_READ_HPP + + #include ++#include + #include + #include + +diff --git a/src/include/sequences/Seed.hpp b/src/include/sequences/Seed.hpp +index a242153..dd4d23b 100644 +--- a/src/include/sequences/Seed.hpp ++++ b/src/include/sequences/Seed.hpp +@@ -16,6 +16,7 @@ + #define SEQUENCES_SEED_HPP + + #include ++#include + #include + + #include "sequences/Read.hpp" +diff --git a/src/lib/sequences/tests/unit/CrcHasherMocks.hpp b/src/lib/sequences/tests/unit/CrcHasherMocks.hpp +index 1866be7..5d9b7d7 100644 +--- a/src/lib/sequences/tests/unit/CrcHasherMocks.hpp ++++ b/src/lib/sequences/tests/unit/CrcHasherMocks.hpp +@@ -2,6 +2,7 @@ + + #include + #include ++#include + #include + #include + +diff --git a/stubs/dragen/src/host/dragen_api/read_group_list.hpp b/stubs/dragen/src/host/dragen_api/read_group_list.hpp +index eefb9ae..623a77f 100644 +--- a/stubs/dragen/src/host/dragen_api/read_group_list.hpp ++++ b/stubs/dragen/src/host/dragen_api/read_group_list.hpp +@@ -14,6 +14,7 @@ + #define __READ_GROUP_LIST_HPP__ + + #include "dragen_exception.hpp" ++#include + class ReadGroupList { + public: + const std::string &getReadGroupName(const uint16_t idx) const { diff --git a/pkgs/by-name/dr/dragmap/package.nix b/pkgs/by-name/dr/dragmap/package.nix new file mode 100644 index 000000000000..9f61cbb3e5e4 --- /dev/null +++ b/pkgs/by-name/dr/dragmap/package.nix @@ -0,0 +1,68 @@ +{ + lib, + stdenv, + fetchFromGitHub, + boost, + gtest, + zlib, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "dragmap"; + version = "1.3.0"; + + src = fetchFromGitHub { + owner = "Illumina"; + repo = "DRAGMAP"; + rev = finalAttrs.version; + fetchSubmodules = true; + hash = "sha256-f1jsOErriS1I/iUS4CzJ3+Dz8SMUve/ccb3KaE+L7U8="; + }; + + nativebuildInputs = [ boost ]; + buildInputs = [ + gtest + zlib + ]; + + patches = [ + # pclose is called on a NULL value. This is no longer allowed since + # https://github.com/bminor/glibc/commit/64b1a44183a3094672ed304532bedb9acc707554 + ./stdio-pclose.patch + + # Add missing include cstdint. Upstream does not accept PR. Issue opened at + # https://github.com/Illumina/DRAGMAP/issues/63 + ./cstdint.patch + ]; + + env = { + GTEST_INCLUDEDIR = "${gtest.dev}/include"; + CPPFLAGS = "-I ${boost.dev}/include"; + LDFLAGS = "-L ${boost.out}/lib"; + }; + + installPhase = '' + runHook preInstall + + mkdir -p $out/bin + cp build/release/dragen-os $out/bin/ + + runHook postInstall + ''; + + # Tests are launched by default from makefile + doCheck = false; + + meta = with lib; { + description = "Open Source version of Dragen mapper for genomics"; + mainProgram = "dragen-os"; + longDescription = '' + DRAGMAP is an open-source software implementation of the DRAGEN mapper, + which the Illumina team created to procude the same results as their + proprietary DRAGEN hardware. + ''; + license = licenses.gpl3; + platforms = platforms.unix; + maintainers = with maintainers; [ apraga ]; + }; +}) diff --git a/pkgs/by-name/dr/dragmap/stdio-pclose.patch b/pkgs/by-name/dr/dragmap/stdio-pclose.patch new file mode 100644 index 000000000000..74e8d57e9fa5 --- /dev/null +++ b/pkgs/by-name/dr/dragmap/stdio-pclose.patch @@ -0,0 +1,12 @@ +diff --git a/stubs/dragen/src/host/infra/linux/infra_linux_utils.cpp b/stubs/dragen/src/host/infra/linux/infra_linux_utils.cpp +index cd02cd4..c26e9cf 100644 +--- a/stubs/dragen/src/host/infra/linux/infra_linux_utils.cpp ++++ b/stubs/dragen/src/host/infra/linux/infra_linux_utils.cpp +@@ -57,7 +57,6 @@ int GetDmiValue(const std::string& label, std::string& value) + FILE* dmiOutput = popen("sudo /usr/sbin/dmidecode -t 2", "r"); + if (dmiOutput == NULL) { + perror("dmidecode popen"); +- pclose(dmiOutput); + return -1; + } +