[Rdkit-discuss] Problem generating reduced graphs

2023-09-01 Thread Rafael L via Rdkit-discuss
Using rdReducedGraphs.GenerateMolExtendedReducedGraph() on RDKit
mols obtained from certain SMILES
(e.g. "O=C(OC3c1nccnc1C(=O)N3c2ncc(Cl)cc2)N4CCN(C)CC4") throws the
following error:
getNumImplicitHs() called without preceding call to calcImplicitValence()

I tried removing sanitization/keeping hydrogens on conversion to mol, using
Kekulized SMILES, mol.UpdatePropertyCache(), Chem.SanitizeMol()... but all
I got were different errors, such as:
- Can't kekulize mol
- RingInfo not initialized

I was finally able to solve all the errors by calling Chem.AddHs(mol) for
all mols prior to calculation of the reduced graph.

--
*Rafael da Fonseca Lameiro*
PhD Student - Medicinal and Biological Chemistry Group (NEQUIMED)
São Carlos Institute of Chemistry - University of São Paulo - Brazil
[image: orcid logo 16px] https://orcid.org/-0003-4466-2682
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Problem generating reduced graphs

2023-08-31 Thread Rafael L via Rdkit-discuss
However, now that I have visualized the graphs generated, I believe this
was not an optimal solution, since the graphs do not look reduced at all.
Also, the Ac/Ar/D/Hf nomenclature presented on the original ErG paper does
not seem to be implemented in RDKit. For now, I believe it's best to stick
with the fingerprints and forget about the representations


On Fri, 1 Sept 2023 at 01:13, Rafael L  wrote:

> Using rdReducedGraphs.GenerateMolExtendedReducedGraph() on RDKit
> mols obtained from certain SMILES
> (e.g. "O=C(OC3c1nccnc1C(=O)N3c2ncc(Cl)cc2)N4CCN(C)CC4") throws the
> following error:
> getNumImplicitHs() called without preceding call to calcImplicitValence()
>
> I tried removing sanitization/keeping hydrogens on conversion to mol,
> using Kekulized SMILES, mol.UpdatePropertyCache(), Chem.SanitizeMol()...
> but all I got were different errors, such as:
> - Can't kekulize mol
> - RingInfo not initialized
>
> I was finally able to solve all the errors by calling Chem.AddHs(mol) for
> all mols prior to calculation of the reduced graph.
>
> --
> *Rafael da Fonseca Lameiro*
> PhD Student - Medicinal and Biological Chemistry Group (NEQUIMED)
> São Carlos Institute of Chemistry - University of São Paulo - Brazil
> [image: orcid logo 16px] https://orcid.org/-0003-4466-2682
>


-- 
*Rafael da Fonseca Lameiro *
PhD Student - Medicinal and Biological Chemistry Group (NEQUIMED)
São Carlos Institute of Chemistry - University of São Paulo - Brazil
[image: orcid logo 16px] https://orcid.org/-0003-4466-2682
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


[Rdkit-discuss] Error reading SDF dataset from BindingDB

2023-07-25 Thread Rafael L via Rdkit-discuss
Hi, I'm just creating this thread to get the problem and the solution
indexed by Google

I downloaded several SDF datasets from BindingDB and got errors like this
one when using Chem.SDMolSupplier:

ERROR: Cannot convert 1. to unsigned int

After some digging I found [
https://sourceforge.net/p/rdkit/mailman/rdkit-discuss/thread/CAB3Bi0AYKAYOzMUumk6BscipsujkmG_-uuho3%3Dsf9mNyfoBAwA%40mail.gmail.com/#msg32641808],
and it turns out the headers (before every mol) should have three lines.
The BindingDB files only had two.

In these files, each mol+properties block was separated by four dollar sign
symbols. My solution was to add a blank line after each  by using
Notepad++ Find and replace:  by  + (new line).

--
*Rafael da Fonseca Lameiro*
PhD Student - Medicinal and Biological Chemistry Group (NEQUIMED)
São Carlos Institute of Chemistry - University of São Paulo - Brazil
[image: orcid logo 16px] https://orcid.org/-0003-4466-2682
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] fragment 3D molecules with BRICS

2022-07-14 Thread Rafael L via Rdkit-discuss
Renato, it seems that FragmentOnBRICSBonds and BRICS.BRICSDecompose work
differently. The first returns a mol object from which you can get the
fragments using GetMolFrags (as you did), while the second returns a list
of strings containing the fragments. I'm not sure if you can recover 3D
info from these strings.
If you want to get the fragments from BRICS.BRICSDecompose, use:

l = BRICS.BRICSDecompose(m2,minFragmentSize=9)
fr2 = [Chem.MolFromSmiles(x) for x in l]
Draw.MolsToGridImage(fr2,molsPerRow=4)


Alternatively, if you want to remove the small fragments obtained from
FragmentOnBRICSBonds, you can filter by using the atom count:

newmol2=Chem.FragmentOnBRICSBonds(m2)
frags=Chem.GetMolFrags(newmol2,asMols=True,sanitizeFrags=True)
frags = [x for x in frags if len(x.GetAtoms()) > 3]
Draw.MolsToGridImage(frags,molsPerRow=4)


On Wed, Jul 13, 2022 at 8:01 PM Renato Freitas  wrote:

> Dear Rdkit team,
>
> I want to fragment a ligand from PDB and keep the 3D coordinates of the
> resulting fragments. I was able to do that using the code below
>
> ###
> import rdkit
> import py3Dmol
> from rdkit import Chem
> from rdkit.Chem import rdmolops
> from rdkit import RDLogger
> from rdkit.Chem import BRICS
> from rdkit.Chem import Recap
> from rdkit.Chem import Draw
> from rdkit.Chem import AllChem
> from rdkit.Chem.Draw import IPythonConsole
> from rdkit import Chem, RDConfig
> from rdkit.Chem import AllChem, rdMolAlign
>
> mol ="""rot-1A5H-A
>  RDKit  3D
>
>  28 30  0  0  1  0  0  0  0  0999 V2000
> 0.5600   -9.3330  -12.4470 C   0  0  0  0  0  0  0  0  0  0  0  0
>-0.5220  -11.6860  -13.9640 C   0  0  2  0  0  0  0  0  0  0  0  0
>-1.3890  -10.8900  -13.0130 C   0  0  0  0  0  0  0  0  0  0  0  0
>-0.9370   -9.5080  -12.5700 C   0  0  0  0  0  0  0  0  0  0  0  0
> 1.3380   -9.3820  -13.7780 C   0  0  0  0  0  0  0  0  0  0  0  0
> 0.5150   -9.5890  -15.0480 C   0  0  2  0  0  0  0  0  0  0  0  0
> 0.0420  -10.9860  -15.1910 C   0  0  0  0  0  0  0  0  0  0  0  0
> 0.2540  -11.5680  -16.2200 O   0  0  0  0  0  0  0  0  0  0  0  0
>-0.9330  -12.9740  -14.0030 C   0  0  0  0  0  0  0  0  0  0  0  0
>-1.2340  -13.7900  -15.1940 C   0  0  0  0  0  0  0  0  0  0  0  0
>-0.7960  -15.1430  -15.2380 C   0  0  0  0  0  0  0  0  0  0  0  0
>-1.0610  -15.9350  -16.4000 C   0  0  0  0  0  0  0  0  0  0  0  0
>-1.7450  -15.3930  -17.5400 C   0  0  0  0  0  0  0  0  0  0  0  0
>-2.1670  -14.0630  -17.4730 C   0  0  0  0  0  0  0  0  0  0  0  0
>-1.9260  -13.2750  -16.3360 C   0  0  0  0  0  0  0  0  0  0  0  0
>-2.0200  -16.1830  -18.7390 C   0  0  0  0  0  0  0  0  0  0  0  0
>-1.3190  -17.2890  -19.0360 N   0  0  0  0  0  0  0  0  0  0  0  0
>-2.9740  -15.7940  -19.5590 N   0  0  0  0  0  0  0  0  0  0  0  0
> 0.8600   -8.8970  -16.1880 C   0  0  0  0  0  0  0  0  0  0  0  0
> 2.1700   -8.8390  -16.9320 C   0  0  0  0  0  0  0  0  0  0  0  0
> 2.1750   -8.5140  -18.3280 C   0  0  0  0  0  0  0  0  0  0  0  0
> 3.3880   -8.4510  -19.0560 C   0  0  0  0  0  0  0  0  0  0  0  0
> 4.6500   -8.7150  -18.4280 C   0  0  0  0  0  0  0  0  0  0  0  0
> 4.6430   -9.0360  -17.0580 C   0  0  0  0  0  0  0  0  0  0  0  0
> 3.4350   -9.0920  -16.3220 C   0  0  0  0  0  0  0  0  0  0  0  0
> 5.9450   -8.6500  -19.1820 C   0  0  0  0  0  0  0  0  0  0  0  0
> 6.9230   -9.5390  -18.9420 N   0  0  0  0  0  0  0  0  0  0  0  0
> 6.1630   -7.7040  -20.1250 N   0  0  0  0  0  0  0  0  0  0  0  0
>   1  4  1  0
>   1  5  1  0
>   2  3  1  0
>   2  7  1  0
>   2  9  1  6
>   3  4  1  0
>   5  6  1  0
>   6  7  1  0
>   6 19  1  6
>   7  8  2  0
>   9 10  1  0
>  10 11  2  0
>  10 15  1  0
>  11 12  1  0
>  12 13  2  0
>  13 14  1  0
>  13 16  1  0
>  14 15  2  0
>  16 17  2  0
>  16 18  1  0
>  19 20  1  0
>  20 21  2  0
>  20 25  1  0
>  21 22  1  0
>  22 23  2  0
>  23 24  1  0
>  23 26  1  0
>  24 25  2  0
>  26 27  2  0
>  26 28  1  0
> M  END
> """
>
> m2 = Chem.MolFromMolBlock(mol)
>
> newmol2=Chem.FragmentOnBRICSBonds(m2)
> frags=Chem.GetMolFrags(newmol2,asMols=True,sanitizeFrags=True)
> Draw.MolsToGridImage(frags,molsPerRow=4)
> ##
>
> However, some of the fragments are very small. I found that using
> "BRICS.BRICSDecompose" I can set the minimum size of the fragments with
> "minFragmentSize". So I tried the following code
>
> frag = [Chem.GetMolFrags(x) for x in sorted
> (BRICS.BRICSDecompose(m2,minFragmentSize=9))]
>
>
> which didn't work, and I got the following error:
>
>
> ###
>
> ArgumentError Traceback (most recent call last)
>
>   in ()
> > 1 frag = [Chem.GetMolFrags(x) for x in 
> sorted(BRICS.BRICSDecompose(m2,minFragmentSize=9))]
>
>
>   in (.0)
> > 1 frag = [Chem.GetMolFrags(x) for x in 
> 

Re: [Rdkit-discuss] Library enumeration in multiple positions with no cross permutation

2022-07-04 Thread Rafael L via Rdkit-discuss
Hi Carsten
Your code has two problems:
1. [#4] doesn't mean the number of substitutions, [#0] is an indication for
the "non=atom" in SMILES (shown as *)
2. You didn't set the keyword replaceAll to True. Doing this will replace
all matches found.
Therefore, for your code to work properly, replace:
product_mol =
Chem.ReplaceSubstructs(core,Chem.MolFromSmarts('[#4]'),chainMol)
by:
product_mol =
Chem.ReplaceSubstructs(core,Chem.MolFromSmarts('[#0]'),chainMol,
replaceAll=True)

On Mon, Jul 4, 2022 at 5:58 PM Carsten Bauer 
wrote:

> Hello
>
> I want to enumerate a simple molecule having 4 substituents R with a list
> of ca. 100 SMILES.
> For reasons of simply synthesis, in each enumeration of R, the R should be
> the same in all four positions (no cross permutation).
> There is no reaction that covers all 100 SMILES.
>
> I followed
> https://www.rdkit.org/docs/Cookbook.html#sidechain-core-enumeration and
> modified the code proposed by Earnshaw et al. accordingly:
>
> core = Chem.MolFromSmiles(
> '[*]C(C=C1)=CC=C1C(C2=CC=C([*])C=C2)C(C3=CC=C([*])C=C3)C4=CC=C([*])C=C4')
> chains = ['C','CC','CCC','','C','CC']
> chainMols = [Chem.MolFromSmiles(chain) for chain in chains]
>
> product_smi = []
> for chainMol in chainMols:
> product_mol = Chem.ReplaceSubstructs(core,Chem.MolFromSmarts('[#4]'),
> chainMol)
> product_smi.append(Chem.MolToSmiles(product_mol[0]))
> print(product_smi)
>
> which results in
> ['*c1ccc(C(c2ccc(*)cc2)C(c2ccc(*)cc2)c2ccc(*)cc2)cc1',
> '*c1ccc(C(c2ccc(*)cc2)C(c2ccc(*)cc2)c2ccc(*)cc2)cc1',
> '*c1ccc(C(c2ccc(*)cc2)C(c2ccc(*)cc2)c2ccc(*)cc2)cc1',
> '*c1ccc(C(c2ccc(*)cc2)C(c2ccc(*)cc2)c2ccc(*)cc2)cc1',
> '*c1ccc(C(c2ccc(*)cc2)C(c2ccc(*)cc2)c2ccc(*)cc2)cc1',
> '*c1ccc(C(c2ccc(*)cc2)C(c2ccc(*)cc2)c2ccc(*)cc2)cc1’]
>
> This is six times the same compound with no enumeration.
>
> Python beginner here. Can anybody tell me what the mistake is or where I
> can find an example in the literature, please?
>
> Many thanks
> C.
>
>
> ___
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>


-- 
*Rafael da Fonseca Lameiro *
PhD Student - Medicinal and Biological Chemistry Group (NEQUIMED)
São Carlos Institute of Chemistry - University of São Paulo - Brazil
[image: orcid logo 16px] https://orcid.org/-0003-4466-2682
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Cannot get the desired result from AllChem.ReplaceSubstructs

2022-05-16 Thread Rafael L via Rdkit-discuss
To find all compounds that match the ester substructure, you can use
GetSubstructMatches. I would do the following (I'm supposing you have all
your structures in a Pandas dataframe, and that you converted SMILES to
RDKit Mol):

ester_pattern = Chem.MolFromSmarts("COC(C)=O")

# in a pandas dataframe with a column containing your structures as RDKit
Mol objects
df["is_ester"] = df["rdkit_mol"].apply(lambda x:
bool(x.GetSubstructMatches(ester_pattern)))

This will give you a column with 0s and 1s that you can use as a mask. Of
course, there are other ways to do this, like using a for loop.
Now, to replace the esters by the disulfide group, if you can't manage to
work with reaction SMARTS, you could try using Python strings' replace()
method on SMILES. I believe esters can be represented in two ways (left to
right and right to left), so keep that in mind. You can always use
GetSubstructMatches later to see if any ester was left behind.
Regards.

On Sun, May 15, 2022 at 1:33 AM Ming Hao  wrote:

> Hi All,
>
> I want to replace the ester structure ('COC(C)=O') with disulfide ('CSSC')
>
> [image: image.png]
>
> Here is what I did, but it does not work. It seems to need specified
> methods to replace the original structure with the new one, not just put
> individual SMILES there.
>
> ##
> from rdkit import Chem
> from rdkit.Chem import AllChem, Draw
> from rdkit.Chem.Draw import IPythonConsole
>
> orgsmi = 'CCOC(=O)CN(CC)(=O)OC(C)CC'
> m = Chem.MolFromSmiles(orgsmi)
> m
>
> pat = Chem.MolFromSmiles('COC(C)=O')
> pat
>
> rep = Chem.MolFromSmiles('CSSC')
> rep
>
> new = AllChem.ReplaceSubstructs(m, pat, rep)
> new[0] # The structure was separated
> new[1]  # The structure was separated
> len(new)
> #
>
> Can you help me with this? By the way, I have 10K structures, and first I
> need to find the compounds with the pattern (ester, COC(C)=O) and replace
> them with disulfide ('CSSC'). What is a good way to do this?
>
> Thanks.
> Ming
> ___
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>


-- 
*Rafael da Fonseca Lameiro *
PhD Student - Medicinal and Biological Chemistry Group (NEQUIMED)
São Carlos Institute of Chemistry - University of São Paulo - Brazil
[image: orcid logo 16px] https://orcid.org/-0003-4466-2682
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Tautomers in drug like molecules

2022-03-31 Thread Rafael L via Rdkit-discuss
I have never used it, but RDKit has functionality to standardize the
representation, as described here:
https://bitsilla.com/blog/2021/06/standardizing-a-molecule-using-rdkit/. I
couldn't say if either approach is better/worse than the other. With
tautomers, my guess is that you have to either be consistent with the
representation, or use the tautomeric form that is most relevant to your
work. You can use quantum chemistry to calculate the most stable form (
https://pubs.acs.org/doi/10.1021/acs.jcim.0c00232), but even then, the most
stable form may not be the most relevant, or the forms may exist in approx.
equal proportions, etc.

On Thu, Mar 31, 2022 at 12:57 PM Marawan Hussien via Rdkit-discuss <
rdkit-discuss@lists.sourceforge.net> wrote:

> Hi,
>
> I am wondering if anyone has made use (in the form of code, scripts, etc)
> of this database to identify canonical tautomers or the most stable
> ensemble of tautomers for organic, drug-like molecules:
> https://github.com/WahlOya/Tautobase
>
> The attached reference also looks very very detailed:
>
>
> https://figshare.com/articles/preprint/The_Prediction_of_Tautomer_Preference_in_Aqueous_Solution_Version_1_0_/8966276/1
>
> Thanks,
> Marawan
> ___
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>


-- 
*Rafael da Fonseca Lameiro *
PhD Student - Medicinal and Biological Chemistry Group (NEQUIMED)
São Carlos Institute of Chemistry - University of São Paulo - Brazil
[image: orcid logo 16px] https://orcid.org/-0003-4466-2682
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Find structures with "non-organic" atoms

2022-03-07 Thread Rafael L via Rdkit-discuss
Thank you, all! Here is my Python implementation for anyone interested:

# Check for compounds with "non-organic" atoms
not_organic_pat =
Chem.MolFromSmarts("[!#5;!#6;!#7;!#8;!#16;!#15;!F;!Cl;!Br;!I;!#1]")
#  not_organic_pat =
Chem.MolFromSmarts("[!#6;!#8;!#7;!#16;!#15;!F;!Cl;!Br;!I;!Na;!K;!Mg;!Ca;!Li;!#1]")

def non_organic(smi):
mol = Chem.MolFromSmiles(smi)
return bool(mol.GetSubstructMatch(not_organic_pat))

--
*Rafael da Fonseca Lameiro*
PhD Student - Medicinal and Biological Chemistry Group (NEQUIMED)
São Carlos Institute of Chemistry - University of São Paulo - Brazil
[image: orcid logo 16px] https://orcid.org/-0003-4466-2682
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


[Rdkit-discuss] Find structures with "non-organic" atoms

2022-03-05 Thread Rafael L via Rdkit-discuss
Dear all, I remember having used some SMARTS-based function to flag
structures containing "non-organic" atoms. It seems that there is a knime
node for that (
https://forum.knime.com/t/rdkit-molecule-substructure-filter-incorrectly-matches-aromatic-sulfur-atoms-molecule-as-metal-containing-compounds/12935),
but I wasn't able to find any Python implementations. Does anyone know
where to find it?
Thanks in advance

--
*Rafael da Fonseca Lameiro*
PhD Student - Medicinal and Biological Chemistry Group (NEQUIMED)
São Carlos Institute of Chemistry - University of São Paulo - Brazil
[image: orcid logo 16px] https://orcid.org/-0003-4466-2682
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] MFP question about similar substructures and feature reduction

2021-09-29 Thread Rafael L via Rdkit-discuss
Hello, your question prompted me to write a small notebook, which I hope
you may find useful:
https://github.com/rflameiro/projects/blob/main/comparing_fingerprint_bits.ipynb

In summary, bits that are active in both fingerprints usually correspond to
the same substructure, unless bit collision happens. You can verify that by
drawing the substructure that activates a certain bit using the
function Draw.DrawMorganBit().

-- What happens if the 2048 bits or substructures predesignated in rdkit do
not contain a new substructure in a molecule we are evaluating?
If I understand correctly, you want to know what will a fingerprint look
like for a molecule that doesn't have new substructures compared to a
previously calculated fingerprint. In this case, the new fingerprint will
be the same (although this is more common when working with MACCS
fingerprints, which work with a predetermined set of substructures), or the
new molecule will have less substructures than the previous one, and less
bits will be active.

-- Any advice on how to reduce features and then use that reduced feature
list for new molecules after training a model would also be appreciated.
How would the model only extract the reduced bits for a new ligand if I
remove low variance bits from the training set for example?
To build models on fingerprints, you can start using the complete set of
2048 bits, and compare the performance with fingerprints containing less
bits (1024, 512...). A good starting point is:
https://www.moreisdifferent.com/2017/9/21/DIY-Drug-Discovery-using-molecular-fingerprints-and-machine-learning-for-solubility-prediction/
You should see a drop in performance as the bit size decreases, as bit
collisions are more likely.
Alternatively, you could try reducing the dimensionality by using a
technique such as PCA, but use enough PCs to get a reasonable explained
variance percentage. It is easy to calculate PCs with scikit-learn. Then,
to apply it in new fingerprints, you will only have to call .transform().
See:
https://stackabuse.com/implementing-pca-in-python-with-scikit-learn/

Em seg., 27 de set. de 2021 às 20:35, Natasha Gupta 
escreveu:

> Hello,
>
> Apologies. this is a very basic question:
> If I am converting many ligands into morgan fingerprints, could I
> theoretically stack the bit representations on top of each other to get the
> same features represented across ligands? For example is the below
> representation correct?
>
> | sample | feature1 | feature2 | feature3 |
> |:   |::|::|-:|
> | 1  | bit 1| bit 2| bit 3|
> | 2  | bit 1| bit 2| bit 3|
> | 3  | bit 1| bit 2| bit 3|
>
> So basically is feature 1, 2, 3 etc always one type of substructure no
> matter what the input molecule is? What happens if the 2048 bits or
> substructures predesignated in rdkit do not contain a new substructure in a
> molecule we are evaluating?
>
> Any advice on how to reduce features and then use that reduced feature
> list for new molecules after training a model would also be appreciated.
> How would the model only extract the reduced bits for a new ligand if I
> remove low variance bits from the training set for example?
>
> ___
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>


-- 
Rafael da Fonseca Lameiro
[image: orcid logo 16px] https://orcid.org/-0003-4466-2682
Aluno de Doutorado - Grupo de Química Medicinal e Biológica (NEQUIMED)
Instituto de Química de São Carlos - Universidade de São Paulo - Brasil
Av. Trabalhador Sancarlense, 400 - CEP: 13566-590 - São Carlos/SP
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] compute canonical transform of a conformer fails

2021-04-21 Thread Rafael L via Rdkit-discuss
I tested your code on several structures and noticed that it failed on
molecules with only one element (NH3, OH2...).
Then I checked
https://www.rdkit.org/docs/source/rdkit.Chem.rdMolTransforms.html and saw
that the default ignores hydrogens. So try
Chem.rdMolTransforms.ComputeCanonicalTransform(conf, ignoreHs=False) in the
last line and see if it fixes your problem.
Regards

Em qua., 21 de abr. de 2021 às 07:21, Pablo Ramos 
escreveu:

> Dear community,
>
>
>
> I want to pick a fragment from a molecule, and canonicalize its conformer
> in order to align its principal moments of inertia. However, this does not
> seem to work. Any idea why this could be happening?
>
>
>
> mol1 = Chem.MolFromSmiles('[H]C([H])=O.[H]N([H])[H]')
>
> mol1 = Chem.AddHs(mol1)
>
> for fragment in Chem.GetMolFrags(mol1, asMols=True):
>
> AllChem.EmbedMolecule(fragment, useRandomCoords=False)
>
> conf = fragment.GetConformer()
>
> Chem.rdMolTransforms.ComputeCanonicalTransform(conf)
>
>
>
> RuntimeError: Invariant Violation
>
>
>
> Violation occurred on line 298 in file
> Code/GraphMol/MolTransforms/MolTransforms.cpp
>
> Failed Expression: dim >= 1
>
> RDKIT: 2021.03.1
>
> BOOST: 1_74
>
>
>
>
>
> Best regards,
>
>
>
> *Pablo Ramos*
> Ph.D. at Covestro Deutschland AG
>
>
>
>
>
> covestro.com 
>
> *Telephone*
>
> +49 214 6009 7356
>
>
>
> Covestro Deutschland AG
>
> COVDEAG-Chief Commer-PUR-R
>
> B103, R164
>
> 51365 Leverkusen, Germany
>
> *pablo.ra...@covestro.com *
>
>
>
>
> ___
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>


-- 
Rafael da Fonseca Lameiro
[image: orcid logo 16px] https://orcid.org/-0003-4466-2682
PhD Student - Medicinal and Biological Chemistry Group (NEQUIMED)
São Carlos Institute of Chemistry - University of São Paulo - Brazil
Av. Trabalhador Sancarlense, 400 - ZIP code: 13566-590 - São Carlos/SP
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss