Hi Jorgen,
you can use a reaction SMARTS for that purpose; see below for an example
and the docs
https://www.rdkit.org/docs/GettingStartedInPython.html#chemical-reactions
for more information.
from cresset import flare
from rdkit import Chem
from rdkit.Chem import AllChem
deprotonate_cooh = AllChem.ReactionFromSmarts(
"[C:1](=[O:2])-[OH1:3]>>[C:1](=[O:2])-[O-H0:3]")
m1 = Chem.MolFromSmiles(
'CC(=O)N[C@@H]1[C@H](C[C@@](O[C@H]1[C@H]([C@H](CO)O)O)(C(=O)O)O)O')
m2 = Chem.MolFromSmiles('CCN')
m3 = Chem.MolFromSmiles('OC(=O)CCC(=O)[O-]')
mols = (m1, m2, m3)
[print(Chem.MolToSmiles(m)) for m in mols];
CC(=O)N[C@@H]1[C@@H](O)C[C@](O)(C(=O)O)O[C@H]1[C@@H](O)[C@@H](O)CO
CCN
O=C([O-])CCC(=O)O
mols_deprot = []
for m in mols:
m_deprot = deprotonate_cooh.RunReactants((m,))
mols_deprot.append(m_deprot[0][0] if m_deprot else m)
[print(Chem.MolToSmiles(m)) for m in mols_deprot];
CC(=O)N[C@@H]1[C@@H](O)C[C@](O)(C(=O)[O-])O[C@H]1[C@@H](O)[C@@H](O)CO
CCN
O=C([O-])CCC(=O)[O-]
Cheers,
p.
On 10/16/19 18:55, Jorgen Simonsen wrote:
Hi all,
I have hit the wall with how to do this the smartest way - I have a
bunch and molecules and I need to set their charge state. One of the
molecules:
# Has a carboxylic acid
m1 =
Chem.MolFromSmiles('CC(=O)N[C@@H]1[C@H](C[C@@](O[C@H]1[C@H]([C@H](CO)O)O)(C(=O)O)O)O')
So my question is what is the best way - iterate through the molecule
and identify the carbon that has =O,-O attached - maybe there is
already a functionality to do this in rdkit. Or is there a function
that deprotonates all carboxylic groups?
Ay advice how to proceed very much appreciated thanks.
_______________________________________________
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