Re: [Rdkit-discuss] How to get substructure matches with different atoms?

2019-07-25 Thread Omar H94
Dear Masgils,
Try:
AllChem.GetBestRMS(mols[0],mols[1],map=[list(zip(a,b))])
I hope this works.

Regards,
Omar




On Fri, Jul 26, 2019 at 4:52 AM Masgils  wrote:

> Dear Paolo,
> Thank you very much. It was very helpful.
> I get atom idx of the corresponding structure in each molecule successful!
> But there is another problem.
>
> When I used:
>
> a = mols[0].GetSubstructMatch(generic)
> b = mols[1].GetSubstructMatch(generic)
> AllChem.GetBestRMS(mols[0],mols[1],map=list(zip(a,b)))
>
> The AllChem.GetBestRMS arise a ValueError:
>
> ---
> ValueError Traceback (most recent call last)
>  in 
> 1 a = mols[0].GetSubstructMatch(generic)
> 2 b = mols[1].GetSubstructMatch(generic)
> > 3 AllChem.GetBestRMS(mols[0],mols[1],map=list(zip(a,b)))
>
> ValueError: sequence does not support length query
>
> Is its usage different from the atomMap parameter in Chem.
> rdMolAlign.AlignMol?
>
> Best Regards,
> M.
>
> At 2019-07-26 01:07:13, "Paolo Tosco"  wrote:
>
> Dear Masgils,
>
> you may try something along these lines, i.e. make atoms and/or bonds
> generic on one of the molecules with rdmolops.AdjustQueryProperties() in
> order to get subtructures to match, and then use rdMolAlign.GetBestRMS():
>
> piperidine = 
> Chem.AddHs(Chem.MolFromSmiles("C1CC(C)CCN1"))AllChem.EmbedMolecule(piperidine)AllChem.MMFFOptimizeMolecule(piperidine)piperidine_noh
>  = Chem.RemoveHs(piperidine)
>
> piperazine = 
> Chem.AddHs(Chem.MolFromSmiles("C1CN(C)CCN1"))AllChem.EmbedMolecule(piperazine)AllChem.MMFFOptimizeMolecule(piperazine)piperazine_noh
>  = Chem.RemoveHs(piperazine)
>
> piperidine_noh
>
> piperazine_noh
>
> piperidine_noh.GetSubstructMatches(piperazine_noh)
>
> ()
>
> params = AllChem.AdjustQueryParameters()
>
> params.makeAtomsGeneric = True
>
> params.makeBondsGeneric = True
>
> piperazine_noh_generic = AllChem.AdjustQueryProperties(
> piperazine_noh, params)
>
> piperazine_noh_generic
>
> piperidine_noh.GetSubstructMatches(piperazine_noh_generic)
>
> ((0, 1, 2, 3, 4, 5, 6),)
>
> AllChem.GetBestRMS(piperazine_noh_generic, piperidine_noh)
>
> 0.39432427325884206
>
>
> Hope this helps, cheers
> p.
>
> On 07/25/19 16:53, Masgils wrote:
>
> Hi, all
>
> Is it possible use GetSubstructMatches() to match a substructure with one or 
> two atom different from ref_mol? (eg. a Piperidine ring and a Piperazing ring)
>
> And how to get the RMSD between corresponding atoms of two substructures?
>
>
>
>
>
> ___
> Rdkit-discuss mailing 
> listRdkit-discuss@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
>
>
>
>
> ___
> 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


Re: [Rdkit-discuss] How to get substructure matches with different atoms?

2019-07-25 Thread Masgils
Dear Paolo,
Thank you very much. It was very helpful.
I get atom idx of the corresponding structure in each molecule successful!
But there is another problem.

When I used:

a = mols[0].GetSubstructMatch(generic)
b = mols[1].GetSubstructMatch(generic)
AllChem.GetBestRMS(mols[0],mols[1],map=list(zip(a,b)))

The AllChem.GetBestRMS arise a ValueError:

---
ValueError Traceback (most recent call last)
 in 
1 a = mols[0].GetSubstructMatch(generic)
2 b = mols[1].GetSubstructMatch(generic)
> 3 AllChem.GetBestRMS(mols[0],mols[1],map=list(zip(a,b)))

ValueError: sequence does not support length query

Is its usage different from the atomMap parameter in Chem. rdMolAlign.AlignMol?

Best Regards,
M.

At 2019-07-26 01:07:13, "Paolo Tosco"  wrote:


Dear Masgils,

you may try something along these lines, i.e. make atoms and/or bonds generic 
on one of the molecules withrdmolops.AdjustQueryProperties() in order to get 
subtructures to match, and then use rdMolAlign.GetBestRMS():


piperidine=Chem.AddHs(Chem.MolFromSmiles("C1CC(C)CCN1"))AllChem.EmbedMolecule(piperidine)AllChem.MMFFOptimizeMolecule(piperidine)piperidine_noh=Chem.RemoveHs(piperidine)
piperazine=Chem.AddHs(Chem.MolFromSmiles("C1CN(C)CCN1"))AllChem.EmbedMolecule(piperazine)AllChem.MMFFOptimizeMolecule(piperazine)piperazine_noh=Chem.RemoveHs(piperazine)
piperidine_noh
piperazine_noh
piperidine_noh.GetSubstructMatches(piperazine_noh)
()
params=AllChem.AdjustQueryParameters()
params.makeAtomsGeneric=True
params.makeBondsGeneric=True
piperazine_noh_generic=AllChem.AdjustQueryProperties(piperazine_noh,params)
piperazine_noh_generic
piperidine_noh.GetSubstructMatches(piperazine_noh_generic)
((0, 1, 2, 3, 4, 5, 6),)
AllChem.GetBestRMS(piperazine_noh_generic,piperidine_noh)
0.39432427325884206


Hope this helps, cheers
p.


On 07/25/19 16:53, Masgils wrote:

Hi, all

Is it possible use GetSubstructMatches() to match a substructure with one or 
two atom different from ref_mol? (eg. a Piperidine ring and a Piperazing ring)

And how to get the RMSD between corresponding atoms of two substructures?





___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/rdkit-discuss

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


Re: [Rdkit-discuss] How to get substructure matches with different atoms?

2019-07-25 Thread Paolo Tosco

Dear Masgils,

you may try something along these lines, i.e. make atoms and/or bonds 
generic on one of the molecules withrdmolops.AdjustQueryProperties() in 
order to get subtructures to match, and then use rdMolAlign.GetBestRMS():


piperidine  =  Chem.AddHs(Chem.MolFromSmiles("C1CC(C)CCN1"))
AllChem.EmbedMolecule(piperidine)
AllChem.MMFFOptimizeMolecule(piperidine)
piperidine_noh  =  Chem.RemoveHs(piperidine)

piperazine  =  Chem.AddHs(Chem.MolFromSmiles("C1CN(C)CCN1"))
AllChem.EmbedMolecule(piperazine)
AllChem.MMFFOptimizeMolecule(piperazine)
piperazine_noh  =  Chem.RemoveHs(piperazine)

piperidine_noh

piperazine_noh

piperidine_noh.GetSubstructMatches(piperazine_noh)

()

params  =  AllChem.AdjustQueryParameters()

params.makeAtomsGeneric  =  True

params.makeBondsGeneric  =  True

piperazine_noh_generic  =  AllChem.AdjustQueryProperties(
piperazine_noh,  params)

piperazine_noh_generic

piperidine_noh.GetSubstructMatches(piperazine_noh_generic)

((0, 1, 2, 3, 4, 5, 6),)

AllChem.GetBestRMS(piperazine_noh_generic,  piperidine_noh)

0.39432427325884206


Hope this helps, cheers
p.

On 07/25/19 16:53, Masgils wrote:

Hi, all

Is it possible use GetSubstructMatches() to match a substructure with one or 
two atom different from ref_mol? (eg. a Piperidine ring and a Piperazing ring)

And how to get the RMSD between corresponding atoms of two substructures?





___
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


[Rdkit-discuss] How to get substructure matches with different atoms?

2019-07-25 Thread Masgils
Hi, all

Is it possible use GetSubstructMatches() to match a substructure with one or 
two atom different from ref_mol? (eg. a Piperidine ring and a Piperazing ring)

And how to get the RMSD between corresponding atoms of two substructures?





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


Re: [Rdkit-discuss] Adding molecules to pandas dataframe

2019-07-25 Thread Greg Landrum
Hi Gianluca,

This one turns out to be pretty easy: you just add the molecules as a
column and then call:
PandasTools.RenderImagesInAllDataFrames(images=True)
Or, if you just want to change the rendering for a single DataFrame, you
can call:
PandasTools.ChangeMoleculeRendering(df)

Here's a gist demonstrating:
https://gist.github.com/greglandrum/914ae66fd2f97addbbd472ae726567b1

-greg


On Thu, Jul 25, 2019 at 4:45 PM Gianluca Sforna  wrote:

> Hi all,
> is it possible to manually add molecules to a pandas dataframe? I am
> reading a bunch of mol2 files, adding some properties (including some
> atom highlighting), then I'd like to add the resulting molecule to the
> dataframe in order to show its depiction along with the data.
> However, API docs and examples I found around always assume you have a
> SMILES string to start with.
>
> Any pointers?
>
> --
> Gianluca Sforna
>
>
> ___
> 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


Re: [Rdkit-discuss] Adding molecules to pandas dataframe

2019-07-25 Thread Christos Kannas
Hi Gianluca,

Yes you can do that.

You create a list of molecule objects from the mol2 files and then you
assign this list to a new column in your dataframe.
I.e. (Pythopsuedocode...)

mols = list()
for mol2 in mol2_files:
mol = Chem.MolFromMol2(mol2)
mols.append(mol)

df["Molecule"] = mols

Best,

Christos

Christos Kannas

Scientific Software Developer (Cheminformatics)


On Thu, 25 Jul 2019 at 15:45, Gianluca Sforna  wrote:

> Hi all,
> is it possible to manually add molecules to a pandas dataframe? I am
> reading a bunch of mol2 files, adding some properties (including some
> atom highlighting), then I'd like to add the resulting molecule to the
> dataframe in order to show its depiction along with the data.
> However, API docs and examples I found around always assume you have a
> SMILES string to start with.
>
> Any pointers?
>
> --
> Gianluca Sforna
>
>
> ___
> 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


[Rdkit-discuss] Adding molecules to pandas dataframe

2019-07-25 Thread Gianluca Sforna
Hi all,
is it possible to manually add molecules to a pandas dataframe? I am
reading a bunch of mol2 files, adding some properties (including some
atom highlighting), then I'd like to add the resulting molecule to the
dataframe in order to show its depiction along with the data.
However, API docs and examples I found around always assume you have a
SMILES string to start with.

Any pointers?

-- 
Gianluca Sforna


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