Hi,

On Fri, Nov 26, 2010 at 6:04 PM, [email protected] <[email protected]> wrote:
> I'm playing with the Postgres cartridge and built a small database to
> make some tests. I see from the wiki pages I can do substructures and
> superstructures search with the @> and <@ operators but there's no
> mention of a "=" operator.
>
> The question is, what if I want to search the exact input structure in
> my DB? is '=' implemented and just not documented or should I use one
> of the other operators to do the search?

At the moment there isn't a particularly satisfying way of doing an
equality search aside from adding a smiles column to the database and
just doing a straight equality search on that.
To that end it's probably useful to know that the smiles generated by
the cartridge when you convert a molecule to text is canonical. So one
way to get canonical smiles to query with is:
select 'CC(=O)c1ccc2c(C(=O)C(=O)N2C)c1'::mol::text;

Without adding the smiles column, another option that should be
correct, though it's somewhat ugly, is:
select * from mols where m<@'CC(=O)c1ccc2c(c1)C(=O)C(=O)N2C' and
m@>'CC(=O)c1ccc2c(c1)C(=O)C(=O)N2' and
m::text='CC(=O)c1ccc2c(c1)C(=O)C(=O)N2C'::mol::text;

If the molecule column is indexed, this will use the index so it's
actually reasonably efficient. If you don't care about stereochemistry
you can leave the last bit (SMILES comparison) out.

Having a less ugly way of doing equality querying would be useful;
that would be a good feature request.

-greg

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to