about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--blist-stopiteration.patch36
-rw-r--r--gn/packages/bioinformatics.scm80
2 files changed, 116 insertions, 0 deletions
diff --git a/blist-stopiteration.patch b/blist-stopiteration.patch
new file mode 100644
index 0000000..198bef4
--- /dev/null
+++ b/blist-stopiteration.patch
@@ -0,0 +1,36 @@
+From: Andrej Shadura <andrew.shadura@collabora.co.uk>
+Date: Sun, 8 Jul 2018 09:00:16 +0200
+Subject: Catch StopIteration in a generator and return instead, per PEP 479
+
+Signed-off-by: Andrej Shadura <andrew.shadura@collabora.co.uk>
+
+Forwarded: https://github.com/DanielStutzbach/blist/pull/92
+Bug-Debian: https://bugs.debian.org/902757
+---
+ blist/_sortedlist.py | 13 ++++++++-----
+ 1 file changed, 8 insertions(+), 5 deletions(-)
+
+diff --git a/blist/_sortedlist.py b/blist/_sortedlist.py
+index b34f69e..1f77170 100644
+--- a/blist/_sortedlist.py
++++ b/blist/_sortedlist.py
+@@ -420,11 +420,14 @@ class _setmixin(object):
+     def __iter__(self):
+         it = super(_setmixin, self).__iter__()
+         while True:
+-            item = next(it)
+-            n = len(self)
+-            yield item
+-            if n != len(self):
+-                raise RuntimeError('Set changed size during iteration')
++            try:
++                item = next(it)
++                n = len(self)
++                yield item
++                if n != len(self):
++                    raise RuntimeError('Set changed size during iteration')
++            except StopIteration:
++                return
+ 
+ def safe_cmp(f):
+     def g(self, other):
diff --git a/gn/packages/bioinformatics.scm b/gn/packages/bioinformatics.scm
index 8d4edaa..391c2bf 100644
--- a/gn/packages/bioinformatics.scm
+++ b/gn/packages/bioinformatics.scm
@@ -10,6 +10,7 @@
   #:use-module (guix build-system ant)
   #:use-module (guix build-system cargo)
   #:use-module (guix build-system cmake)
+  #:use-module (guix build-system copy)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system meson)
   #:use-module (guix build-system python)
@@ -2805,3 +2806,82 @@ including @acronym{TIPP, taxonomic identical using phylogenetic placement} and
     (description "Assess genome assembly and annotation completeness with
 Benchmarking Universal Single-Copy Orthologs.")
     (license license:expat)))
+
+(define-public mutation-simulator
+  (let ((commit "9cb6bd2acf8201151bc610be14963e65b41d8899")     ; March 25, 2021
+        (revision "1"))
+    (package
+      (name "mutation-simulator")
+      (version (git-version "2.0.3" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                       (url "https://github.com/mkpython3/mutation-simulator")
+                       (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32 "1yxn5v5x804rm5ra1srmnph468yk7amsgfsj6h20rd6nmj2j0g9c"))))
+      (build-system copy-build-system)
+      (arguments
+       `(#:install-plan
+         '(("mutation-simulator.py" "bin/"))
+         #:phases
+         (modify-phases %standard-phases
+           (add-after 'install 'wrap-script
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let* ((out (assoc-ref outputs "out"))
+                      (script (string-append out "/bin/mutation-simulator.py")))
+                 ;; wrap-script doesn't accept arguments
+                 (wrap-program script
+                   `("PYTHONPATH" ":" prefix (,(getenv "PYTHONPATH"))))
+                 (chmod script #o555)
+                 ;; When using wrap-script.
+                 (when (file-exists?
+                         (string-append out "/bin/.mutation-simulator.py-real"))
+                   (chmod (string-append out "/bin/.mutation-simulator.py-real")
+                          #o555))
+                 #t)))
+           (add-after 'wrap-script 'check
+             (lambda* (#:key tests? outputs #:allow-other-keys)
+               (when tests?
+                 (invoke (string-append (assoc-ref outputs "out")
+                                        "/bin/mutation-simulator.py")
+                         "Test/test.fa" "rmt" "Test/test.rmt")))))))
+      (inputs
+       `(("bash" ,bash-minimal)                         ; for wrap-program
+         ;("guile" ,(@ (gnu packages guile) guile-3.0))  ; for wrap-script
+         ("python" ,python)
+         ("python-blist" ,python-blist)
+         ("python-pyfaidx" ,python-pyfaidx)
+         ("python-numpy" ,python-numpy)
+         ("python-tqdm" ,python-tqdm)))
+      (home-page "https://github.com/mkpython3/mutation-simulator")
+      (synopsis "Simulate mutations on given fasta files")
+      (description "Mutation-Simulator is a Python tool for simulating SNPs and
+SVs in any reference genome with cohesive documentation about implemented
+mutations.  With Mutation-Simulator, the new file format @acronym{RMT, Random
+Mutation Tables} is introduced, which gives more simulation power to the user by
+creating an interface for more natural simulations within specific genomes.
+Mutation-Simulator provides 3 different modes to simulate SNPs, insertions,
+deletions, tandem duplications, inversions, translocations and interchromosomal
+translocations from the commandline or with highly configureable RMT files.")
+      (license license:gpl3+))))
+
+(define-public python-blist
+  (package
+    (name "python-blist")
+    (version "1.3.6")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (pypi-uri "blist" version))
+        (sha256
+         (base32 "1hqz9pqbwx0czvq9bjdqjqh5bwfksva1is0anfazig81n18c84is"))
+        (patches (search-patches "blist-stopiteration.patch"))))
+    (build-system python-build-system)
+    (home-page "http://stutzbachenterprises.com/blist/")
+    (synopsis "List-like type for Python with better asymptotic performance")
+    (description
+     "This package provides a list-like type for Python with better asymptotic
+performance and similar performance on small lists.")
+    (license license:bsd-3)))