Hi Libby,

If you are looking for the fragments that do not have a negatively charged
atom you can do this:

In [15]: m = Chem.MolFromSmiles('CCC(=O)[O-].[Na+]')

In [16]: qa = rdqueries.FormalChargeLessQueryAtom(0)

In [17]: keep = [x for x in Chem.GetMolFrags(m,asMols=True) if not
len(x.GetAto
    ...: msMatchingQuery(qa))]


In [18]: [Chem.MolToSmiles(x) for x in keep]
Out[18]: ['[Na+]']


If you're looking for fragments that don't have a net negative charge you
can use Chem.GetFormalCharge():

In [20]: keep = [x for x in Chem.GetMolFrags(m,asMols=True) if
Chem.GetFormalCharge(x)>=0]

In [21]: [Chem.MolToSmiles(x) for x in keep]
Out[21]: ['[Na+]']


I hope that helps.
-greg


On Mon, Mar 5, 2018 at 6:39 AM, Phipps, Elizabeth C <ephip...@tulane.edu>
wrote:

> Hi,
>
> We are trying to isolate a negatively charged element from a molecule. For
> example if you have a reactant NaI, we want to get just I from the smiles
> string [Na+].[I-]. We are wondering if there is a way to get [I-] from this
> smiles string. Is there a function that can search for a negatively charged
> part of a molecule, or do you have any suggestions for creating one?
>
> Thanks!
> Libby
>
> ------------------------------------------------------------
> ------------------
> 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