[Rdkit-discuss] How to perform a "mild" 2D Clean

2018-11-02 Thread Good Eats
In many chemical drawing programs, there exists a "2D Clean" function. This
function usually has two tiers of cleaning. The first tier clean is mild:
standardizing bond lengths and bond angles, but leaving the general
conformation intact. The second tier is stronger: completely recomputing
the 2D coordinates from scratch.

In RDKit, Generate2DCoords() does an admirable job at performing the strong
version of the above. However, I haven't found anything that can perform
the mild 2D Clean. What I've examined so far:
1. TransformMol(): this can scale the structure to get bond lengths close
to the desired length, but doesn't help for molecules with bonds that have
different lengths -- the asymmetry is preserved after the scaling.
2. Iterating through all bonds and calling SetBondLength() to a constant
value: this fails for bonds that are in rings.
3. Iterating through atoms and calling SetAngleDeg() to standardize bond
angles: I haven't tried this yet -- it is next on my list. However, even if
this works, it won't fix the bond length part of the clean.

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


Re: [Rdkit-discuss] Plotting values next to atoms

2018-11-02 Thread Greg Landrum
Hi Eric,

On Fri, Nov 2, 2018 at 2:00 PM Eric Jonas  wrote:

> Hello! I'm trying to figure out if there's any known or sane way to
> automatically plot numerical values adjacent to atoms using the rdkit
> drawing machinery. Ideally I'd like to annotate certain atoms
> programmatically with values. I think the conventional way this is done for
> publication is post-hoc editing in illustrator but it would be great if
> there was an automatic or supported mechanism.
>

Doing this correctly is on the list of high-priority things to do, and I
really hope to have something done for the 2019.03 release, but there's no
way I can guarantee that (it's a hard problem).

In the meantime, there's a way to at least do something that is, hopefully,
better than nothing:
https://gist.github.com/greglandrum/8cf8ecc3253abf0a5139a776a5095163
displayed here:
https://nbviewer.jupyter.org/gist/greglandrum/8cf8ecc3253abf0a5139a776a5095163
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] svg: next question

2018-11-02 Thread Dimitri Maziuk via Rdkit-discuss
On 11/02/2018 12:19 AM, Greg Landrum wrote:
> On Fri, Nov 2, 2018 at 12:32 AM Dimitri Maziuk via Rdkit-discuss <
> rdkit-discuss@lists.sourceforge.net> wrote:
> 
>> Does anyone know where TH does
>>
>> 
>>
>> come from? --
> 
> 
> assuming you're using the RDKit's MolDraw2DSVG class, that comes from here:
> https://github.com/rdkit/rdkit/blob/master/Code/GraphMol/MolDraw2D/MolDraw2DSVG.cpp#L53

Should it be changed to utf-8? I suspect any system where RDKit builds
at this point is using that, and I believe technically  element
can contain unicode.

E.g. you should be able to render your amino-acids with atoms labeled w/
Greek alphas, betas, etc. as per IUPAC.

>> I have two SVGs generated by the same container running on
>> the same linux host and one has the above, the other has
>>
>> 
>>
> 
> No idea where that might have come from, but it's not MolDraw2DSVG

Weird. I'll see if I get any more of those...

-- 
Dimitri Maziuk
Programmer/sysadmin
BioMagResBank, UW-Madison -- http://www.bmrb.wisc.edu



signature.asc
Description: OpenPGP digital signature
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Plotting values next to atoms

2018-11-02 Thread Dimitri Maziuk via Rdkit-discuss
On 11/02/2018 07:59 AM, Eric Jonas wrote:
> Hello! I'm trying to figure out if there's any known or sane way to
> automatically plot numerical values adjacent to atoms using the rdkit
> drawing machinery. Ideally I'd like to annotate certain atoms
> programmatically with values.

This draws atom labels:

op = dr.drawOptions()
for i in range( self._mol.GetNumAtoms() ) :
op.atomLabels[i] = self._mol.GetAtomWithIdx( i ).GetSymbol() +
str( (i + 1) )

HTH,
-- 
Dimitri Maziuk
Programmer/sysadmin
BioMagResBank, UW-Madison -- http://www.bmrb.wisc.edu



signature.asc
Description: OpenPGP digital signature
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Fail one case adding functional groups to certain atomic index of core

2018-11-02 Thread Noki Lee
Thanks for the tip!
Hi, Greg
I will check it another for cases. SetNoImplicit and SetNoExplicit are
very confused ones. What this makes it soluble?

Best,
Noki.

On Fri, Nov 2, 2018 at 1:01 PM Greg Landrum  wrote:

> You're going to reach the limit of what this simple approach can do can do
> very quickly. :-)
> When you express the sulfur atom as [SH] in the SMILES, you tell the RDKit
> that it must have an H attached. That information is preserved when you
> connect the S to the other molecule, so you end up with a valence that's
> too high.
>
> I added a function combine2 to the gist (
> https://gist.github.com/greglandrum/fd488309268cb085be218f26178e13b8)
> that can handle this case,
>
> On Thu, Nov 1, 2018 at 9:33 AM Noki Lee  wrote:
>
>> Hi, Greg
>>
>> Recently, I got the code producing a combined molecule from one core and
>> several functional groups:
>> https://gist.github.com/greglandrum/fd488309268cb085be218f26178e13b8
>>
>> Here is the exception case that I encountered.
>>
>> core = Chem.MolFromSmiles('N(=N/c1c1)\c2c2')
>> pieces = [Chem.MolFromSmiles(x) for x in ('C(=O)O','O=[SH](=O)O')]
>> connections = ((7,0),(4,1))
>> newMol = combine(core,pieces,connections)
>> Draw.MolToImage(core).show()
>> Draw.MolToImage(pieces[0]).show()
>> Draw.MolToImage(pieces[1]).show()
>> Draw.MolToImage(newMol).show()
>> print(Chem.MolToSmiles(newMol))
>>
>> I tried using all canonicalized smiles. I worked for 'O=S(=O)O' which is
>> not canonicalized one.
>> If I put 'O=[SH](=O)O', it works. But it's not what I wanted. The tail of
>> H(hydrogen) tags along the S atom.
>> I tried [S-] instead [SH], but it is also not what I expected. S in the
>> result of 'combine' function has a negative charge. Can you suggest
>> something?
>>
>> ___
>> 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