Re: [Rdkit-discuss] Matching Generalized Compounds

2018-08-31 Thread Kovas Palunas
I ended up just adding the following code to the atom matching function (after 
moving it and copies of the substructure code that call it to a new library to 
avoid other internal RDKit stuff calling the modified code):

  int a1n = a1->getAtomicNum();
  int a2n = a2->getAtomicNum();
  // dummy atoms have atomic number 0
  if (a1n == 0 || a2n == 0) {
  return true;
  }

So far, it seems to work great for me.  If anyone else cares for this 
functionality, I’d be happy to share more details/open a pull request!

- Kovas

From: Kovas Palunas 
Date: Thursday, August 23, 2018 at 10:20 AM
To: Christos Kannas 
Cc: RDKit , Paolo Tosco 

Subject: Re: [Rdkit-discuss] Matching Generalized Compounds

Thanks for the feedback and code example!

I understand that it works to make a third query mol using MCS that matches 
both the original mols to then match with.  However, this seems like overkill 
(overly expensive) for this particular problem – as I understand it MCS can be 
very expensive depending on the compounds you are comparing.  Would it not work 
to simply override the atom.Match function with one that will always match 
dummies no matter what the other atom is?  I am not planning to compare SMARTSy 
queries with my matching with any complexity beyond simply dummy atoms.  In 
fact, as I understand it, my example compounds are not made up of any query 
atoms when they are read into rdkit – the dummies are just made into queries 
after the read by the QueryParameters code.  I am definitely not interested in 
doing generic query to query matching.

- Kovas


From: Christos Kannas 
Date: Thursday, August 23, 2018 at 7:53 AM
To: Kovas Palunas 
Cc: RDKit , Paolo Tosco 

Subject: Re: [Rdkit-discuss] Matching Generalized Compounds

Hi Kovas,

You have two fuzzy compounds that you try to match them, because our intuition 
says that any atom notation [*:1] from m1 should match the Fluorine [F:11] in 
m2 and any atom [*:14] in m2 should match Carbon [CH3:4] in m1.
The issue here is that you create two query compounds from m1 and m2 which will 
match their own specific substructures. Query to query matching is not trivial.

In order to do what you want you need a query compound that combines their 
characteristic, which is what Paolo showed.
Paolo with MCS and modifying atom properties created that query compound 
'[*:1]-[CH2:2]-[C:3](-[*:4])=[CH2:5]' or 
'[*:1]-[CH2X4:2]-[CX3:3](-[*:4])=[CH2X3:5]'
Also bare in mind that Paolo's approach changed the starting compounds, as now 
they resemble the generic query compound that combines their fuzzy atoms.

https://gist.github.com/CKannas/ac1a4791dec909552d7c8899cfaff030

Best,

Christos

Christos Kannas

Chem[o]informatics Researcher & Software Developer

[Image removed by sender. View Christos Kannas's profile on 
LinkedIn]


On Thu, 23 Aug 2018 at 12:36, Paolo Tosco 
mailto:paolo.tosco.m...@gmail.com>> wrote:

Dear Kovas,

It looks like GetSubstructMatch() only finds a match if the dummy atom is in 
the query, not if it is in the molecule they you are matching the query against.

This notebook present a possible solution off the top of my head:

https://gist.github.com/ptosco/a35ac28a14103b47096f6d6af1aec831

which does not involve changes to the C++ layer, even though it is 
computationally more expensive and will fail with disconnected fragments as it 
uses FindMCS(). There may be better solutions - this is what I came out with 
yesterday night in the little time I had available.

Cheers,
P.

On 08/22/18 19:34, Kovas Palunas wrote:
Hi All,

I’m interested in having GetSubstructMatches return non-“null” results in the 
following example.  The results should lead to a match where atom 1 maps to 
atom 11, 2 to 12, etc.

m1 = Chem.MolFromSmiles('[*:1][CH2:2][C:3]([CH3:4])=[CH2:5]')
m2 = Chem.MolFromSmiles('[F:11][CH2:12][C:13]([*:14])=[CH2:15]')

### do something here so that the mols will match ###
qp = Chem.AdjustQueryParameters()
qp.makeDummiesQueries = True
m1 = Chem.AdjustQueryProperties(m1, qp)
m2 = Chem.AdjustQueryProperties(m2, qp)

# I’d like both of the following to return results
m1.GetSubstructMatches(m2)
m2.GetSubstructMatches(m1)

My understanding of why these mols currently do not match is as follows:  
because only the dummy atoms are made queries (based on my query parameter 
adjustment), when one mol is matched to another dummy 1 may match to F:11, but 
dummy 14 will then not match to methyl:14.  This is because (as I understand), 
normal atoms can only be matched by queries, and cannot match them themselves.

Potential ideas to make this work as I’d like:

  1.  Override atom.Match in the python code – not sure that this would work 
since the C++ version of this function is what would be called during 
GetSubstructMatches
  2.  Override atom.Match in the C++ code – not quite sure how to do this, or 
what side affects it might have.  Ideally the changes I make would only affect 
this example (and other similar 

Re: [Rdkit-discuss] Chembience

2018-08-31 Thread Markus Sitzmann
Hello,

I have put together another Chembience release (0.2.3): update of RDKit to
version 2018.03.*4, *Postgres to version 10.5, and Django to 2.1

https://github.com/chembience/chembience

https://twitter.com/markussitzmann/status/1035629283736264704

Best,
Markus

On Sun, Jun 10, 2018 at 4:41 PM Markus Sitzmann 
wrote:

> Hello,
>
> I have just released Chembience 0.2.1: it updates RDKit to version
> 2018.03.2 and switches Postgres from the 9.x series to version 10.4
>
> https://github.com/chembience/chembience
>
> Best,
> Markus
>
>
> On Mon, May 14, 2018 at 1:49 AM Markus Sitzmann 
> wrote:
>
>> Hello,
>>
>> I have released Chembience 0.2.0: it includes an update to RDKit 2018.03
>> and also provides Jupyter as new base App container type.
>>
>> https://github.com/chembience/chembience
>>
>> (so, assuming you have Docker and docker-compose installed on your
>> computer, you are a few, easy commands away from your personal Jupyter
>> notebook server with all RDKit 2018.03 goodness readily available).
>>
>> Best,
>> Markus
>>
>>
>> On Tue, Apr 24, 2018 at 10:44 AM Markus Sitzmann <
>> markus.sitzm...@gmail.com> wrote:
>>
>>> Hello,
>>>
>>> since it includes RDKit as one of its major components I am happy to
>>> announce the first release of my new open-source project Chembience:
>>>
>>> A Docker-based, cloudable platform for the development of
>>> chemoinformatics-centric web applications and microservices.
>>>
>>> https://github.com/chembience/chembience
>>>
>>> (unfortunately it is still on RDKit 2017.09_3, I failed releasing it
>>> before 2018.03 :-) ).
>>>
>>> Best,
>>> Markus
>>>
>>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] descriptors beyond rotatable bond count and possible correlations with entropy

2018-08-31 Thread Thomas Evangelidis
Hi,

I am also very interested in measures of ligand flexibility. There has been
a post about a new descriptor 3 days ago that might be more "descriptive"
than the largest number of contiguous rotatable bonds.

https://www.mail-archive.com/rdkit-discuss@lists.sourceforge.net/msg08196.html

best,
Thomas


On Tue, 28 Aug 2018 at 02:22, James T. Metz via Rdkit-discuss <
rdkit-discuss@lists.sourceforge.net> wrote:

> RDkit users,
>
> Is there a RDkit descriptor (or code) to determine the largest number
> of contiguous
> rotatable bonds in a small molecule?
>
> Hmmm... it seems likely that ligand conformational flexibility might be
> somehow related to the entropy component of ligand binding.  Has anyone
> made
> a plot of the experimental TdS term from calorimetry vs. any number of
> computational measures of ligand flexibility?  Any correlation?
>
> Regards,
> Jim Metz
>
>
>
>
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>


-- 

==

Dr Thomas Evangelidis

Research Scientist

IOCB - Institute of Organic Chemistry and Biochemistry of the Czech Academy
of Sciences 
Prague, Czech Republic
  &
CEITEC - Central European Institute of Technology 
Brno, Czech Republic

email: teva...@gmail.com

website: https://sites.google.com/site/thomasevangelidishomepage/
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] descriptors beyond rotatable bond count and possible correlations with entropy

2018-08-31 Thread Paolo Tosco
Hi Jim,

I have updated the gist to fix the bug that Andrew pointed out (thanks!). 
That’s what happens when you write code while still in bed because you can’t 
sleep  :-/

Cheers,
p.

> On 31 Aug 2018, at 16:56, James T. Metz  wrote:
> 
> Paolo,
> 
> Thank you for writing the PYTHON/RDkit/Jupyter code.  I was able to run 
> your
> code in Jupyter and obtain a contiguous rotatable bond count of 3 for the 
> example molecule that you provided.  Thanks again, much appreciated.
> 
> Regards,
> Jim Metz
> 
> James T. Metz, Ph.D.
> President, Metz Research LLC
> 422 Cross Road
> Gurnee, IL  60031
> (262) 581 - 2794
> jamestm...@aol.com
> www.metzresearch.com
> 
> 
> 
> -Original Message-
> From: Paolo Tosco 
> To: James T. Metz ; rdkit-discuss 
> 
> Sent: Fri, Aug 31, 2018 12:41 am
> Subject: Re: [Rdkit-discuss] descriptors beyond rotatable bond count and 
> possible correlations with entropy
> 
> Dear Jim,
> this gist should do what you need:
> https://gist.github.com/ptosco/baf6168c48c4271bf3c096d53adaaf82
> Cheers,
> p.
> 
> On 28/08/2018 01:21, James T. Metz via Rdkit-discuss wrote:
> RDkit users,
> 
> Is there a RDkit descriptor (or code) to determine the largest number of 
> contiguous 
> rotatable bonds in a small molecule?
> 
> Hmmm... it seems likely that ligand conformational flexibility might be
> somehow related to the entropy component of ligand binding.  Has anyone made
> a plot of the experimental TdS term from calorimetry vs. any number of 
> computational measures of ligand flexibility?  Any correlation?
> 
> Regards,
> Jim Metz
> 
> 
> 
> 
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> 
> 
> ___
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
> 
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] no structure depiction in Jupyter notebook

2018-08-31 Thread Andrew Dalke
On Aug 31, 2018, at 15:27, Axel Pahl  wrote:
> on Linux, using Anaconda, RDKit and Python 3.6, I always need to additionally 
> install cairocffi via pip:

Thanks Axel.

When I tried it out, I figured out the more likely problem - I was using 
jupyter from a non-conda virtualenv.

My problem disappeared once I switched to a new terminal window (without the 
virtual environment) and started a new notebook server.

Your suggestion was helpful because it made me realize that the "pip install" 
went to the wrong Python installation.

Cheers,


Andrew
da...@dalkescientific.com



--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] no structure depiction in Jupyter notebook

2018-08-31 Thread Axel Pahl

Hi Andrew,

on Linux, using Anaconda, RDKit and Python 3.6, I always need to 
additionally install cairocffi via pip:


pip install cairocffi

Kind regards,
Axel

On 31.08.2018 15:05, Andrew Dalke wrote:

On Aug 31, 2018, at 11:58, Andrew Dalke  wrote:

I am unable to see an inline structure depiction in the Jupyter notebook, nor 
in the JupyterLab notebook, tested with both the Python 2 and Python 3 kernels, 
and rdkit.__version__ '2018.03.1'.

I've narrowed it down to the Cairo code.

I ran Draw._moltoimg manually, and the d2d.GetDrawingText() call returns b"".

If I do

   del Draw.rdMolDraw2D.MolDraw2DCairo

then the image generation code will fall back to MolToImage, and give me an 
inline depiction in the notebook.



Andrew
da...@dalkescientific.com



--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss



--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] no structure depiction in Jupyter notebook

2018-08-31 Thread Andrew Dalke
On Aug 31, 2018, at 11:58, Andrew Dalke  wrote:
> I am unable to see an inline structure depiction in the Jupyter notebook, nor 
> in the JupyterLab notebook, tested with both the Python 2 and Python 3 
> kernels, and rdkit.__version__ '2018.03.1'.

I've narrowed it down to the Cairo code. 

I ran Draw._moltoimg manually, and the d2d.GetDrawingText() call returns b"".

If I do

  del Draw.rdMolDraw2D.MolDraw2DCairo 

then the image generation code will fall back to MolToImage, and give me an 
inline depiction in the notebook.



Andrew
da...@dalkescientific.com



--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


[Rdkit-discuss] no structure depiction in Jupyter notebook

2018-08-31 Thread Andrew Dalke
Hi all,

  I am unable to see an inline structure depiction in the Jupyter notebook, nor 
in the JupyterLab notebook, tested with both the Python 2 and Python 3 kernels, 
and rdkit.__version__ '2018.03.1'.

I installed miniconda and RDKit on my Mac using:

curl -O 'https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh'
bash Miniconda3-latest-MacOSX-x86_64.sh
conda install conda-build
conda install -c conda-forge jupyterlab
conda install -c rdkit rdkit

My test code is:

from rdkit import Chem
from rdkit.Chem.Draw import IPythonConsole
mol = Chem.MolFromSmiles("c1c1O")
mol

It gives a broken image link, the contents of which are:

data:image/png;base64,

There is no message in the console log reporting a problem.

My assumption is that I am missing a library which is needed for the PNG 
generation step. I have put the output of "conda list" at the end of this email.

Can someone suggest what to do next? I did not see a discussion of this problem 
on the recent mailing list nor in the issue tracker.

As a backup, I saw that IPythonConsole supports SVG mode. I enabled it using:

IPythonConsole.ipython_useSVG = True

This gave me another broken image icon. I tracked it down to incorrect handling 
of the "svg" namespace. A fix was for this was made on 14 May 2018, and will be 
part of the fall release. (See https://github.com/rdkit/rdkit/pull/1866 ).

For now I can monkey-patch the run-time using:

===
from rdkit.Chem import Draw 
original_moltoSVG = Draw._moltoSVG

def new_moltoSVG(*args, **kwargs):
s = original_moltoSVG(*args, **kwargs)
return s.replace("xmlns:svg='http://www.w3.org/2000/svg'",
 "xmlns='http://www.w3.org/2000/svg'")

Draw._moltoSVG = new_moltoSVG
===

However, I would like to get the regular PNG output to work.

Cheers,


Andrew
da...@dalkescientific.com

# packages in environment at /Users/dalke/miniconda3:
#
# NameVersion   Build  Channel
appdirs   1.4.3  py_1conda-forge
appnope   0.1.0py36_0conda-forge
asn1crypto0.24.0   py36_0  
attrs 18.1.0 py_1conda-forge
automat   0.7.0  py_1conda-forge
backcall  0.1.0  py_0conda-forge
beautifulsoup44.6.3py36_0  
blas  1.0 mkl  
bleach2.1.4  py_1conda-forge
bzip2 1.0.6h1de35cc_5  
ca-certificates   2018.8.24ha4d7672_0conda-forge
cairo 1.14.12  hc4e6be7_4  
certifi   2018.8.24py36_1  
cffi  1.11.5   py36h342bebf_0  
chardet   3.0.4py36h96c241c_1  
conda 4.5.11   py36_0conda-forge
conda-build   3.13.0   py36_0  
conda-env 2.6.0h36134e3_0  
constantly15.1.0 py_0conda-forge
cryptography  2.2.2py36h1de35cc_0  
decorator 4.3.0  py_0conda-forge
entrypoints   0.2.3py36_2conda-forge
filelock  3.0.6py36_0  
fontconfig2.13.0   h5d5b041_1  
freetype  2.9.1hb4e5f40_0  
gettext   0.19.8.1 h15daf44_3  
glib  2.56.2   hd9629dc_0  
glob2 0.6  py36_0  
html5lib  1.0.1  py_0conda-forge
hyperlink 17.3.1 py_0conda-forge
icu   58.2 h4b95b61_1  
idna  2.6  py36h8628d0a_1  
incremental   17.5.0 py_0conda-forge
intel-openmp  2018.0.3  0  
ipykernel 4.9.0py36_0conda-forge
ipython   6.5.0py36_0conda-forge
ipython_genutils  0.2.0  py_1conda-forge
jedi  0.12.1   py36_0conda-forge
jinja22.10 py36_0  
jpeg  9b   he5867d9_2  
jsonschema2.6.0py36_2conda-forge
jupyter_client5.2.3  py_1conda-forge
jupyter_core  4.4.0  py_0conda-forge
jupyterlab0.34.6   py36_0conda-forge
jupyterlab_launcher   0.13.1 

Re: [Rdkit-discuss] descriptors beyond rotatable bond count and possible correlations with entropy

2018-08-31 Thread Andrew Dalke
On Aug 31, 2018, at 07:41, Paolo Tosco  wrote:
> this gist should do what you need:

Unless I misinterpreted what Jim is looking for, I don't think that returns the 
contiguous rotatable bonds in a small molecule.

In the following there are only two rotatable bonds:

>>> mol = Chem.MolFromSmiles("NCC1CCC1C(=O)O")
>>> mol.GetSubstructMatches(RotatableBondSmarts)
((1, 2), (5, 6))

The code from the gist identifies three bonds:

>>> find_bond_groups(mol)
((, , ),)
>>> [(b.GetBeginAtomIdx(), b.GetEndAtomIdx()) for b in _[0]]
[(5, 2), (5, 6), (1, 2)]

In this case, (2,5) is part of a ring, and not rotatable.

I think the problem is that:

   nbrs = [nbr.GetIdx() for nbr in a.GetNeighbors() if (
  (nbr.GetIdx() in rot_atom_set_tmp) and (not (nbr.GetIdx() in 
connected_atom_set)))]

finds that both atoms of the bond are in connected bond groups, while the bond 
itself is not part of the match.

I have put an alternative implementation of this function at the bottom of this 
email. For my test case it returns:

>>> find_bond_groups2(mol)
((,), (,))
>>> [[(b.GetBeginAtomIdx(), b.GetEndAtomIdx()) for b in x] for x in _]
[[(5, 6)], [(1, 2)]]

Cheers,

Andrew
da...@dalkescientific.com


from collections import defaultdict
def find_bond_groups_dalke(mol):
rot_atom_pairs = mol.GetSubstructMatches(RotatableBondSmarts)

bond_groups = defaultdict(set)
for (left, right) in rot_atom_pairs:
# Ensure they are in order (I'm not sure if this is required)
if right < left:
left, right = right, left
pair = (left, right)
# Add the pair to the group associated with the left atom
bond_groups[left].add(pair)
# Merge the left atom group with the right atom group
bond_groups[left].update(bond_groups[right])
bond_groups[right] = bond_groups[left]

# Get just the unique bond groups, in order from largest to smallest
unique_bond_groups = set(frozenset(v) for v in bond_groups.values())
sorted_bond_groups = sorted(unique_bond_groups, reverse=True, key=len)

# Return as bond objects, to match Paolo's code
return tuple(
tuple(mol.GetBondBetweenAtoms(left, right) for (left, right) in 
bond_group)
for bond_group in sorted_bond_groups)


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Set Residue Name before writing a pdb file

2018-08-31 Thread Paolo Tosco

Hi Thomas,

you are right; here's a better solution:

https://gist.github.com/ptosco/f499c7a8ced9c38067d36565ebd693f4

Please note that if you have more than 99 atoms with the same element 
there will be duplicate atom names - you can easily write a small 
function that uses letters in addition to numbers if you need more than 
99 atoms with the same element.


Cheers,
p.


On 31/08/2018 08:15, thomas@boehringer-ingelheim.com wrote:


Hi Paolo,

thanks a lot – this helps, but I just realized that your solution 
deletes the atom name…


the pdb format should be

HETATM    1   C1  MOL 1  -1.011   0.850  -0.017  0.00 
0.00   C


However, what I now get is:

HETATM    1 MOL 1  -1.011   0.850  -0.017  0.00  0.00 C

Shouldn’t the AtomPDBResidueInfo leave the atom properties untouched?

Best,

Th.

Mit freundlichen Grüßen / Kind regards,
Dr. Thomas Fox

Boehringer Ingelheim Pharma GmbH & Co. KG
Medicinal Chemistry
Tel.: +49 (7351) 54-7585
Fax: +49 (7351) 83-7585
mailto:thomas@boehringer-ingelheim.com

Pflichtangaben finden Sie 
unter:https://www.boehringer-ingelheim.de/unser-unternehmen/gesellschaften-in-deutschland 

Mandatory information can be found at: 
https://www.boehringer-ingelheim.de/unser-unternehmen/gesellschaften-in-deutschland 



_Datenschutzhinweis_: Für bereits bestehende und neue 
Geschäftsbeziehungen nutzen wir personenbezogene Daten und werden 
diese für die Dauer unserer Geschäftsbeziehung aufbewahren. Während 
unserer Geschäftsbeziehung erheben wir unter Umständen Kontaktdaten, 
Daten zur Berufsqualifikation (Publikationen etc.). Einige Daten 
werden aus öffentlichen Quellen und Internetseiten bezogen. 
Rechtsgrundlage: Artikel 6 (1) b) und f) EU DS-GVO. Klicken Sie _hier 
_, um weitere 
Informationen auf der lokalen Unternehmensinternetseite des 
betreffenden Landes über Datenschutz bei Boehringer Ingelheim und zu 
Ihren Rechten zu erhalten. Bitte beachten Sie, dass zusätzliche 
Datenschutzhinweise gelten können und alle diese Datenschutzhinweise 
von Zeit zu Zeit aktualisiert werden können.


_P__rivacy Notice_: We use personal data for current and future 
business collaborations, and will retain such data for the duration of 
our business relationship. During the course of our business 
relationship we may collect contact data, data about professional 
qualifications (publications etc.). Some of the data is sourced from 
public sources and websites. Legal basis: Article 6 (1) b) and f) EU 
GDPR. Click _here 
_ for more 
information on the local company website of the respective country 
about data protection at Boehringer Ingelheim and your rights. Please 
note that additional privacy notices may apply and that all these 
privacy notices might be updated from time to time.


Diese E-Mail ist vertraulich zu behandeln. Sie kann besonderem 
rechtlichem Schutz unterliegen. Wenn Sie nicht der richtige Adressat 
sind, senden Sie bitte diese E-Mail an den Absender zurück, löschen 
die eingegangene E-Mail und geben den Inhalt der E-Mail nicht weiter. 
Jegliche unbefugte Bearbeitung, Nutzung, Vervielfältigung oder 
Verbreitung ist verboten. / This e-mail is confidential and may also 
be legally privileged. If you are not the intended recipient please 
reply to sender, delete the e-mail and do not disclose its contents to 
any person. Any unauthorized review, use, disclosure, copying or 
distribution is strictly prohibited.


*Von:*Paolo Tosco [mailto:paolo.tosco.m...@gmail.com]
*Gesendet:* Donnerstag, 30. August 2018 23:32
*An:* Fox,Dr.,Thomas (RES MedChem) BIP-DE-B; 
rdkit-discuss@lists.sourceforge.net

*Betreff:* Re: [Rdkit-discuss] Set Residue Name before writing a pdb file

Dear Thomas,

you may set the PDB residue info at the atom level (see below).

Cheers,
p.

In [1]:

*from**rdkit**import*Chem
*from**rdkit.Chem**import*rdDistGeom
*from**rdkit.Chem.Draw**import*IPythonConsole

In [2]:

mol=Chem.MolFromSmiles('c1n1')

In [3]:

rdDistGeom.EmbedMolecule(mol)

Out[3]:

0

In [4]:

mi=Chem.AtomPDBResidueInfo()
mi.SetResidueName('MOL')
mi.SetResidueNumber(1)
mi.SetOccupancy(0.0)
mi.SetTempFactor(0.0)

In [5]:

[a.SetMonomerInfo(mi)*for*a *in*mol.GetAtoms()];

In [6]:

print(Chem.MolToPDBBlock(mol))
HETATM    1  MOL 1  -1.011   0.850  -0.017  0.00  
0.00   C
HETATM    2  MOL 1   0.159   1.321  -0.598  0.00  
0.00   C
HETATM    3  MOL 1   1.251   0.462  -0.564  0.00  
0.00   C
HETATM    4  MOL 1   1.052  -0.805  -0.026  0.00  0.00   
C
HETATM    5  MOL 1  -0.213  -1.342  -0.195  0.00  
0.00   C
HETATM    6  MOL 1  -1.238  -0.486   0.039  0.00  
0.00   N

CONECT    1    2    2    6
CONECT    2    3
CONECT    3    4    4
CONECT    4    5
CONECT    5    6    6
END

On 30/08/2018 18:32, thomas@boehringer-ingelheim.com 

Re: [Rdkit-discuss] Set Residue Name before writing a pdb file

2018-08-31 Thread thomas.fox
Hi Paolo,

thanks a lot - this helps, but I just realized that your solution deletes the 
atom name...
the pdb format should be
HETATM1C1  MOL 1  -1.011   0.850  -0.017  0.00  0.00   C

However, what I now get is:
HETATM1  MOL 1  -1.011   0.850  -0.017  0.00  0.00   C

Shouldn't the AtomPDBResidueInfo leave the atom properties untouched?

Best,
Th.

Mit freundlichen Grüßen / Kind regards,
Dr. Thomas Fox

Boehringer Ingelheim Pharma GmbH & Co. KG
Medicinal Chemistry
Tel.: +49 (7351) 54-7585
Fax: +49 (7351) 83-7585
mailto:thomas@boehringer-ingelheim.com
Pflichtangaben finden Sie unter: 
https://www.boehringer-ingelheim.de/unser-unternehmen/gesellschaften-in-deutschland
Mandatory information can be found at: 
https://www.boehringer-ingelheim.de/unser-unternehmen/gesellschaften-in-deutschland
Datenschutzhinweis: Für bereits bestehende und neue Geschäftsbeziehungen nutzen 
wir personenbezogene Daten und werden diese für die Dauer unserer 
Geschäftsbeziehung aufbewahren. Während unserer Geschäftsbeziehung erheben wir 
unter Umständen Kontaktdaten, Daten zur Berufsqualifikation (Publikationen 
etc.). Einige Daten werden aus öffentlichen Quellen und Internetseiten bezogen. 
Rechtsgrundlage: Artikel 6 (1) b) und f) EU DS-GVO. Klicken Sie 
hier, um weitere 
Informationen auf der lokalen Unternehmensinternetseite des betreffenden Landes 
über Datenschutz bei Boehringer Ingelheim und zu Ihren Rechten zu erhalten. 
Bitte beachten Sie, dass zusätzliche Datenschutzhinweise gelten können und alle 
diese Datenschutzhinweise von Zeit zu Zeit aktualisiert werden können.
Privacy Notice: We use personal data for current and future business 
collaborations, and will retain such data for the duration of our business 
relationship. During the course of our business relationship we may collect 
contact data, data about professional qualifications (publications etc.). Some 
of the data is sourced from public sources and websites. Legal basis: Article 6 
(1) b) and f) EU GDPR. Click 
here for more 
information on the local company website of the respective country about data 
protection at Boehringer Ingelheim and your rights. Please note that additional 
privacy notices may apply and that all these privacy notices might be updated 
from time to time.
Diese E-Mail ist vertraulich zu behandeln. Sie kann besonderem rechtlichem 
Schutz unterliegen. Wenn Sie nicht der richtige Adressat sind, senden Sie bitte 
diese E-Mail an den Absender zurück, löschen die eingegangene E-Mail und geben 
den Inhalt der E-Mail nicht weiter. Jegliche unbefugte Bearbeitung, Nutzung, 
Vervielfältigung oder Verbreitung ist verboten. / This e-mail is confidential 
and may also be legally privileged. If you are not the intended recipient 
please reply to sender, delete the e-mail and do not disclose its contents to 
any person. Any unauthorized review, use, disclosure, copying or distribution 
is strictly prohibited.

Von: Paolo Tosco [mailto:paolo.tosco.m...@gmail.com]
Gesendet: Donnerstag, 30. August 2018 23:32
An: Fox,Dr.,Thomas (RES MedChem) BIP-DE-B; rdkit-discuss@lists.sourceforge.net
Betreff: Re: [Rdkit-discuss] Set Residue Name before writing a pdb file


Dear Thomas,

you may set the PDB residue info at the atom level (see below).

Cheers,
p.
In [1]:

from rdkit import Chem

from rdkit.Chem import rdDistGeom

from rdkit.Chem.Draw import IPythonConsole
In [2]:

mol = Chem.MolFromSmiles('c1n1')
In [3]:

rdDistGeom.EmbedMolecule(mol)
Out[3]:

0
In [4]:

mi = Chem.AtomPDBResidueInfo()

mi.SetResidueName('MOL')

mi.SetResidueNumber(1)

mi.SetOccupancy(0.0)

mi.SetTempFactor(0.0)
In [5]:

[a.SetMonomerInfo(mi) for a in mol.GetAtoms()];
In [6]:

print(Chem.MolToPDBBlock(mol))

HETATM1  MOL 1  -1.011   0.850  -0.017  0.00  0.00   C

HETATM2  MOL 1   0.159   1.321  -0.598  0.00  0.00   C

HETATM3  MOL 1   1.251   0.462  -0.564  0.00  0.00   C

HETATM4  MOL 1   1.052  -0.805  -0.026  0.00  0.00   C

HETATM5  MOL 1  -0.213  -1.342  -0.195  0.00  0.00   C

HETATM6  MOL 1  -1.238  -0.486   0.039  0.00  0.00   N

CONECT1226

CONECT23

CONECT344

CONECT45

CONECT566

END



On 30/08/2018 18:32, 
thomas@boehringer-ingelheim.com 
wrote:
Hi,
I read in a mol2 file, do some modifications and then want to write it out as 
pdb file. So far, I always get as residue name in the pdb "UNL", and haven't 
been able to change that e.g. to "MOL".
Does anybody have a short code snipped how to set the PDB residue name? I seem 
to be too stupid to deduct that from the documentation.

Thanks,
Th.

Mit freundlichen Grüßen / Kind regards,
Dr. Thomas Fox

Boehringer Ingelheim Pharma GmbH & Co. KG
Medicinal