Re: [Rdkit-discuss] Generating 3D Coordinates in already existing coordinate frame...

2011-12-12 Thread Greg Landrum
On Wed, Dec 7, 2011 at 5:06 AM, Greg Landrum greg.land...@gmail.com wrote:
 Dear JP,

 I do not see how AddHs will help me when replacing [OH] with [O-], but
 that might just be me being thick.
 My problem is that ps = AllChem.ReplaceSubstructs(mol, patt, repl,
 replaceAll=True) in my original attached code throws away the 3D
 coordinates (ps[0] atoms are all on 0,0,0) - and I don't know of a way
 to regain the original co-ordinates back.

 You need two things here:
 1) the coordinates of the input molecule should be copied to the result 
 molecule
 2) some way to generate sensible coordinates for the new atoms.

 The first is already supposed to be happening; the fact that it's not
 is a bug which I will fix
 (https://sourceforge.net/tracker/?func=detailaid=3453144group_id=160139atid=814650).

This bug is now fixed in svn.

-greg

--
Systems Optimization Self Assessment
Improve efficiency and utilization of IT resources. Drive out cost and 
improve service delivery. Take 5 minutes to use this Systems Optimization 
Self Assessment. http://www.accelacomm.com/jaw/sdnl/114/51450054/
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Generating 3D Coordinates in already existing coordinate frame...

2011-12-05 Thread JP
Just bumping this up ...

On 29 November 2011 16:47, JP jeanpaul.ebe...@inhibox.com wrote:
 Dear Greg,

 I am not sure that is what I need/I explained myself well.

 My question is: If you have a 3D molecule, and you replace a part of
 it with a new group based on some SMARTS expression (with no 3D
 coorinates) - what is the best way to keep all the 3D info for the
 atoms in the molecule which have not changed while creating some
 sensible co-cordinates (in the current frame) for the newly appended
 atoms to the molecule.

 I do not see how AddHs will help me when replacing [OH] with [O-], but
 that might just be me being thick.
 My problem is that ps = AllChem.ReplaceSubstructs(mol, patt, repl,
 replaceAll=True) in my original attached code throws away the 3D
 coordinates (ps[0] atoms are all on 0,0,0) - and I don't know of a way
 to regain the original co-ordinates back.

 Is this still a rumble?

 Many thanks

 -
 Jean-Paul Ebejer
 Early Stage Researcher



 On 29 November 2011 16:10, Greg Landrum greg.land...@gmail.com wrote:
 Dear JP,

 On Tue, Nov 29, 2011 at 3:36 PM, JP jeanpaul.ebe...@inhibox.com wrote:
 Sorry for the repeated posting -- I had asked a similar question for
 2D some time ago
 (http://www.mail-archive.com/rdkit-discuss@lists.sourceforge.net/msg01916.html),
 but now I need the 3D case and I am stuck.

 Using RDKit 2011_09_01.

 I am simply protonating a molecule via some simple SMART replacements.
  I would like the final output molecule to have the same 3D co
 ordinates as the input one.  I have code which works for the 2D case,
 (basically the below but using
 GenerateDepictionMatching2DStructure(...) instead.

 I think you're overcomplicating things. Once you have the molecule
 ready to be protonated, try doing:

 Chem.AddHs(mol,addCoords=True)

 That is *supposed* to do the right thing (assuming I've understood the
 request correctly). If it doesn't let me know and I will propose a
 more complicated solution.

 -greg

--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


[Rdkit-discuss] Generating 3D Coordinates in already existing coordinate frame...

2011-11-29 Thread JP
Sorry for the repeated posting -- I had asked a similar question for
2D some time ago
(http://www.mail-archive.com/rdkit-discuss@lists.sourceforge.net/msg01916.html),
but now I need the 3D case and I am stuck.

Using RDKit 2011_09_01.

I am simply protonating a molecule via some simple SMART replacements.
 I would like the final output molecule to have the same 3D co
ordinates as the input one.  I have code which works for the 2D case,
(basically the below but using
GenerateDepictionMatching2DStructure(...) instead.

A copy and paste example:

#!/usr/bin/env python

Protonates the input molecules...

@author: JP


from rdkit import Chem
from rdkit.Chem import AllChem

orig_mol = LIGAND
  Insight   3D 0

 47 48  0  0  0  0  0
   16.1500   22.3350   42.8110 C   0  0  0  0  0  0
   15.3160   21.8930   41.9800 O   0  0  0  0  0  0
   16.9980   23.2070   42.5060 O   0  0  0  0  0  0
   16.1410   21.7710   44.2030 C   0  0  0  0  0  0
   15.1160   22.5540   45.0230 C   0  0  0  0  0  0
   15.0619   22.1799   46.0577 H   0  0  0  0  0  0
   15.3649   23.6269   45.0656 H   0  0  0  0  0  0
   14.1065   22.4630   44.5883 H   0  0  0  0  0  0
   17.5310   21.9290   44.8610 C   0  0  0  0  0  0
   17.5541   21.4127   45.8334 H   0  0  0  0  0  0
   18.3473   21.5168   44.2477 H   0  0  0  0  0  0
   17.7642   22.9903   45.0477 H   0  0  0  0  0  0
   15.7170   20.3840   44.1390 O   0  0  0  0  0  0
   16.5230   19.2430   43.6250 C   0  0  0  0  0  0
   16.2460   17.9700   44.1170 C   0  0  0  0  0  0
   15.4668   17.8367   44.8675 H   0  0  0  0  0  0
   16.9520   16.8770   43.6600 C   0  0  0  0  0  0
   16.7273   15.8853   44.0527 H   0  0  0  0  0  0
   17.9400   17.0290   42.7100 C   0  0  0  0  0  0
   17.5250   19.4050   42.6630 C   0  0  0  0  0  0
   17.7525   20.3959   42.2701 H   0  0  0  0  0  0
   18.2350   18.2860   42.2070 C   0  0  0  0  0  0
   19.0179   18.4043   41.4579 H   0  0  0  0  0  0
   18.6450   15.8760   42.2400 C   0  0  0  0  0  0
   18.9367   15.2468   43.1044 H   0  0  0  0  0  0
   19.6099   16.1765   41.7887 H   0  0  0  0  0  0
   17.8550   15.0410   41.2140 C   0  0  0  0  0  0
   16.7450   15.4130   40.8360 O   0  0  0  0  0  0
   18.2860   13.8040   41.0020 N   0  0  0  0  0  0
   19.1093   13.4965   41.5391 H   0  0  0  0  0  0
   17.7310   12.8920   40.1270 C   0  0  0  0  0  0
   16.3370   12.7960   39.9850 C   0  0  0  0  0  0
   15.6892   13.5478   40.4357 H   0  0  0  0  0  0
   15.7870   11.7440   39.2710 C   0  0  0  0  0  0
   16.6210   10.7910   38.7010 C   0  0  0  0  0  0
   16.19299.9591   38.1417 H   0  0  0  0  0  0
   18.5490   11.9350   39.5470 C   0  0  0  0  0  0
   19.6312   12.0105   39.6525 H   0  0  0  0  0  0
   18.0040   10.8950   38.8420 C   0  0  0  0  0  0
   14.3030   11.6400   39.1100 C   0  0  0  0  0  0
   13.8285   12.6314   39.1672 H   0  0  0  0  0  0
   14.0383   11.1938   38.1399 H   0  0  0  0  0  0
   13.8615   11.0120   39.9008 H   0  0  0  0  0  0
   18.90909.8760   38.2190 C   0  0  0  0  0  0
   18.47289.4727   37.2928 H   0  0  0  0  0  0
   19.8880   10.3114   37.9693 H   0  0  0  0  0  0
   19.08119.0290   38.9030 H   0  0  0  0  0  0
  1  2  1  0  0  0
  1  3  2  0  0  0
  1  4  1  0  0  0
  4  5  1  0  0  0
  4  9  1  0  0  0
  4 13  1  0  0  0
  5  6  1  0  0  0
  5  7  1  0  0  0
  5  8  1  0  0  0
  9 10  1  0  0  0
  9 11  1  0  0  0
  9 12  1  0  0  0
 13 14  1  0  0  0
 14 15  2  0  0  0
 14 20  1  0  0  0
 15 17  1  0  0  0
 15 16  1  0  0  0
 17 19  2  0  0  0
 17 18  1  0  0  0
 19 22  1  0  0  0
 19 24  1  0  0  0
 20 22  2  0  0  0
 20 21  1  0  0  0
 22 23  1  0  0  0
 24 27  1  0  0  0
 24 25  1  0  0  0
 24 26  1  0  0  0
 27 28  2  0  0  0
 27 29  1  0  0  0
 29 31  1  0  0  0
 29 30  1  0  0  0
 31 32  1  0  0  0
 31 37  2  0  0  0
 32 34  2  0  0  0
 32 33  1  0  0  0
 34 35  1  0  0  0
 34 40  1  0  0  0
 35 39  2  0  0  0
 35 36  1  0  0  0
 37 39  1  0  0  0
 37 38  1  0  0  0
 39 44  1  0  0  0
 40 41  1  0  0  0
 40 42  1  0  0  0
 40 43  1  0  0  0
 44 45  1  0  0  0
 44 46  1  0  0  0
 44 47  1  0  0  0
M  END

rules=(
# Carboxylic Acid ionization
   ('[O-]','[$([OH]C(=O))]'),
)

def protonate(mol):
Chem.SanitizeMol(mol)
orig = Chem.MolToSmiles(mol)
for repl, patt in rules:
repl = Chem.MolFromSmiles(repl, sanitize=False)
patt = Chem.MolFromSmarts(patt)
ps = AllChem.ReplaceSubstructs(mol, patt, repl, replaceAll=True)
ps[0].UpdatePropertyCache(False)
Chem.GetSymmSSSR(ps[0])
new = Chem.MolToSmiles(ps[0])
modified = Chem.MolToSmiles(mol) != Chem.MolToSmiles(ps[0])
print Input: %s,Output: %s,Deprotonated: %s % (orig,
new, modified)
if modified:
# emebed these as
# the following keeps the co ordinates in mol, and just
adds co ordinates
# for the new (replaced) atoms

Re: [Rdkit-discuss] Generating 3D Coordinates in already existing coordinate frame...

2011-11-29 Thread Greg Landrum
Dear JP,

On Tue, Nov 29, 2011 at 3:36 PM, JP jeanpaul.ebe...@inhibox.com wrote:
 Sorry for the repeated posting -- I had asked a similar question for
 2D some time ago
 (http://www.mail-archive.com/rdkit-discuss@lists.sourceforge.net/msg01916.html),
 but now I need the 3D case and I am stuck.

 Using RDKit 2011_09_01.

 I am simply protonating a molecule via some simple SMART replacements.
  I would like the final output molecule to have the same 3D co
 ordinates as the input one.  I have code which works for the 2D case,
 (basically the below but using
 GenerateDepictionMatching2DStructure(...) instead.

I think you're overcomplicating things. Once you have the molecule
ready to be protonated, try doing:

Chem.AddHs(mol,addCoords=True)

That is *supposed* to do the right thing (assuming I've understood the
request correctly). If it doesn't let me know and I will propose a
more complicated solution.

-greg

--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Generating 3D Coordinates in already existing coordinate frame...

2011-11-29 Thread JP
Dear Greg,

I am not sure that is what I need/I explained myself well.

My question is: If you have a 3D molecule, and you replace a part of
it with a new group based on some SMARTS expression (with no 3D
coorinates) - what is the best way to keep all the 3D info for the
atoms in the molecule which have not changed while creating some
sensible co-cordinates (in the current frame) for the newly appended
atoms to the molecule.

I do not see how AddHs will help me when replacing [OH] with [O-], but
that might just be me being thick.
My problem is that ps = AllChem.ReplaceSubstructs(mol, patt, repl,
replaceAll=True) in my original attached code throws away the 3D
coordinates (ps[0] atoms are all on 0,0,0) - and I don't know of a way
to regain the original co-ordinates back.

Is this still a rumble?

Many thanks

-
Jean-Paul Ebejer
Early Stage Researcher



On 29 November 2011 16:10, Greg Landrum greg.land...@gmail.com wrote:
 Dear JP,

 On Tue, Nov 29, 2011 at 3:36 PM, JP jeanpaul.ebe...@inhibox.com wrote:
 Sorry for the repeated posting -- I had asked a similar question for
 2D some time ago
 (http://www.mail-archive.com/rdkit-discuss@lists.sourceforge.net/msg01916.html),
 but now I need the 3D case and I am stuck.

 Using RDKit 2011_09_01.

 I am simply protonating a molecule via some simple SMART replacements.
  I would like the final output molecule to have the same 3D co
 ordinates as the input one.  I have code which works for the 2D case,
 (basically the below but using
 GenerateDepictionMatching2DStructure(...) instead.

 I think you're overcomplicating things. Once you have the molecule
 ready to be protonated, try doing:

 Chem.AddHs(mol,addCoords=True)

 That is *supposed* to do the right thing (assuming I've understood the
 request correctly). If it doesn't let me know and I will propose a
 more complicated solution.

 -greg

--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Generating 3D coordinates

2010-09-11 Thread Paul Emsley

 It's kind of interesting (and encouraging) that the optimizer doesn't
 completely freak out when you hand it a 2D conformer. :-)



Ah... :)

 What makes 3D coordinates?  (I'm guessing it's a one-liner somewhere...)
  
 It is indeed a one-liner (two lines with a bit of error checking). To
 get a 3D conformer, you need to include
 GraphMol/DistGeomHelpers/Embedder.h  and do the following:

 int cid = DGeomHelpers::EmbedMolecule(*m);
 if(cid0) // embedding failed, do something

 There are a bunch of optional arguments to EmbedMolecule, but the
 defaults normally work reasonably well.



So it seems!

Fantastic, that did it.

It's pretty jaw dropping that so much power can be added with so little 
code (on my part :)

More later.

Cheers,

Paul.




--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing
http://p.sf.net/sfu/novell-sfdev2dev
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


[Rdkit-discuss] Generating 3D coordinates

2010-09-10 Thread Paul Emsley

Hi All,

I've been tinkering a bit more with RDKit and having fun.

I have hit a problem though. I am trying to reproduce Greg's Generating 
3D coordinates in RDKit-overview.pdf in C++:

This is what I have (mostly via cut 'n paste):



int
main(int argc, char **argv) {

std::string smiles_string = C1CCC1;

RDKit::RWMol *mol=new RDKit::RWMol();
mol = RDKit::SmilesToMol(smiles_string);
RDDepict::compute2DCoords(*mol);

double vdwThresh=10.0;
int confId = -1;
bool ignoreInterfragInteractions=true;
int maxIters = 200;

ForceFields::ForceField *ff =
   RDKit::UFF::constructForceField(*mol,
   vdwThresh, confId,
   ignoreInterfragInteractions);
ff-initialize();
int res=ff-minimize(maxIters);
delete ff;

std::cout  RDKit::MolToMolBlock(*mol, true, -1)  std::endl;

return 0;
}


But I get 2D coordinates:


  RDKit  2D

   5  5  0  0  0  0  0  0  0  0999 V2000
 1.28790.0. C   0  0  0  0  0  0  0  0  0  0  0  0
 0.39801.22490. C   0  0  0  0  0  0  0  0  0  0  0  0
-1.04190.75700. C   0  0  0  0  0  0  0  0  0  0  0  0
-1.0419   -0.75700. C   0  0  0  0  0  0  0  0  0  0  0  0
 0.3980   -1.22490. C   0  0  0  0  0  0  0  0  0  0  0  0
   1  2  1  0
   2  3  1  0
   3  4  1  0
   4  5  1  0
   5  1  1  0
M  END


What makes 3D coordinates?  (I'm guessing it's a one-liner somewhere...)

Cheers,

Paul.


--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing
http://p.sf.net/sfu/novell-sfdev2dev
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss