diff --git a/pkgs/all-packages.nix b/pkgs/all-packages.nix index f5933e7..252d2fb 100644 --- a/pkgs/all-packages.nix +++ b/pkgs/all-packages.nix @@ -15,6 +15,8 @@ self: super: pkgs: with pkgs; { #firedrake = callPackage ./firedrake { }; + ghmm = callPackage ./ghmm { }; + inherit (callPackages ./octopus/libxc.nix { }) libxc301 libxc404; libxc3 = libxc301; libxc4 = libxc404; diff --git a/pkgs/ghmm/default.nix b/pkgs/ghmm/default.nix new file mode 100644 index 0000000..06f2789 --- /dev/null +++ b/pkgs/ghmm/default.nix @@ -0,0 +1,56 @@ +{ stdenv, fetchsvn, autoreconfHook, pkgconfig +, libxml2, python2Packages, swig }: + +stdenv.mkDerivation rec { + name = "ghmm-svn${version}"; + version = "2341"; + + src = fetchsvn { + url = "https://svn.code.sf.net/p/ghmm/code/trunk/ghmm"; + rev = "${version}"; + sha256 = "067anx9mhs0f4f38q4wj2fds1pkp0jcy10i0fhggvrcp31gy0329"; + }; + + #patches = [ ./static-lib-for-tools.patch ]; + postPatch = '' + sed -i -e 's,\(LDADD = .*/ghmm/\.libs/libghmm\)\.a,\1.la,' */Makefile.am + ''; + + # The python wrapper needs to be built here for dependencies + outputs = [ "out" "py" ]; + + configureFlags = [ + "--without-python" + ]; + + postBuild = '' + cd ghmmwrapper + python setup.py build + cd .. + ''; + + postInstall = '' + cd ghmmwrapper + python setup.py install --prefix="$py" + cd .. + ''; + + buildInputs = [ + autoreconfHook + pkgconfig + libxml2 + python2Packages.python + swig + ]; + + hardeningDisable = [ "format" ]; + + meta = with stdenv.lib; { + description = "The General Hidden Markov Model library (GHMM) is a freely available C library implementing efficient data structures and algorithms for basic and extended HMMs with discrete and continous emissions."; + homepage = http://ghmm.sourceforge.net; + platforms = platforms.all; + license = licenses.lgpl2Plus; + }; + + enableParallelBuilding = true; +} diff --git a/pkgs/ghmm/static-lib-for-tools.patch b/pkgs/ghmm/static-lib-for-tools.patch new file mode 100644 index 0000000..3d27614 --- /dev/null +++ b/pkgs/ghmm/static-lib-for-tools.patch @@ -0,0 +1,60 @@ +--- ghmm-r2341/ghmm/Makefile.am 1969-12-31 19:00:01.000000000 -0500 ++++ ghmm-r2341/ghmm/Makefile.am_ 2019-04-30 17:11:30.975676919 -0400 +@@ -128,6 +128,57 @@ + block_compression.c block_compression.h + + ++noinst_LIBRARIES = libghmm.a ++ ++libghmm_a_CFLAGS = $(AM_CFLAGS) ++libghmm_a_SOURCES= ghmm.h \ ++ ghmmconfig.h \ ++ rng.c rng.h \ ++ randvar.c randvar.h \ ++ matrixop.c matrixop.h \ ++ gauss_tail.c \ ++ mes.c mes.h \ ++ ghmm_internals.c ghmm_internals.h \ ++ mprintf.c mprintf.h \ ++ vector.c vector.h \ ++ matrix.c matrix.h \ ++ scanner.c scanner.h \ ++ linkedlist.c \ ++ sequence.c sequence.h \ ++ psequence.c psequence.h \ ++ xmlreader.c xmlreader.h \ ++ xmlwriter.c xmlwriter.h \ ++ model.c model.h \ ++ foba.c foba.h \ ++ viterbi.c viterbi.h \ ++ reestimate.c reestimate.h \ ++ gradescent.c gradescent.h \ ++ kbest.c kbest.h \ ++ discrime.c discrime.h \ ++ modelutil.c \ ++ cluster.c cluster.h \ ++ root_finder.c \ ++ smodel.c smodel.h \ ++ sfoba.c sfoba.h \ ++ sviterbi.c sviterbi.h \ ++ sreestimate.c sreestimate.h \ ++ scluster.c scluster.h \ ++ sgenerate.c sgenerate.h \ ++ smixturehmm.c smixturehmm.h \ ++ smap_classify.c smap_classify.h \ ++ sdmodel.c sdmodel.h \ ++ sdfoba.c sdfoba.h \ ++ sdviterbi.c \ ++ pmodel.c pmodel.h \ ++ pviterbi.c pviterbi.h \ ++ pviterbi_propagate.c pviterbi_propagate.h \ ++ fbgibbs.c fbgibbs.h \ ++ cfbgibbs.c cfbgibbs.h \ ++ bayesian_hmm.c bayesian_hmm.h \ ++ continuous_fbgibbs.c continuous_fbgibbs.h \ ++ block_compression.c block_compression.h ++ ++ + pkginclude_HEADERS = ghmm.h \ + ghmmconfig.h \ + sequence.h \ diff --git a/pkgs/python-packages.nix b/pkgs/python-packages.nix index 37223dd..66e42ad 100644 --- a/pkgs/python-packages.nix +++ b/pkgs/python-packages.nix @@ -1,5 +1,7 @@ pkgs: self: super: with self; { + ghmm = disabledIf isPy3k ( toPythonModule (pkgs.ghmm.override { python2Packages=self; }) ).py; + openslide = callPackage ./openslide/python.nix { openslide = pkgs.openslide; }; pybedtools = callPackage ./pybedtools.nix { };