[Rdkit-discuss] Matching atom to substructure query atom

2020-04-22 Thread Tosstorff, Andreas via Rdkit-discuss
Hi all,

I want to find out whether an atom in a molecule matches to an atom in a
defined substructure.

Let's assume the following:

>>>m = Chem.MolFromSmiles('CS(=O)(=O)N')
>>>sub = Chem.MolFromSmarts('[C]S(=O)(=O)[ND1]')
>>>m.GetSubstructMatches(sub)
((0, 1, 2, 3, 4),)

How can I do the following:
>>>ox1 = m.GetAtomsWithIdx(2)
>>>ox2 = m.GetAtomsWithIdx(3)
>>>query_atom = sub.GetAtomsWithIdx(2)
>>> ox1 matches query_atom
True
>>> ox2 matches query_atom
True

Initially I thought I could use ox1.Matches(query_atom), but this seems to
match independently of the context of the query atom.

Thanks a lot for your help!

Andreas
-- 
*Andreas Tosstorff*


*Post Doctorate Scientist*
*Computer Aided Drug Design | Roche Pharma Research and Early Development**F.
Hoffmann-La Roche Ltd* | Bldg. 92.3.88 | Grenzacherstrasse 124 | CH-4070
Basel | Switzerland
Tel +41 (0) 61 68 20 867

 *Doing now what patients need next*
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Problems building RDKit + JavaWrappers

2020-04-22 Thread Tim Dudgeon
Have a look in 'Code/JavaWrappers/gmwrapper/' not 
'build/Code/JavaWrappers/gmwrapper/' ?


Tim

On 22/04/2020 10:36, Thomas Eckert wrote:

Hi folks,

Trying to build RDKit + JavaWrappers from scratch but, in the end, the 
JAR files are missing.


Working on a freshly installed Ubuntu 19.10 and followed the steps 
described at [1]. All dependencies installed via Ubuntu's apt, no 
manually installed libs.


Cloned the RDKit sources to
    /home/thomas/git/rdkit
and set env variables
    RDBASE=/home/thomas/git/rdkit
LD_LIBRARY_PATH=/home/thomas/git/rdkit/lib:/lib/x86_64-linux-gnu/

Using this 'cmake' command
  cmake -DRDK_BUILD_PYTHON_WRAPPERS=OFF -DRDK_BUILD_SWIG_WRAPPERS=ON ..
I get OK looking output except for
    CMake Warning (dev) at 
/usr/share/cmake-3.13/Modules/UseSWIG.cmake:564 (message):
      Policy CMP0078 is not set.  Run "cmake --help-policy CMP0078" 
for policy
      details.  Use the cmake_policy command to set the policy and 
suppress this

      warning.
    Call Stack (most recent call first):
      Code/JavaWrappers/gmwrapper/CMakeLists.txt:109 (SWIG_ADD_LIBRARY)
    This warning is for project developers.  Use -Wno-dev to suppress it.
but as the warning states, this seems to be fine for non-rdkit-dev 
users, so I just carry on.


'make' then runs happily with a few warnings on the first build but no 
errors are reported. It even states

    (...)
    [ 99%] Built target GraphMolWrap_swig_compilation
    [ 99%] Built target GraphMolWrap
    [100%] building jar
    [100%] Built target GraphMolWrapJar
    [100%] building test classes
    [100%] Built target BuildJavaWrapperTests
which seems to mean the JavaWrappers were built. However this is then 
the case

    ~/git/rdkit/build$ ls -lha Code/JavaWrappers/gmwrapper/
    total 16M
    drwxr-xr-x 3 thomas thomas 4,0K Apr 22 11:15 .
    drwxr-xr-x 4 thomas thomas 4,0K Apr 22 11:15 ..
    drwxr-xr-x 7 thomas thomas 4,0K Apr 22 11:15 CMakeFiles
    -rw-r--r-- 1 thomas thomas 2,6K Apr 22 10:47 cmake_install.cmake
    -rw-r--r-- 1 thomas thomas  13K Apr 22 10:47 CTestTestfile.cmake
    -rwxr-xr-x 1 thomas thomas  16M Apr 22 10:49 libGraphMolWrap.so
    -rw-r--r-- 1 thomas thomas  13K Apr 22 10:47 Makefile
so no JAR files to be found even though the shared library mentioned 
in "Building the Java wrappers" at [1] is there.


Thus I ran the tests
   /git/rdkit/build$ ctest
Test project /home/thomas/git/rdkit/build
(...)
73% tests passed, 39 tests failed out of 143

Total Test time (real) =  98.60 sec

The following tests FAILED:
        105 - JavaAromaticTests (Failed)
        106 - JavaAtomPairsTests (Failed)
        107 - JavaBasicMoleculeTests (Failed)
        108 - JavaBasicMolecule2Tests (Failed)
        109 - JavaChemAtomTests (Failed)
        110 - JavaChemBondTests (Failed)
        111 - JavaChemReactionTests (Failed)
        112 - JavaChemSmartsTests (Failed)
        113 - JavaChemTests (Failed)
        114 - JavaChemv2Tests (Failed)
        115 - JavaConformerTests (Failed)
        116 - JavaDescriptorTests (Failed)
        117 - JavaDistanceGeometryTests (Failed)
        118 - JavaErrorHandlingTests (Failed)
        119 - JavaFingerprintsTests (Failed)
        120 - JavaForceFieldsTests (Failed)
        121 - JavaHManipulationsTests (Failed)
        122 - JavaLipinskiTests (Failed)
        123 - JavaPicklingTests (Failed)
        124 - JavaSmilesCreationTests (Failed)
        125 - JavaSmilesDetailsTests (Failed)
        126 - JavaSmilesTests (Failed)
        127 - JavaSuppliersTests (Failed)
        128 - JavaTrajectoryTests (Failed)
        129 - JavaWrapperTests (Failed)
        130 - JavaChemTransformsTests (Failed)
        131 - JavaFMCSTests (Failed)
        132 - JavaPDBTests (Failed)
        133 - JavaSequenceTests (Failed)
        134 - JavaAlignTests (Failed)
        135 - JavaMolQueryTests (Failed)
        136 - JavaFilterCatalogTests (Failed)
        137 - JavaSubstructLibraryTests (Failed)
        138 - JavaRGroupDecompositionTests (Failed)
        139 - JavaScaffoldNetworkTests (Failed)
        140 - JavaMolHashTest (Failed)
        141 - JavaDiversityPickerTests (Failed)
        142 - JavaBitOpsTests (Failed)
        143 - MolStandardizeTest (Failed)
Errors while running CTest

At this point I cannot find anything in the documentation to proceed 
further. I'm not familiar with most of the stack used with/for RDKit 
either, so I don't know where to look. Any hints on where to look or 
what to check ?


Regards,
  Thomas

[1] https://www.rdkit.org/docs/Install.html#building-from-source


___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


[Rdkit-discuss] Problems building RDKit + JavaWrappers

2020-04-22 Thread Thomas Eckert
Hi folks,

Trying to build RDKit + JavaWrappers from scratch but, in the end, the JAR
files are missing.

Working on a freshly installed Ubuntu 19.10 and followed the steps
described at [1]. All dependencies installed via Ubuntu's apt, no manually
installed libs.

Cloned the RDKit sources to
/home/thomas/git/rdkit
and set env variables
RDBASE=/home/thomas/git/rdkit
LD_LIBRARY_PATH=/home/thomas/git/rdkit/lib:/lib/x86_64-linux-gnu/

Using this 'cmake' command
  cmake -DRDK_BUILD_PYTHON_WRAPPERS=OFF -DRDK_BUILD_SWIG_WRAPPERS=ON ..
I get OK looking output except for
CMake Warning (dev) at /usr/share/cmake-3.13/Modules/UseSWIG.cmake:564
(message):
  Policy CMP0078 is not set.  Run "cmake --help-policy CMP0078" for
policy
  details.  Use the cmake_policy command to set the policy and suppress
this
  warning.
Call Stack (most recent call first):
  Code/JavaWrappers/gmwrapper/CMakeLists.txt:109 (SWIG_ADD_LIBRARY)
This warning is for project developers.  Use -Wno-dev to suppress it.
but as the warning states, this seems to be fine for non-rdkit-dev users,
so I just carry on.

'make' then runs happily with a few warnings on the first build but no
errors are reported. It even states
(...)
[ 99%] Built target GraphMolWrap_swig_compilation
[ 99%] Built target GraphMolWrap
[100%] building jar
[100%] Built target GraphMolWrapJar
[100%] building test classes
[100%] Built target BuildJavaWrapperTests
which seems to mean the JavaWrappers were built. However this is then the
case
~/git/rdkit/build$ ls -lha Code/JavaWrappers/gmwrapper/
total 16M
drwxr-xr-x 3 thomas thomas 4,0K Apr 22 11:15 .
drwxr-xr-x 4 thomas thomas 4,0K Apr 22 11:15 ..
drwxr-xr-x 7 thomas thomas 4,0K Apr 22 11:15 CMakeFiles
-rw-r--r-- 1 thomas thomas 2,6K Apr 22 10:47 cmake_install.cmake
-rw-r--r-- 1 thomas thomas  13K Apr 22 10:47 CTestTestfile.cmake
-rwxr-xr-x 1 thomas thomas  16M Apr 22 10:49 libGraphMolWrap.so
-rw-r--r-- 1 thomas thomas  13K Apr 22 10:47 Makefile
so no JAR files to be found even though the shared library mentioned in
"Building the Java wrappers" at [1] is there.

Thus I ran the tests
   /git/rdkit/build$ ctest
Test project /home/thomas/git/rdkit/build
(...)
73% tests passed, 39 tests failed out of 143

Total Test time (real) =  98.60 sec

The following tests FAILED:
105 - JavaAromaticTests (Failed)
106 - JavaAtomPairsTests (Failed)
107 - JavaBasicMoleculeTests (Failed)
108 - JavaBasicMolecule2Tests (Failed)
109 - JavaChemAtomTests (Failed)
110 - JavaChemBondTests (Failed)
111 - JavaChemReactionTests (Failed)
112 - JavaChemSmartsTests (Failed)
113 - JavaChemTests (Failed)
114 - JavaChemv2Tests (Failed)
115 - JavaConformerTests (Failed)
116 - JavaDescriptorTests (Failed)
117 - JavaDistanceGeometryTests (Failed)
118 - JavaErrorHandlingTests (Failed)
119 - JavaFingerprintsTests (Failed)
120 - JavaForceFieldsTests (Failed)
121 - JavaHManipulationsTests (Failed)
122 - JavaLipinskiTests (Failed)
123 - JavaPicklingTests (Failed)
124 - JavaSmilesCreationTests (Failed)
125 - JavaSmilesDetailsTests (Failed)
126 - JavaSmilesTests (Failed)
127 - JavaSuppliersTests (Failed)
128 - JavaTrajectoryTests (Failed)
129 - JavaWrapperTests (Failed)
130 - JavaChemTransformsTests (Failed)
131 - JavaFMCSTests (Failed)
132 - JavaPDBTests (Failed)
133 - JavaSequenceTests (Failed)
134 - JavaAlignTests (Failed)
135 - JavaMolQueryTests (Failed)
136 - JavaFilterCatalogTests (Failed)
137 - JavaSubstructLibraryTests (Failed)
138 - JavaRGroupDecompositionTests (Failed)
139 - JavaScaffoldNetworkTests (Failed)
140 - JavaMolHashTest (Failed)
141 - JavaDiversityPickerTests (Failed)
142 - JavaBitOpsTests (Failed)
143 - MolStandardizeTest (Failed)
Errors while running CTest

At this point I cannot find anything in the documentation to proceed
further. I'm not familiar with most of the stack used with/for RDKit
either, so I don't know where to look. Any hints on where to look or what
to check ?

Regards,
  Thomas

[1] https://www.rdkit.org/docs/Install.html#building-from-source
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss