Hi, Alexis,

Why don’t you output the molecule as “Smiles” format since the “Smarts” you 
wanted to output was really a molecule.

And it is possible to remove the dummy atom via mol object. For example:

In [26]: x = Chem.MolFromSmiles('CC*')

In [27]: x.GetSubstructMatch(Chem.MolFromSmiles('*'))
Out[27]: (2,)

In [28]: mw = Chem.RWMol(x)

In [29]: mw.RemoveAtom(2)

In [30]: Chem.MolToSmiles(mw)
Out[30]: 'CC'

But I don’t know whether it can handle SMARTS. Hope that it is helpful for you.

Hongbin Yang 

> On 14 Jul 2017, at 4:59 PM, Alexis Parenty <alexis.parenty.h...@gmail.com> 
> wrote:
> 
>  <>Dear Rdkiters,
> 
> 
> 
> I sometimes get smarts from mol in atomic number notation such as:
> 
> [#6]-[#7+]1=[#6]2-[#6]3:[#7]:[#6]:[#6]:[#6]:[#6]:3-[#6]3:[#6]:[#6]:[#6]:[#6]:[#6]:3-[#7]-2-[#6]-[#6]-1
> 
> 
> 
> Is there a way to force the method Chem.MolToSmarts(mol) to output a smarts 
> using alphabetic letters instead of atomic numbers?
> 
> The reason I am asking is because I need to remove dummy atoms [*] from 
> smarts using string manipulation and I would rather use only one method. 
> Unless I can do that from the mol object?
> 
> 
> 
> Many thanks,
> 
> 
> 
> Alexis
> 
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! 
> http://sdm.link/slashdot_______________________________________________
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to