Merge pull request #107268 from rmcgibbo/rdkit

This commit is contained in:
Sandro 2021-02-04 20:18:00 +01:00 committed by GitHub
commit 70d71ec338
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 242 additions and 4 deletions

View File

@ -0,0 +1,29 @@
{ fetchFromGitHub
, lib
, stdenv
, boost
, zlib
, cmake
, maeparser
}:
stdenv.mkDerivation rec {
pname = "coordgenlibs";
version = "1.4.2";
src = fetchFromGitHub {
owner = "schrodinger";
repo = pname;
rev = "v${version}";
sha256 = "18s3y9v6x246hapxy0cy4srnll4qqzqfx003j551l5f27b2ng8fn";
};
nativeBuildInputs = [ cmake ];
buildInputs = [ boost zlib maeparser ];
meta = with lib; {
description = "Schrodinger-developed 2D Coordinate Generation";
maintainers = [ maintainers.rmcgibbo ];
license = licenses.bsd3;
};
}

View File

@ -1,4 +1,11 @@
{ pkgs, fetchurl, lib, stdenv, unzip }: { pkgs
, fetchurl
, lib
, stdenv
, unzip
, fixDarwinDylibNames
}:
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "inchi"; pname = "inchi";
version = "1.05"; version = "1.05";
@ -7,15 +14,23 @@ stdenv.mkDerivation {
sha1 = "e3872a46d58cb321a98f4fd4b93a989fb6920b9c"; sha1 = "e3872a46d58cb321a98f4fd4b93a989fb6920b9c";
}; };
nativeBuildInputs = [ pkgs.unzip ]; nativeBuildInputs = [ unzip ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
outputs = [ "out" "doc" ]; outputs = [ "out" "doc" ];
enableParallelBuilding = true; enableParallelBuilding = true;
preBuild = '' preConfigure = ''
cd ./INCHI_API/libinchi/gcc cd ./INCHI_API/libinchi/gcc
'' + lib.optionalString stdenv.isDarwin ''
substituteInPlace makefile \
--replace ",--version-script=libinchi.map" "" \
--replace "LINUX_Z_RELRO = ,-z,relro" "" \
--replace "-soname" "-install_name" \
--replace "gcc" $CC
''; '';
installPhase = '' installPhase = ''
runHook preInstall
cd ../../.. cd ../../..
mkdir -p $out/lib mkdir -p $out/lib
mkdir -p $out/include/inchi mkdir -p $out/include/inchi
@ -29,6 +44,10 @@ stdenv.mkDerivation {
runHook postInstall runHook postInstall
''; '';
preFixup = lib.optionalString stdenv.isDarwin ''
fixDarwinDylibNames $(find "$out" -name "*.so.*")
'';
postInstall = postInstall =
let let
src-doc = fetchurl { src-doc = fetchurl {
@ -45,7 +64,6 @@ stdenv.mkDerivation {
homepage = "https://www.inchi-trust.org/"; homepage = "https://www.inchi-trust.org/";
description = "IUPAC International Chemical Identifier library"; description = "IUPAC International Chemical Identifier library";
license = licenses.lgpl2Plus; license = licenses.lgpl2Plus;
platforms = platforms.all;
maintainers = with maintainers; [ rmcgibbo ]; maintainers = with maintainers; [ rmcgibbo ];
}; };
} }

View File

@ -0,0 +1,28 @@
{ fetchFromGitHub
, lib
, stdenv
, boost
, zlib
, cmake
}:
stdenv.mkDerivation rec {
pname = "maeparser";
version = "1.2.4";
src = fetchFromGitHub {
owner = "schrodinger";
repo = "maeparser";
rev = "v${version}";
sha256 = "1qzp8d58ksy88y4fx1b0x65wycslm7zxzbb8ns28gkjh12xpzhwz";
};
nativeBuildInputs = [ cmake ];
buildInputs = [ boost zlib ];
meta = with lib; {
description = "maestro file parser";
maintainers = [ maintainers.rmcgibbo ];
license = licenses.mit;
};
}

View File

@ -0,0 +1,157 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, fetchzip
, cmake
, boost
, catch
, inchi
, cairo
, eigen
, python
, rapidjson
, maeparser
, coordgenlibs
, numpy
, pandas
, pillow
, git
}:
let
external = {
avalon = fetchzip {
url = "http://sourceforge.net/projects/avalontoolkit/files/AvalonToolkit_1.2/AvalonToolkit_1.2.0.source.tar";
sha256 = "0nhxfxckb5a5qs0g148f55yarhncqjgjzcvdskkv9rxi2nrs7160";
stripRoot = false;
};
yaehmop = fetchFromGitHub {
owner = "greglandrum";
repo = "yaehmop";
rev = "1b13b52e2738a77715b1bad876e3b4e93f2b5269";
sha256 = "1jp7wz8win4mgwxkaz2gnrgsaaqgln04n2lwgfr96isdv1klf62d";
};
freesasa = fetchFromGitHub
{
owner = "mittinatten";
repo = "freesasa";
rev = "2.0.3";
sha256 = "0x686zm9fpyg5647fdgxnxgbwav99nc6ymh4bmkr2063yyda4kzc";
};
};
in
buildPythonPackage rec {
version = "2020.09.3";
pname = "rdkit";
src =
let
versionTag = lib.replaceStrings [ "." ] [ "_" ] version;
in
fetchFromGitHub {
owner = pname;
repo = pname;
rev = "Release_${versionTag}";
sha256 = "1k1wvzcd1yfx4nhz3iq2aaadzdk5w6sfcb4imhvm7pkbzij0nicx";
};
unpackPhase = ''
mkdir -p source/External/AvalonTools/avalon source/External/YAeHMOP/yaehmop source/External/FreeSASA/freesasa
cp -r ${src}/* source
cp -r ${external.avalon}/SourceDistribution/* source/External/AvalonTools/avalon
cp -r ${external.yaehmop}/* source/External/YAeHMOP/yaehmop
cp -r ${external.freesasa}/* source/External/FreeSASA/freesasa
find source -type d -exec chmod 755 {} +
cp source/External/FreeSASA/freesasa2.c source/External/FreeSASA/freesasa/src
ln -s ${rapidjson} source/External/rapidjson-1.1.0
'';
sourceRoot = "source";
nativeBuildInputs = [
cmake
git # required by freesasa
];
buildInputs = [
boost
catch
inchi
eigen
cairo
rapidjson
];
propagatedBuildInputs = [
numpy
pandas
pillow
];
hardeningDisable = [ "format" ]; # required by yaehmop
# doCheck = false;
dontUseSetuptoolsBuild = true;
dontUsePipInstall = true;
dontUseSetuptoolsCheck = true;
preConfigure = ''
# Don't want this contacting the git remote during the build
substituteInPlace External/YAeHMOP/CMakeLists.txt --replace \
'GIT_TAG master' 'DOWNLOAD_COMMAND true'
# Since we can't expand with bash in cmakeFlags
cmakeFlags="$cmakeFlags -DPYTHON_NUMPY_INCLUDE_PATH=$(${python}/bin/python -c 'import numpy; print(numpy.get_include())')"
cmakeFlags="$cmakeFlags -DFREESASA_DIR=$PWD/External/FreeSASA/freesasa"
cmakeFlags="$cmakeFlags -DFREESASA_SRC_DIR=$PWD/External/FreeSASA/freesasa"
cmakeFlags="$cmakeFlags -DAVALONTOOLS_DIR=$PWD/External/AvalonTools/avalon"
'';
cmakeFlags = [
"-DCATCH_DIR=${catch}/include/catch"
"-DINCHI_LIBRARY=${inchi}/lib/libinchi.so"
"-DINCHI_LIBRARIES=${inchi}/lib/libinchi.so"
"-DINCHI_INCLUDE_DIR=${inchi}/include/inchi"
"-DEIGEN3_INCLUDE_DIR=${eigen}/include/eigen3"
"-DRDK_INSTALL_INTREE=OFF"
"-DRDK_INSTALL_STATIC_LIBS=OFF"
"-DRDK_BUILD_INCHI_SUPPORT=ON"
"-DRDK_BUILD_AVALON_SUPPORT=ON"
"-DRDK_BUILD_FREESASA_SUPPORT=ON"
"-DRDK_BUILD_YAEHMOP_SUPPORT=ON"
"-DRDK_BUILD_MAEPARSER_SUPPORT=ON"
"-DMAEPARSER_DIR=${maeparser}"
"-DRDK_BUILD_COORDGEN_SUPPORT=ON"
"-DCOORDGEN_DIR=${coordgenlibs}"
"-DRDK_USE_URF=OFF"
"-DRDK_USE_FLEXBISON=OFF"
"-DRDK_BUILD_CAIRO_SUPPORT=ON"
"-DRDK_BUILD_THREADSAFE_SSS=ON"
"-DRDK_TEST_MULTITHREADED=ON"
"-DRDK_BUILD_CPP_TESTS=ON"
"-DRDK_TEST_MULTITHREADED=ON"
"-DPYTHON_EXECUTABLE=${python}/bin/python"
"-DBOOST_ROOT=${boost}"
"-DBoost_NO_SYSTEM_PATHS=ON"
"-DBoost_NO_BOOST_CMAKE=TRUE"
];
checkPhase = ''
export QT_QPA_PLATFORM='offscreen'
export RDBASE=$(realpath ..)
export PYTHONPATH="$out/lib/${python.libPrefix}/site-packages:$PYTHONPATH"
(cd $RDBASE/rdkit/Chem && python $RDBASE/rdkit/TestRunner.py test_list.py)
'';
pythonImportsCheck = [
"rdkit"
"rdkit.Chem"
"rdkit.Chem.AllChem"
];
meta = with lib; {
description = "Open source toolkit for cheminformatics";
maintainers = [ maintainers.rmcgibbo ];
license = licenses.bsd3;
homepage = "https://www.rdkit.org";
};
}

View File

@ -218,6 +218,8 @@ in
containerpilot = callPackage ../applications/networking/cluster/containerpilot { }; containerpilot = callPackage ../applications/networking/cluster/containerpilot { };
coordgenlibs = callPackage ../development/libraries/coordgenlibs { };
cp437 = callPackage ../tools/misc/cp437 { }; cp437 = callPackage ../tools/misc/cp437 { };
cpu-x = callPackage ../applications/misc/cpu-x { }; cpu-x = callPackage ../applications/misc/cpu-x { };
@ -6061,6 +6063,8 @@ in
madlang = haskell.lib.justStaticExecutables haskellPackages.madlang; madlang = haskell.lib.justStaticExecutables haskellPackages.madlang;
maeparser = callPackage ../development/libraries/maeparser { };
mailcheck = callPackage ../applications/networking/mailreaders/mailcheck { }; mailcheck = callPackage ../applications/networking/mailreaders/mailcheck { };
maildrop = callPackage ../tools/networking/maildrop { }; maildrop = callPackage ../tools/networking/maildrop { };

View File

@ -6657,6 +6657,8 @@ in {
rdflib-jsonld = callPackage ../development/python-modules/rdflib-jsonld { }; rdflib-jsonld = callPackage ../development/python-modules/rdflib-jsonld { };
rdkit = callPackage ../development/python-modules/rdkit { };
re-assert = callPackage ../development/python-modules/re-assert { }; re-assert = callPackage ../development/python-modules/re-assert { };
readchar = callPackage ../development/python-modules/readchar { }; readchar = callPackage ../development/python-modules/readchar { };