I think getSubgraphAtomsMaps() calls makeAtomsMapsOfBondsMaps(). However, your
email gave me an idea. It appears you need at least 3 atoms in the smarts
string for the atom mapping to work:
<jython-code>
import org.openscience.cdk as CDK
U = CDK.isomorphism.UniversalIsomorphismTester
mol = CDK.smiles.SmilesParser().parseSmiles('OCCC=CCO')
smarts = CDK.smiles.smarts.SMARTSParser.parse('CCO')
bondMatches = U.getSubgraphMaps(mol, smarts)
for match in bondMatches:
print 'BondMatch:',
for rMap in match:
print '%d-%d' % (rMap.getId1(), rMap.getId2()),
print
atomMatches = U.getSubgraphAtomsMaps(mol, smarts)
for match in atomMatches:
print 'AtomMatch: ', match
</jython-code>
<output>
BondMatch: 0-1 1-0
BondMatch: 4-0 5-1
AtomMatch: [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]
AtomMatch: [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]
</output>
Stephen.
---
Stephen Pascoe 01235 445980
Climateprediction.net data scientist
Rutherford Appleton Laboratory, CCLRC
-----Original Message-----
From: Nina Jeliazkova [mailto:[EMAIL PROTECTED]
Sent: 20 December 2005 15:11
To: Pascoe, S (Stephen)
Cc: [email protected]
Subject: Re: [Cdk-user] Using UniversalIsomorphismTester to detect functional
groups
Hi,
There are two static methods in UniversalIsomorphismTester class which can be
used to convert bond maps to atom maps.
public static List makeAtomsMapsOfBondsMaps(List l, AtomContainer g1,
AtomContainer g2) public static List makeAtomsMapOfBondsMap(List l,
AtomContainer g1, AtomContainer g2)
Haven't tried with jython, but works nice from java.
Regards,
Nina
"Pascoe, S (Stephen)" <[EMAIL PROTECTED]> wrote:
> I've been trying to use the smarts facilities of CDK to detect
> functional groups within SMILES strings. The
> UniversalIsomorphismTester.getSubgraph*() methods seem to be what I
> want. I can get the bond mapping to work but the
> UniversalIsomorphismTest.getSubgraphAtomsMaps() method doesn't seem to
> work. Below is some Jython code to illustrate my point. I hope it's
> self explanitory even for those not familiar with python:
>
> <jython-code>
>
> import org.openscience.cdk as CDK
> U = CDK.isomorphism.UniversalIsomorphismTester
>
> mol = CDK.smiles.SmilesParser().parseSmiles('OCCC=CCO')
> smarts = CDK.smiles.smarts.SMARTSParser.parse('CO')
>
> bondMatches = U.getSubgraphMaps(mol, smarts)
>
> for match in bondMatches:
> print 'BondMatch:',
> for rMap in match:
> print '%d-%d' % (rMap.getId1(), rMap.getId2())
>
> atomMatches = U.getSubgraphAtomsMaps(mol, smarts)
>
> for match in atomMatches:
> print 'AtomMatch: ', match
>
> </jython-code>
>
> <output>
> BondMatch: 0-0
> BondMatch: 5-0
> AtomMatch: []
> AtomMatch: []
> </output>
>
> The atom mapping are empty, even though the bond mappings are correct.
> Am I missunderstanding the purpose of getSubgraphAtomsMaps()?
> Converting from a bond mapping to an atom mapping doesn't look easy,
> since a bond could match in either direction (e.g. above the first
> match is an O-C bond, the second match is a C-O bond). Is there a
> facility in CDK to do this?
>
> Thanks,
> Stephen
>
> ---
> Stephen Pascoe 01235 445980
> Climateprediction.net data scientist
> Rutherford Appleton Laboratory, CCLRC
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log
> files for problems? Stop! Download the new AJAX search engine that
> makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_idv37&alloc_id865&opÌk
> _______________________________________________
> Cdk-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/cdk-user
>
--
------------------------------------------------------------------
Assoc. Prof. Dr. Nina Nikolova-Jeliazkova
* * Institute for Parallel Processing
* * Bulgarian Academy of Sciences
* IST Foundation * Acad. G. Bonchev St 25-A
* The Bulgarian NREN * 1113 Sofia, Bulgaria
* * Tel: +359 886 802011
* * ICQ: 10705013
http://www.ist.bg www: http://ambit.acad.bg/nina
------------------------------------------------------------------
PGP Public Key
http://cert.acad.bg/pgp-keys/keys/nina-nikolova-0xEEABA669.asc
8E99 8BAD D804 1A43 27B7 7F87 CF04 C7D1 EEAB A669
------------------------------------------------------------------
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Cdk-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user