mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-07 22:44:25 +08:00
Merge pull request #612 from bp-kelley/dev/filter-catalog-java-wrapper
Dev/filter catalog java wrapper
This commit is contained in:
@@ -1,12 +1,24 @@
|
||||
find_package(SWIG REQUIRED)
|
||||
include(${SWIG_USE_FILE})
|
||||
|
||||
set(T_LIBS ${Boost_LIBRARIES})
|
||||
find_package(Boost 1.39.0 COMPONENTS serialization)
|
||||
if (Boost_SERIALIZATION_LIBRARY)
|
||||
# don't add the boost serialization definitions, swig can't compile the
|
||||
# headers. Hopefully it will stil link and run...
|
||||
set(Boost_LIBRARIES ${T_LIBS} ${Boost_LIBRARIES})
|
||||
else()
|
||||
endif()
|
||||
|
||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
SET(CMAKE_SWIG_FLAGS "")
|
||||
|
||||
if(WIN32)
|
||||
set(RDKit_Wrapper_Libs
|
||||
FilterCatalog
|
||||
Catalogs
|
||||
${Boost_SERIALIZATION_LIBRARY}
|
||||
FMCS MolDraw2D
|
||||
FileParsers SmilesParse
|
||||
Depictor SubstructMatch ChemReactions Fingerprints ChemTransforms
|
||||
@@ -27,6 +39,9 @@ if(WIN32)
|
||||
endif(RDK_BUILD_AVALON_SUPPORT)
|
||||
else()
|
||||
set(RDKit_Wrapper_Libs
|
||||
Catalogs_static
|
||||
FilterCatalog_static
|
||||
${Boost_SERIALIZATION_LIBRARY}
|
||||
FMCS_static MolDraw2D_static
|
||||
FileParsers_static SmilesParse_static
|
||||
Depictor_static SubstructMatch_static ChemReactions_static Fingerprints_static ChemTransforms_static
|
||||
|
||||
173
Code/JavaWrappers/FilterCatalog.i
Normal file
173
Code/JavaWrappers/FilterCatalog.i
Normal file
@@ -0,0 +1,173 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Novartis Institutes for BioMedical Research Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of Novartis Institutes for BioMedical Research Inc.
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
//%import "ROMol.i"
|
||||
%include "std_string.i"
|
||||
%include "std_vector.i"
|
||||
|
||||
|
||||
%{
|
||||
#include <../RDGeneral/Dict.h>
|
||||
#include <../Catalogs/Catalog.h>
|
||||
#include <../Catalogs/CatalogParams.h>
|
||||
#include <GraphMol/FilterCatalog/FilterMatcherBase.h>
|
||||
#include <GraphMol/FilterCatalog/FilterCatalogEntry.h>
|
||||
#include <GraphMol/FilterCatalog/FilterCatalog.h>
|
||||
|
||||
// bug fix for swig, it removes these from their namespaces
|
||||
typedef RDCatalog::Catalog<RDKit::FilterCatalogEntry, RDKit::FilterCatalogParams>::paramType_t paramType_t;
|
||||
typedef RDCatalog::Catalog<RDKit::FilterCatalogEntry, RDKit::FilterCatalogParams>::entryType_t entryType_t;
|
||||
typedef std::vector<std::string> STR_VECT;
|
||||
|
||||
%}
|
||||
|
||||
%template(FilterCatalogEntry_Vect) std::vector< boost::shared_ptr<RDKit::FilterCatalogEntry> >;
|
||||
%template(FilterCatalogEntryVect) std::vector< const RDKit::FilterCatalogEntry* >;
|
||||
%template(UChar_Vect) std::vector<unsigned char>;
|
||||
|
||||
%include "enums.swg"
|
||||
|
||||
%include <../RDGeneral/Dict.h>
|
||||
%include <../Catalogs/Catalog.h>
|
||||
%include <../Catalogs/CatalogParams.h>
|
||||
%include <GraphMol/Substruct/SubstructMatch.h>
|
||||
|
||||
|
||||
%typemap(javacode) RDKit::FilterCatalog %{
|
||||
public static FilterCatalog Deserialize(byte[] b) {
|
||||
UChar_Vect vec = new UChar_Vect();
|
||||
vec.reserve(b.length);
|
||||
for (int size=0;size<b.length;++size) {
|
||||
vec.add(b[size]);
|
||||
}
|
||||
return new FilterCatalog(vec);
|
||||
}
|
||||
%}
|
||||
|
||||
%newobject RDKit::FilterCatalogEntry::getProp;
|
||||
%extend RDKit::FilterCatalogEntry {
|
||||
std::string getProp(const std::string key){
|
||||
std::string res;
|
||||
($self)->getProp(key, res);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
%extend RDKit::FilterCatalog {
|
||||
FilterCatalog(const std::vector<unsigned char> & data ) {
|
||||
std::string str(data.begin(), data.end());
|
||||
return new RDKit::FilterCatalog(str);
|
||||
}
|
||||
|
||||
bool canSerialize() const {
|
||||
return RDKit::FilterCatalogCanSerialize();
|
||||
}
|
||||
|
||||
// boost does a bad job of wrapping shared_ptr<const T> so we will do the
|
||||
// unthinkable and cast away const.
|
||||
// Also we can't use FilterCatalog::SENTRY because swig thinks it is a new
|
||||
// type. Bad swig!
|
||||
boost::shared_ptr<RDKit::FilterCatalogEntry> getFirstMatch(const ROMol &mol) {
|
||||
RDKit::FilterCatalog::CONST_SENTRY res = self->getFirstMatch(mol);
|
||||
return boost::const_pointer_cast<RDKit::FilterCatalogEntry>(res);
|
||||
}
|
||||
|
||||
std::vector<boost::shared_ptr<RDKit::FilterCatalogEntry> > getMatches(const ROMol &mol) {
|
||||
std::vector<RDKit::FilterCatalog::CONST_SENTRY> matches = self->getMatches(mol);
|
||||
std::vector<RDKit::FilterCatalog::SENTRY> res;
|
||||
res.reserve(matches.size());
|
||||
for (size_t i=0; i< matches.size(); ++i) {
|
||||
res.push_back( boost::const_pointer_cast<RDKit::FilterCatalogEntry>(matches[i]) );
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
// re-wrap swig is making duplicate entries for some strange reason
|
||||
unsigned int addEntry(boost::shared_ptr<RDKit::FilterCatalogEntry> entry) {
|
||||
return self->addEntry(entry);
|
||||
}
|
||||
|
||||
bool removeEntry(boost::shared_ptr<RDKit::FilterCatalogEntry> entry) {
|
||||
return self->removeEntry(entry);
|
||||
}
|
||||
|
||||
// swig const-ptr shenanigans again
|
||||
boost::shared_ptr<RDKit::FilterCatalogEntry> getEntry(unsigned int idx) const {
|
||||
return boost::const_pointer_cast<RDKit::FilterCatalogEntry>(
|
||||
self->getEntry(idx));
|
||||
}
|
||||
|
||||
unsigned int getIdxForEntry(const boost::shared_ptr<FilterCatalogEntry> &entry) const {
|
||||
return self->getIdxForEntry(entry);
|
||||
}
|
||||
}
|
||||
|
||||
%ignore RDKit::FilterCatalog(const std::string &);
|
||||
%ignore RDKit::FilterCatalog::getFirstMatch;
|
||||
%ignore RDKit::FilterCatalog::getMatches;
|
||||
%ignore RDKit::FilterCatalog::addEntry;
|
||||
%ignore RDKit::FilterCatalog::removeEntry;
|
||||
%ignore RDKit::FilterCatalog::setCatalogParams;
|
||||
%ignore RDKit::FilterCatalog::getIdxForEntry;
|
||||
%ignore RDKit::FilterCatalog::getEntryWithIdx;
|
||||
|
||||
|
||||
//%ignore RDKit::FilterCatalogEntry::getPropList;
|
||||
%ignore RDKit::Dict::getPropList;
|
||||
|
||||
|
||||
%typemap(jni) std::string RDKit::FilterCatalog::Serialize "jbyteArray"
|
||||
%typemap(jtype) std::string RDKit::FilterCatalog::Serialize "byte[]"
|
||||
%typemap(jstype) std::string RDKit::FilterCatalog::Serialize "byte[]"
|
||||
%typemap(javaout) std::string RDKit::FilterCatalog::Serialize {
|
||||
return $jnicall;
|
||||
}
|
||||
%typemap(out) std::string RDKit::FilterCatalog::Serialize {
|
||||
$result = JCALL1(NewByteArray, jenv, $1.size());
|
||||
JCALL4(SetByteArrayRegion, jenv, $result, 0, $1.size(), (const jbyte*)$1.c_str());
|
||||
}
|
||||
|
||||
%include <GraphMol/FilterCatalog/FilterMatcherBase.h>
|
||||
%include <GraphMol/FilterCatalog/FilterCatalogEntry.h>
|
||||
%include <GraphMol/FilterCatalog/FilterCatalog.h>
|
||||
|
||||
|
||||
|
||||
%pragma(java) modulecode=%{
|
||||
public static FilterCatalog FilterCatalogDeserialize(byte[] b) {
|
||||
UChar_Vect vec = new UChar_Vect();
|
||||
vec.reserve(b.length);
|
||||
for (int size=0;size<b.length;++size) {
|
||||
vec.add(b[size]);
|
||||
}
|
||||
return new FilterCatalog(vec);
|
||||
}
|
||||
%}
|
||||
76
Code/JavaWrappers/FilterCatalogParams_doc.i
Normal file
76
Code/JavaWrappers/FilterCatalogParams_doc.i
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2015, Novartis Institutes for BioMedical Research Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of Novartis Institutes for BioMedical Research Inc.
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
%typemap(javaimports) RDKit::FilterCatalogParams "
|
||||
/**
|
||||
<p>
|
||||
Paramter Class for initializing a FilterCatalog with the specified set of FilterCatalogs. Current
|
||||
catalogs include:
|
||||
|
||||
<pre><code>
|
||||
FilterCatalogParams.FilterCatalogs.ALL
|
||||
FilterCatalogParams.FilterCatalogs.BRENK
|
||||
FilterCatalogParams.FilterCatalogs.PAINS_A
|
||||
FilterCatalogParams.FilterCatalogs.PAINS_B
|
||||
FilterCatalogParams.FilterCatalogs.PAINS_C
|
||||
FilterCatalogParams.FilterCatalogs.PAINS
|
||||
FilterCatalogParams.FilterCatalogs.ZINC
|
||||
</pre></code>
|
||||
|
||||
Details:
|
||||
|
||||
<h4>Brenk</h4>
|
||||
<ul>
|
||||
<li>Reference: <a href=\"http://www.ncbi.nlm.nih.gov/pubmed/18064617\">Brenk</a> Lessons Learnt from Assembling Screening Libraries for Drug Discovery for Neglected Diseases</li>
|
||||
<li>Scope: unwanted functionality due to potential tox reasons or unfavourable pharmacokinetic properties</li>
|
||||
</ul>
|
||||
|
||||
<h4>NIH</h4>
|
||||
<ul>
|
||||
<li>Reference: <a href=\"http://pubs.rsc.org/en/Content/ArticleLanding/2015/OB/c4ob02287d#!divAbstract\">NIH</a> A Unified Lead-oriented Synthesis of over Fifty Molecular Scaffolds. </li>
|
||||
<li>Reference: <a href=\"http://pubs.acs.org/doi/abs/10.1021/jm901070c\">NIH</a> Quantitative Analyses of Aggregation, Autofluorescence, and Reactivity Artifacts in a Screen for Inhibitors of a Thiol Protease</li>
|
||||
<li>Scope: uannotate compounds with problematic functional groups </li>
|
||||
</ul>
|
||||
|
||||
<h4>PAINS</h4>
|
||||
<ul>
|
||||
<li>Reference: <a href=\"http://pubs.rsc.org/en/Content/ArticleLanding/2015/OB/c4ob02287d#!divAbstract\">NIH</a> New Substructure Filters for Removal of Pan Assay Interference Compounds (PAINS) from Screening Libraries and for Their Exclusion in Bioassays </li>
|
||||
<li>Scope: PAINS filters </li>
|
||||
</ul>
|
||||
|
||||
<h4>ZINC</h4>
|
||||
<ul>
|
||||
<li>Reference: <a href=\"http://blaster.docking.org/filtering/\">ZINC</a></li>
|
||||
<li>Scope: drug-likeness and unwanted functional group filters </li>
|
||||
</ul>
|
||||
|
||||
**/"
|
||||
63
Code/JavaWrappers/FilterCatalog_doc.i
Normal file
63
Code/JavaWrappers/FilterCatalog_doc.i
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2015, Novartis Institutes for BioMedical Research Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of Novartis Institutes for BioMedical Research Inc.
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
%typemap(javaimports) RDKit::FilterCatalog "
|
||||
/** FilterCatalog Class used to filter out undesireable molecules
|
||||
<br>
|
||||
Basic usage:
|
||||
|
||||
<pre><code>
|
||||
FilterCatalog catalog = new FilterCatalog(
|
||||
FilterCatalogParams.FilterCatalogs.PAINS_A);
|
||||
|
||||
// go through a mol supplier
|
||||
while (!molSupplier.atEnd()) {
|
||||
ROMol m = suppl.next();
|
||||
FilterCatalogEntry_Vect matches = catalog.getMatches(mol);
|
||||
if( matches.size() ) {
|
||||
// reject -- get descriptions of rejection
|
||||
for (int entryIdx = 0; entryIdx < matches.size(); ++entryIdx) {
|
||||
entry = matches.get(entryIdx);
|
||||
String description = entry.getDescription(); // why
|
||||
// optional properties
|
||||
String reference = entry.getProp(\"Reference\");
|
||||
String scope = entry.getProp(\"Scope\");
|
||||
}
|
||||
}
|
||||
else {
|
||||
// accept
|
||||
}
|
||||
}
|
||||
|
||||
</code></pre>
|
||||
**/
|
||||
"
|
||||
57
Code/JavaWrappers/FilterCatalogs_doc.i
Normal file
57
Code/JavaWrappers/FilterCatalogs_doc.i
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2015, Novartis Institutes for BioMedical Research Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of Novartis Institutes for BioMedical Research Inc.
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
%typemap(javaimports) RDKit::FilterCatalogParams::FilterCatalog "
|
||||
/**
|
||||
<p>
|
||||
Initialize a FilterCatalog with the specified set of FilterCatalogs. Current
|
||||
catalogs include:
|
||||
|
||||
<pre><code>
|
||||
FilterCatalogParams.FilterCatalogs.ALL
|
||||
FilterCatalogParams.FilterCatalogs.BRENK
|
||||
FilterCatalogParams.FilterCatalogs.PAINS_A
|
||||
FilterCatalogParams.FilterCatalogs.PAINS_B
|
||||
FilterCatalogParams.FilterCatalogs.PAINS_C
|
||||
FilterCatalogParams.FilterCatalogs.PAINS
|
||||
FilterCatalogParams.FilterCatalogs.ZINC
|
||||
</pre></code>
|
||||
|
||||
Details:
|
||||
|
||||
<h4>Brenk</h4>
|
||||
<ul>
|
||||
<li><pre># Reference: Brenk R et al. Lessons Learnt from Assembling Screening Libraries for Drug Discovery for Neglected Diseases. ChemMedChem 3 (2008) 435-444. doi:10.1002/cmdc.200700139.</pre></li>
|
||||
<li><Scope: unwanted functionality due to potential tox reasons or unfavourable pharmacokinetic properties</li>
|
||||
</ul>
|
||||
|
||||
**/"
|
||||
@@ -31,6 +31,7 @@
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
%include "std_pair.i"
|
||||
%include "std_string.i"
|
||||
%include "std_vector.i"
|
||||
%{
|
||||
#include <RDGeneral/types.h>
|
||||
|
||||
@@ -82,7 +82,7 @@ SWIG_ADD_MODULE(GraphMolWrap "java" GraphMolJava.i )
|
||||
# as of Oct 2012 using boost 1.51 under at least ubuntu 12.04 we get a
|
||||
# link error if they aren't there.
|
||||
SWIG_LINK_LIBRARIES(GraphMolWrap ${RDKit_Wrapper_Libs}
|
||||
${RDKit_THREAD_LIBS})
|
||||
${Boost_SERIALIZATION_LIBRARY} ${RDKit_THREAD_LIBS})
|
||||
|
||||
# code adapted from the wrapper code for
|
||||
# GDCM: http://gdcm.svn.sf.net/viewvc/gdcm/trunk/Wrapping/Java/CMakeLists.txt?view=markup
|
||||
@@ -153,6 +153,12 @@ ADD_CUSTOM_TARGET(RunJavaWrapperTests
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/runUnitTests.sh
|
||||
)
|
||||
|
||||
# need to add boost libs for testing
|
||||
SET (CTEST_ENVIRONMENT
|
||||
"LD_LIBRARY_PATH=${Boost_LIBRARY_DIRS}"
|
||||
"DYLD_LIBRARY_PATH=${Boost_LIBRARY_DIRS}"
|
||||
)
|
||||
|
||||
ADD_TEST(JavaAromaticTests
|
||||
java -Djava.library.path=${CMAKE_CURRENT_SOURCE_DIR}
|
||||
-cp "${JUNIT_JAR}${PATH_SEP}${CMAKE_JAVA_TEST_OUTDIR}${PATH_SEP}${CMAKE_CURRENT_SOURCE_DIR}/org.RDKit.jar"
|
||||
@@ -291,5 +297,12 @@ ADD_TEST(JavaMolQueryTests
|
||||
java -Djava.library.path=${CMAKE_CURRENT_SOURCE_DIR}
|
||||
-cp "${JUNIT_JAR}${PATH_SEP}${CMAKE_JAVA_TEST_OUTDIR}${PATH_SEP}${CMAKE_CURRENT_SOURCE_DIR}/org.RDKit.jar"
|
||||
org.RDKit.MolQueryTests)
|
||||
|
||||
ADD_TEST(JavaFilterCatalogTests
|
||||
java -Djava.library.path=${CMAKE_CURRENT_SOURCE_DIR}
|
||||
-cp "${JUNIT_JAR}${PATH_SEP}${CMAKE_JAVA_TEST_OUTDIR}${PATH_SEP}${CMAKE_CURRENT_SOURCE_DIR}/org.RDKit.jar"
|
||||
org.RDKit.FilterCatalogTests)
|
||||
|
||||
|
||||
INSTALL(TARGETS GraphMolWrap
|
||||
DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} )
|
||||
|
||||
@@ -112,6 +112,7 @@ typedef unsigned long long int uintmax_t;
|
||||
%shared_ptr(ForceFields::UFF::vdWContrib);
|
||||
%shared_ptr(ForceFields::UFF::TorsionAngleContrib);
|
||||
%shared_ptr(ForceFields::UFF::InversionContrib);
|
||||
%shared_ptr(RDKit::FilterCatalogEntry);
|
||||
|
||||
/* Some utility classes for passing arrays in and out */
|
||||
%array_class(double, Double_Array);
|
||||
@@ -140,6 +141,9 @@ typedef unsigned long long int uintmax_t;
|
||||
%include "../TDTWriter_doc.i"
|
||||
%include "../Transform2D_doc.i"
|
||||
%include "../Transform3D_doc.i"
|
||||
%include "../FilterCatalog_doc.i"
|
||||
%include "../FilterCatalogParams_doc.i"
|
||||
%include "../FilterCatalogs_doc.i"
|
||||
|
||||
// DO THIS BEFORE ANY OF THE OTHER INCLUDES
|
||||
%include "../RDKitExceptions.i"
|
||||
@@ -185,6 +189,7 @@ typedef unsigned long long int uintmax_t;
|
||||
%include "../MolTransforms.i"
|
||||
%include "../FMCS.i"
|
||||
%include "../MolDraw2D.i"
|
||||
%include "../FilterCatalog.i"
|
||||
|
||||
// Create a class to throw various sorts of errors for testing. Required for unit tests in ErrorHandlingTests.java
|
||||
#ifdef INCLUDE_ERROR_GENERATOR
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2015, Novartis Institutes for BioMedical Research Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of Novartis Institutes for BioMedical Research Inc.
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.RDKit;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.*;
|
||||
|
||||
public class FilterCatalogTests extends GraphMolTest {
|
||||
private ROMol mol;
|
||||
|
||||
@Before public void setUp() {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test1Basics() {
|
||||
FilterCatalog catalog = new FilterCatalog();
|
||||
assertEquals(0, catalog.getNumEntries());
|
||||
|
||||
//assertEquals(16, catalog.getNumEntries());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test2Basics() {
|
||||
|
||||
FilterCatalog catalog = new FilterCatalog(
|
||||
FilterCatalogParams.FilterCatalogs.PAINS_A);
|
||||
assertEquals(16, catalog.getNumEntries());
|
||||
|
||||
mol = RWMol.MolFromSmiles("O=C(Cn1cnc2c1c(=O)n(C)c(=O)n2C)N/N=C/c1c(O)ccc2c1cccc2");
|
||||
FilterCatalogEntry entry = catalog.getFirstMatch(mol);
|
||||
Str_Vect props = entry.getPropList();
|
||||
|
||||
String ref = entry.getProp("Reference");
|
||||
String source = entry.getProp("Scope");
|
||||
assertEquals(ref,
|
||||
"Baell JB, Holloway GA. New Substructure Filters for " +
|
||||
"Removal of Pan Assay Interference Compounds (PAINS) " +
|
||||
"from Screening Libraries and for Their Exclusion in " +
|
||||
"Bioassays. J Med Chem 53 (2010) 2719D40. " +
|
||||
"doi:10.1021/jm901137j.");
|
||||
|
||||
assertEquals(source, "PAINS filters (family A)");
|
||||
assertEquals(entry.getDescription(),"hzone_phenol_A(479)");
|
||||
|
||||
// check the getMatches api point
|
||||
FilterCatalogEntry_Vect matches = catalog.getMatches(mol);
|
||||
assertEquals(1, matches.size());
|
||||
|
||||
for (int entryIdx = 0; entryIdx < matches.size(); ++entryIdx) {
|
||||
entry = matches.get(entryIdx);
|
||||
String refa = entry.getProp("Reference");
|
||||
String sourcea = entry.getProp("Scope");
|
||||
assertEquals(refa,
|
||||
"Baell JB, Holloway GA. New Substructure Filters for " +
|
||||
"Removal of Pan Assay Interference Compounds (PAINS) " +
|
||||
"from Screening Libraries and for Their Exclusion in " +
|
||||
"Bioassays. J Med Chem 53 (2010) 2719D40. " +
|
||||
"doi:10.1021/jm901137j.");
|
||||
assertEquals(source, "PAINS filters (family A)");
|
||||
assertEquals(entry.getDescription(),"hzone_phenol_A(479)");
|
||||
}
|
||||
|
||||
if (catalog.canSerialize()) {
|
||||
byte pickle[] = catalog.Serialize();
|
||||
System.out.println(pickle);
|
||||
assertTrue(pickle != null);
|
||||
FilterCatalog catalog2 = FilterCatalog.Deserialize(pickle);
|
||||
assertFalse(catalog2 == null);
|
||||
assertEquals(16, catalog2.getNumEntries());
|
||||
entry = catalog2.getFirstMatch(mol);
|
||||
assertEquals(entry.getDescription(),"hzone_phenol_A(479)");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveEntry() {
|
||||
FilterCatalog catalog = new FilterCatalog(
|
||||
FilterCatalogParams.FilterCatalogs.PAINS_A);
|
||||
assertEquals(16, catalog.getNumEntries());
|
||||
|
||||
mol = RWMol.MolFromSmiles("O=C(Cn1cnc2c1c(=O)n(C)c(=O)n2C)N/N=C/c1c(O)ccc2c1cccc2");
|
||||
FilterCatalogEntry entry = catalog.getFirstMatch(mol);
|
||||
assertEquals(entry.getDescription(),"hzone_phenol_A(479)");
|
||||
|
||||
assertTrue(catalog.removeEntry(entry));
|
||||
FilterCatalogEntry entry_removed = catalog.getFirstMatch(mol);
|
||||
assertEquals(entry_removed, null);
|
||||
|
||||
catalog.addEntry(entry);
|
||||
entry = catalog.getFirstMatch(mol);
|
||||
assertEquals(entry.getDescription(),"hzone_phenol_A(479)");
|
||||
}
|
||||
|
||||
public static void main(String args[]) {
|
||||
org.junit.runner.JUnitCore.main("org.RDKit.FilterCatalogTests");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user