Subject: [PATCH] gnu: Add mashmap.

From: gemmaro <[email-masked]>
Date: Fri, 7 Jun 2024 22:38:32 +0900

* gnu/packages/bioinformatics.scm (mashmap): New variable.

Change-Id: I38f984b308db0a3a5756852cd89de25ae0875f76
---
 gnu/packages/bioinformatics.scm | 68 +++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index cecd94bbb7..d12ec9a249 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -26,6 +26,7 @@
 ;;; Copyright © 2022, 2023 Navid Afkhami <[email-masked]>
 ;;; Copyright © 2022 Antero Mejr <[email-masked]>
 ;;; Copyright © 2024 Alexis Simon <[email-masked]>
+;;; Copyright © 2024 gemmaro <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -172,6 +173,7 @@ (define-module (gnu packages bioinformatics)
   #:use-module (gnu packages wget)
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg)
+  #:use-module (gnu packages xdisorg)
   #:use-module (guix platform)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26)
@@ -22617,6 +22619,72 @@ (define-public hh-suite
 based on the pairwise alignment of hidden Markov models (HMMs).")
     (license license:gpl3+)))
 
+(define-public mashmap
+  (package
+    (name "mashmap")
+    (version "3.1.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/marbl/MashMap")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0iqgcx5jk6asihdvzv2sa5v373y9k9fsd2a2in25ragil8z8nckp"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      #:phases #~(modify-phases %standard-phases
+                   (add-after 'unpack 'fix-paths
+                     (lambda* (#:key inputs #:allow-other-keys)
+                       (let ((gnuplot (string-append (assoc-ref inputs
+                                                                "gnuplot")
+                                                     "/bin/gnuplot"))
+                             (xclip (string-append (assoc-ref inputs "xclip")
+                                                   "/bin/xclip")))
+                         (substitute* "scripts/generateDotPlot"
+                           (("gnuplot --version")
+                            (string-append gnuplot " --version"))
+                           (("my \\$cmd = \"gnuplot\";")
+                            (string-append "my $cmd = \"" gnuplot "\";"))
+                           (("xclip -o")
+                            (string-append xclip " -o"))))))
+                   (replace 'check
+                     (lambda* (#:key tests? #:allow-other-keys)
+                       (if tests?
+                           (begin
+                             (invoke "../build/bin/mashmap"
+                                     "-r" "../source/data/scerevisiae8.fa.gz"
+                                     "-q" "../source/data/scerevisiae8.fa.gz"
+                                     "--pi" "95"
+                                     "-n" "1"
+                                     "-Y" "#"
+                                     "-o" "scerevisiae8.paf")
+                             (invoke "../source/scripts/test.sh"
+                                     "../source/data/scerevisiae8.fa.gz.fai"
+                                     "scerevisiae8.paf" "0.92")))))
+                   (add-after 'install 'install-script
+                     (lambda* (#:key outputs #:allow-other-keys)
+                       (let ((out (assoc-ref outputs "out")))
+                         (install-file "../source/scripts/generateDotPlot"
+                                       (string-append out "/share/mashmap"))))))))
+    (native-inputs (list bedtools util-linux))
+    (inputs (list gsl
+                  zlib
+                  htslib
+                  perl
+                  gnuplot
+                  xclip))
+    (home-page "https://github.com/marbl/MashMap")
+    (synopsis "Fast approximate aligner for long DNA sequences")
+    (description
+     "MashMap implements a fast and approximate algorithm for computing
+local alignment boundaries between long DNA sequences.  It can be
+useful for mapping genome assembly or long reads (PacBio/ONT) to
+reference genome(s).")
+    (license license:public-domain)))
+
 (define-public wfmash
   (package
     (name "wfmash")

base-commit: 580d77d0fb12448ef1621699cc0c56e787e2aadb
-- 
2.45.1