Re: [Rdkit-discuss] [*External*] Uniqueness of bonds

2020-04-28 Thread nCloud
That solves the problem.

Thank you.

--Nimal

On Mon, Apr 27, 2020 at 11:32 PM Guillaume GODIN <
guillaume.go...@firmenich.com> wrote:

> Dear Nimal,
>
>
>
> You are using atoms to enumerate bonds and a bond has 2 atoms so the
> number of bonds are not the real ones.
>
>
>
> Use this instead :
>
>
>
> for bond in molecule.GetBonds()
>
>bond.GetBondType() == …
>
>
>
> best regards,
>
>
>
> Guillaume
>
>
>
>
>
>
>
> *De : *nCloud 
> *Date : *mardi, 28 avril 2020 à 05:06
> *À : *"rdkit-discuss@lists.sourceforge.net" <
> rdkit-discuss@lists.sourceforge.net>
> *Objet : *[*External*] [Rdkit-discuss] Uniqueness of bonds
>
>
>
> Hi RDKiters,
>
> I recently started using this wonderful package and I have been getting
> familiarized with many of its capabilities.
>
> The problem I am working on now is to determine the number of individual
> bonds in any given molecule. I am able to classify the groups in to single,
> double or triple and aromatic; however, it seems in some cases some bonds
> are recounted. As an example based on my minimum working example (MWE)
> given below; ethane should provide only 1 single bond (output also given);
> propane should give 2 single bonds, but every time an additional bond is
> counted. Another example would be of 1,3-hexadien-5-yne, which has 2 double
> and 1 triple bond, but the output has 3 double bonds.
>
> The problem, I believe, is due to the function I created does not consider
> the uniqueness of the bonds; how can the uniqueness of the bond be
> considered with RDKit?
>
>
>
> *MWE*
>
>  from rdkit import Chem
>
>  def n_bonds(molecule):
>
>  molecule = Chem.MolFromSmiles(molecule)
>
>  fuel_bonds = {'single': 0, 'double': 0, 'triple': 0, 'aromatic': 0}
>
>  for atom in molecule.GetAtoms():
>
>  if str(atom.GetBonds()[0].GetBondType()) == 'SINGLE':
>
>  fuel_bonds['single'] += 1
>
>  elif str(atom.GetBonds()[0].GetBondType()) == 'DOUBLE':
>
>  fuel_bonds['double'] += 1
>
>  elif str(atom.GetBonds()[0].GetBondType()) == 'TRIPLE':
>
>  fuel_bonds['triple'] += 1
>
>  elif str(atom.GetBonds()[0].GetBondType()) == 'AROMATIC':
>
>  fuel_bonds['aromatic'] += 1
>
>  return fuel_bonds
>
>
>
>  smiles_test = [ 'CC',  # 1. ethane
>
>  'CCC',  # 2. propane
>
>  'C1CC1',# 3. cyclopropane
>
>  'C1CCC1',   # 4. cyclobutane
>
>  'CC(C)(C)C',# 5. neopentane
>
>  'C1=CC=CC=C1',  # 6. butylbenzene
>
>  'CCC(CC)CCC(C)C',   # 7. 5-ethyl-3-methylheptane
>
>  'CC=CC=CC=C',   # 8. 1,3,5-undecatriene
>
>  'C=CC=CC#C',# 9. 1,3-Hexadien-5-yne
>
>  'CC#CC#CC#CC=CC=C=C']   # 10. 
> Hexadeca-1,6,8-triene-10,12,14-triyne
>
>
>
>  for i in range(len(smiles_test)):
>
>  f = n_bonds(smiles_test[i])
>
>  print i+1, '-', f
>
> *Output*
>
>  1 - {'double': 0, 'single': 2, 'aromatic': 0, 'triple': 0}
>
>  2 - {'double': 0, 'single': 3, 'aromatic': 0, 'triple': 0}
>
>  3 - {'double': 0, 'single': 3, 'aromatic': 0, 'triple': 0}
>
>  4 - {'double': 0, 'single': 4, 'aromatic': 0, 'triple': 0}
>
>  5 - {'double': 0, 'single': 5, 'aromatic': 0, 'triple': 0}
>
>  6 - {'double': 0, 'single': 5, 'aromatic': 5, 'triple': 0}
>
>  7 - {'double': 0, 'single': 10, 'aromatic': 0, 'triple': 0}
>
>  8 - {'double': 3, 'single': 8, 'aromatic': 0, 'triple': 0}
>
>  9 - {'double': 3, 'single': 2, 'aromatic': 0, 'triple': 1}
>
>  10 - {'double': 3, 'single': 10, 'aromatic': 0, 'triple': 3}
>
> Regards,
> Nimal
>
> ***
> DISCLAIMER
> This email and any files transmitted with it, including replies and
> forwarded copies (which may contain alterations) subsequently transmitted
> from Firmenich, are confidential and solely for the use of the intended
> recipient. The contents do not represent the opinion of Firmenich except to
> the extent that it relates to their official business.
>
> ***
>
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Restraining torsions whilst generating conformers

2020-04-28 Thread Bruce Milne
Hi Taka,

I've been playing with the UFFAddTorsionConstraint suggestion but I can't
make it work for my systems (although it is great to know about as I can
think of lots of other uses). The problem is that the Embedded geometries
are too far from the geometry that I want to enforce on the torsions so
that if I actually apply a large enough force constant to get the desired
torsions I blow up the molecule and if I reduce the force constant the
torsions don't go anywhere near where I need them.

I think that for now I might just go with some other conformer generator
like Balloon, generate a silly number conformers and filter them for
'reasonable' ones using RDKit and go from there. Not ideal, but better than
throwing my computer out the window because I can't get the RDKit embedding
to do what I want :D

Thanks for you suggestions. I know they'll come in handy for other things.

Cheers,
Bruce

On Sun, 26 Apr 2020 at 13:28, Taka Seri  wrote:

> Hi Bruce,
>
> Thanks for your reply.
> I searched rdkit documents and found that RDKit has some constraint method.
> https://www.rdkit.org/docs/source/rdkit.ForceField.rdForceField.html
> And I tried to use UFFAddTorsionConstraint for an example.
> https://gist.github.com/iwatobipen/42c325f2471166ff4084051381d0ef78
> By using these method I think you can keep the torsions.
> Thanks.
>
> Taka
>
> 2020年4月26日(日) 19:35 Bruce Milne :
>
>> Hi Taka,
>>
>> Thanks for the suggestion. The ConstrainedEmbed method is certainly
>> useful but I need to only freeze some selected torsions and allow the rest
>> of the macrocycle to remain flexible. If this was only a single part of the
>> macrocycle the ConstrainedEmbed method would work but I need to
>> simultaneously restrain several parts of the ring that are connected by
>> flexible regions.
>>
>> Cheers,
>> Bruce
>>
>> On Sun, 26 Apr 2020 at 02:00, Taka Seri  wrote:
>>
>>> Dear Bruce,
>>>
>>> How about to use the defined core which has your desired torsions?
>>> Here are examples to generate restricted conformers with user defined
>>> cores.
>>>
>>> https://www.discngine.com/blog/2019/6/6/tethered-minimization-of-small-molecules-with-rdkit-towards-tethered-docking-on-proteins-with-rdock
>>> http://rdkit.blogspot.com/2019/01/more-on-constrained-embedding.html
>>> Thanks,
>>>
>>> Taka
>>>
>>>
>>>
>>> 2020年4月26日(日) 1:11 Bruce Milne :
>>>
 Hi,

 Is it possible to add torsional restraints whilst
 using AllChem.EmbedMultipleConfs() to generate conformers? I did look at
 this some time back but ended up moving on to another project and never
 found out if it could be done. I asked a similar thing in this group at the
 time (about avoiding the generation of cis-peptide bonds) but I don't think
 it got an answer.

 I suspect that it may not be possible with AllChem.EmbedMultipleConfs()
 but if anyone knows of an alternative for generating partially constrained
 structures it would be good to know.

 Cheers,
 Bruce

 --
 Prof. Dr. Bruce F. Milne
 CFisUC
 Department of Physics
 University of Coimbra
 Rua Larga
 3004 - 516 Coimbra
 Portugal

 https://orcid.org/-0002-5522-4808
 https://publons.com/researcher/2905148/bruce-milne/
 https://www.linkedin.com/in/brucemilne

 A/h = S/k
 ___
 Rdkit-discuss mailing list
 Rdkit-discuss@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

>>>
>>
>> --
>> Prof. Dr. Bruce F. Milne
>> CFisUC
>> Department of Physics
>> University of Coimbra
>> Rua Larga
>> 3004 - 516 Coimbra
>> Portugal
>>
>> https://orcid.org/-0002-5522-4808
>> https://publons.com/researcher/2905148/bruce-milne/
>> https://www.linkedin.com/in/brucemilne
>>
>> A/h = S/k
>>
>

-- 
Prof. Dr. Bruce F. Milne
CFisUC
Department of Physics
University of Coimbra
Rua Larga
3004 - 516 Coimbra
Portugal

https://orcid.org/-0002-5522-4808
https://publons.com/researcher/2905148/bruce-milne/
https://www.linkedin.com/in/brucemilne

A/h = S/k
___
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-28 Thread Tim Dudgeon

It's availalbe from the org.RDKit.RDKFuncs class. e.g:

String RDKFuncs.standardizeSmiles(String smiles)​

RWMol cleanup​(RWMol mol)

TIm

On 28/04/2020 15:09, Thomas Eckert wrote:
That helped, thanks! Didn't realize 'make install' was needed after 
building the wrappers - I had built without the wrappers first, trying 
to detect problems iteratively.


So now I'm able to use the wrappers in Java but noticed not all "core 
functionality" is covered by the wrappers. Specifically, I'm looking 
for a way to access

    rdkit.Chem.MolStandardize.rdMolStandardize
from Java. I could not find any matching Java class nor function. Is 
this functionality supported via the Java wrappers ?


Thanks & Regards,
  Thomas

On Wed, Apr 22, 2020 at 11:55 AM Tim Dudgeon > wrote:


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)

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

2020-04-28 Thread Thomas Eckert
That helped, thanks! Didn't realize 'make install' was needed after
building the wrappers - I had built without the wrappers first, trying to
detect problems iteratively.

So now I'm able to use the wrappers in Java but noticed not all "core
functionality" is covered by the wrappers. Specifically, I'm looking for a
way to access
rdkit.Chem.MolStandardize.rdMolStandardize
from Java. I could not find any matching Java class nor function. Is this
functionality supported via the Java wrappers ?

Thanks & Regards,
  Thomas

On Wed, Apr 22, 2020 at 11:55 AM Tim Dudgeon  wrote:

> 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