gnu: Add python2-pysnptools.
[jackhill/guix/guix.git] / gnu / packages / python.scm
index 9b4f6b6..7ddfcc6 100644 (file)
@@ -207,7 +207,9 @@ data types.")
               (method url-fetch)
               (uri (string-append "https://www.python.org/ftp/python/"
                                   version "/Python-" version ".tar.xz"))
-              (patches (list (search-patch "python-fix-tests.patch")))
+              (patches (list (search-patch "python-fix-tests.patch")
+                             ;; XXX Try removing this patch for python > 3.4.3
+                             (search-patch "python-disable-ssl-test.patch")))
               (patch-flags '("-p0"))
               (sha256
                (base32
@@ -2066,7 +2068,7 @@ sources.")
 (define-public python-scikit-learn
   (package
     (name "python-scikit-learn")
-    (version "0.15.2")
+    (version "0.16.1")
     (source
      (origin
        (method url-fetch)
@@ -2075,40 +2077,27 @@ sources.")
              version ".tar.gz"))
        (sha256
         (base32
-         "1rb93h2q15f219sz60sczjb65rg70xjmnp0q4pkkaairx5s05q55"))))
+         "140skabifgc7lvvj873pnzlwx0ni6q8qkrsyad2ccjb3h8rxzkih"))))
     (build-system python-build-system)
     (arguments
      `(#:phases
        (alist-cons-before
-        'build 'set-environment-variables
-        (lambda* (#:key inputs #:allow-other-keys)
-          (let* ((atlas-threaded
-                  (string-append (assoc-ref inputs "atlas")
-                                 "/lib/libtatlas.so"))
-                 ;; On single core CPUs only the serial library is created.
-                 (atlas-lib
-                  (if (file-exists? atlas-threaded)
-                      atlas-threaded
-                      (string-append (assoc-ref inputs "atlas")
-                                     "/lib/libsatlas.so"))))
-            (setenv "ATLAS" atlas-lib)))
-        (alist-cons-before
-         'check 'set-HOME
-         ;; some tests require access to "$HOME"
-         (lambda _ (setenv "HOME" "/tmp"))
-         ;; Tests can only be run after the library has been installed and not
-         ;; within the source directory.
-         (alist-cons-after
-          'install 'check
-          (lambda _
-            (with-directory-excursion "/tmp"
-              ;; With Python 3 one test of 3334 fails
-              ;; (sklearn.tests.test_common.test_transformers); see
-              ;; https://github.com/scikit-learn/scikit-learn/issues/3693
-              (system* "nosetests" "-v" "sklearn")))
-          (alist-delete 'check %standard-phases))))))
+        'check 'set-HOME
+        ;; some tests require access to "$HOME"
+        (lambda _ (setenv "HOME" "/tmp"))
+        ;; Tests can only be run after the library has been installed and not
+        ;; within the source directory.
+        (alist-cons-after
+         'install 'check
+         (lambda _
+           (with-directory-excursion "/tmp"
+             ;; With Python 3 one test of 3334 fails
+             ;; (sklearn.tests.test_common.test_transformers); see
+             ;; https://github.com/scikit-learn/scikit-learn/issues/3693
+             (system* "nosetests" "-v" "sklearn")))
+         (alist-delete 'check %standard-phases)))))
     (inputs
-     `(("atlas" ,atlas)
+     `(("openblas" ,openblas)
        ("python-nose" ,python-nose)))
     (propagated-inputs
      `(("python-numpy" ,python-numpy)
@@ -2283,24 +2272,37 @@ writing C extensions for Python as easy as Python itself.")
     (build-system python-build-system)
     (inputs
      `(("python-nose" ,python-nose)
-       ("atlas" ,atlas)))
+       ("openblas" ,openblas)
+       ("lapack" ,lapack)))
     (native-inputs
-     `(("gfortran" ,gfortran-4.8)))
+     `(("gfortran" ,gfortran)))
     (arguments
      `(#:phases
        (alist-cons-before
         'build 'set-environment-variables
         (lambda* (#:key inputs #:allow-other-keys)
-          (let* ((atlas-threaded
-                  (string-append (assoc-ref inputs "atlas")
-                                 "/lib/libtatlas.so"))
-                 ;; On single core CPUs only the serial library is created.
-                 (atlas-lib
-                  (if (file-exists? atlas-threaded)
-                      atlas-threaded
-                      (string-append (assoc-ref inputs "atlas")
-                                     "/lib/libsatlas.so"))))
-            (setenv "ATLAS" atlas-lib)))
+          (call-with-output-file "site.cfg"
+            (lambda (port)
+              (format port
+                      "[openblas]
+libraries = openblas
+library_dirs = ~a/lib
+include_dirs = ~a/include
+
+[lapack]
+lapack_libs = lapack
+library_dirs = ~a/lib
+include_dirs = ~a/include
+"
+                      (assoc-ref inputs "openblas")
+                      (assoc-ref inputs "openblas")
+                      (assoc-ref inputs "lapack")
+                      (assoc-ref inputs "lapack"))))
+          ;; Use "gcc" executable, not "cc".
+          (substitute* "numpy/distutils/system_info.py"
+            (("c = distutils\\.ccompiler\\.new_compiler\\(\\)")
+             "c = distutils.ccompiler.new_compiler(); c.set_executables(compiler='gcc',compiler_so='gcc',linker_exe='gcc',linker_so='gcc -shared')"))
+          #t)
         ;; Tests can only be run after the library has been installed and not
         ;; within the source directory.
         (alist-cons-after
@@ -2596,6 +2598,39 @@ toolkits.")
                                        (package-propagated-inputs
                                         matplotlib))))))))
 
+(define-public python2-pysnptools
+  (package
+    (name "python2-pysnptools")
+    (version "0.2.13")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "https://pypi.python.org/packages/source/p/pysnptools"
+             "/pysnptools-" version ".zip"))
+       (sha256
+        (base32
+         "1rzf5qvwfvd2pp84b14pb2gdvxdk5avnj7rb41ac8gndpkr9g6ib"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:python ,python-2)) ; only Python 2.7 is supported
+    (propagated-inputs
+     `(("python2-numpy" ,python2-numpy)
+       ("python2-scipy" ,python2-scipy)
+       ("python2-pandas" ,python2-pandas)
+       ("python2-cython" ,python2-cython)))
+    (native-inputs
+     `(("unzip" ,unzip)
+       ("python2-setuptools" ,python2-setuptools)))
+    (home-page "http://research.microsoft.com/en-us/um/redmond/projects/mscompbio/")
+    (synopsis "Library for reading and manipulating genetic data")
+    (description
+     "PySnpTools is a library for reading and manipulating genetic data.  It
+can, for example, efficiently read whole PLINK *.bed/bim/fam files or parts of
+those files.  It can also efficiently manipulate ranges of integers using set
+operators such as union, intersection, and difference.")
+    (license asl2.0)))
+
 (define-public python-scipy
   (package
     (name "python-scipy")
@@ -2615,27 +2650,33 @@ toolkits.")
        ("python-pyparsing" ,python-pyparsing)
        ("python-nose" ,python-nose)
        ("python-sphinx" ,python-sphinx)
-       ("atlas" ,atlas)))
+       ("lapack" ,lapack)
+       ("openblas" ,openblas)))
     (native-inputs
-     `(("gfortran" ,gfortran-4.8)
+     `(("gfortran" ,gfortran)
        ("texlive" ,texlive)
        ("perl" ,perl)))
     (outputs '("out" "doc"))
     (arguments
      `(#:phases
        (alist-cons-before
-        'build 'set-environment-variables
+        'build 'configure-openblas
         (lambda* (#:key inputs #:allow-other-keys)
-          (let* ((atlas-threaded
-                  (string-append (assoc-ref inputs "atlas")
-                                 "/lib/libtatlas.so"))
-                 ;; On single core CPUs only the serial library is created.
-                 (atlas-lib
-                  (if (file-exists? atlas-threaded)
-                      atlas-threaded
-                      (string-append (assoc-ref inputs "atlas")
-                                     "/lib/libsatlas.so"))))
-            (setenv "ATLAS" atlas-lib)))
+          (call-with-output-file "site.cfg"
+            (lambda (port)
+              (format port
+                      "[blas]
+libraries = openblas
+library_dirs = ~a/lib
+include_dirs = ~a/include
+[atlas]
+library_dirs = ~a/lib
+atlas_libs = openblas
+"
+                      (assoc-ref inputs "openblas")
+                      (assoc-ref inputs "openblas")
+                      (assoc-ref inputs "openblas"))))
+          #t)
         (alist-cons-after
          'install 'install-doc
          (lambda* (#:key outputs #:allow-other-keys)
@@ -2788,7 +2829,7 @@ services for your Python modules and applications.")
 (define-public python-pillow
   (package
     (name "python-pillow")
-    (version "2.6.1")
+    (version "2.8.1")
     (source
      (origin
        (method url-fetch)
@@ -2796,17 +2837,19 @@ services for your Python modules and applications.")
                            "Pillow/Pillow-" version ".tar.gz"))
        (sha256
         (base32
-         "0iw36c73wkhz88wa78v6l43llsb080ihw8yq7adhfqxdib7l4hzr"))))
+         "15n92axxph2s3kvg68bki9gv3nzwgq7130kp7wbblpi1l0cc2q47"))))
     (build-system python-build-system)
     (native-inputs
      `(("python-setuptools" ,python-setuptools)
        ("python-nose"       ,python-nose)))
     (inputs
-     `(("lcms"     ,lcms)
+     `(("freetype" ,freetype)
+       ("lcms"     ,lcms)
        ("zlib"     ,zlib)
        ("libjpeg"  ,libjpeg)
        ("openjpeg" ,openjpeg)
-       ("libtiff"  ,libtiff)))
+       ("libtiff"  ,libtiff)
+       ("libwebp"  ,libwebp)))
     (propagated-inputs
      `(;; Used at runtime for pkg_resources
        ("python-setuptools" ,python-setuptools)))
@@ -3360,43 +3403,6 @@ libxml2 and libxslt.")
 (define-public python2-lxml
   (package-with-python2 python-lxml))
 
-(define-public python-pillow
-  (package
-    (name "python-pillow")
-    (version "2.7.0")
-    (source
-      (origin
-        (method url-fetch)
-        (uri (string-append
-              "https://pypi.python.org/packages/source/P/Pillow/Pillow-"
-              version
-              ".tar.gz"))
-        (sha256
-          (base32
-            "1y0rysgd7vqpl5lh0lsra7j2k30azwxqlh5jnqk1i0pmfc735s96"))))
-    (build-system python-build-system)
-    (inputs
-      `(("freetype" ,freetype)
-        ("lcms" ,lcms)
-        ("libjpeg" ,libjpeg)
-        ("libtiff" ,libtiff)
-        ("openjpeg" ,openjpeg)
-        ("python-setuptools" ,python-setuptools)
-        ("zlib" ,zlib)))
-    (arguments
-     `(#:tests? #f)) ; no check target
-    (home-page "http://python-pillow.github.io/")
-    (synopsis "Pillow fork of Python Imaging Library")
-    (description "Pillow is a fork of the Python Imaging Library (PIL).")
-    ;; PIL license, see
-    ;; http://www.pythonware.com/products/pil/license.htm
-    (license (x11-style
-               "file://PKG-INFO"
-               "See http://www.pythonware.com/products/pil/license.htm"))))
-
-(define-public python2-pillow
-  (package-with-python2 python-pillow))
-
 (define-public python2-pil
   (package
     (name "python2-pil")