RGroupQuery
<http://cdk.github.io/cdk/2.1/docs/api/index.html?org/openscience/cdk/isomorphism/matchers/RGroupQuery.html>
.getAllConfigurations
<http://cdk.github.io/cdk/2.1/docs/api/org/openscience/cdk/isomorphism/matchers/RGroupQuery.html#getAllConfigurations-->
()
Full Example:
https://gist.github.com/johnmay/84d49e537c31457d738c21ed6dec26ae.
*Important:* note I define the correct valence ahead of time so I don't
need to re-type the atom every time :-).
IAtomContainer root =
> smipar.parseSmiles("CC1=CC=NC2=C1C=CC(=C2)C1=CC([R1])=C([R2])C([R3])=C1");
Map<IAtom, Map<Integer,IBond>> rootAttach = new HashMap<>();
> Map<Integer,RGroupList> rgrpMap = new HashMap<>();
> defineRgroup(root, rootAttach, rgrpMap, "R1",
> newRGroupList("[H].[CH2]CO.[CH2]Cl", 1));
> defineRgroup(root, rootAttach, rgrpMap, "R2",
> newRGroupList("[H].[CH2]CN.[CH2]F", 2));
> defineRgroup(root, rootAttach, rgrpMap, "R3",
> newRGroupList("[H].[CH2]CCl.[CH2]F", 3));
>
> RGroupQuery query = new RGroupQuery(bldr);
> query.setRootStructure(root);
> query.setRootAttachmentPoints(rootAttach);
> query.setRGroupDefinitions(rgrpMap);
>
> SmilesGenerator smigen = new SmilesGenerator(SmiFlavor.Isomeric);
> for (IAtomContainer mol : query.getAllConfigurations()) {
> System.out.println(smigen.create(mol));
> }
Mark Rijnbeek wrote these classes for OrChem matching, they're a little bit
clunky as the API is very specific to RGRP CTfiles. For example the API
only allows 'set' and not 'add'. Efficiency could be improved,
getAllConfigurations() could be lazy (using an iterator). I've been meaning
to update the API to be easier and handle attachment points the way
CXSMILES does.
SMILES concatenation is super quick (e.g. SmiLib: http://melolab.org/smilib/)
and useful but limited.
I would also ask why you need it? Is it for matching? If so then
enumeration is the wrong way to do Markush matching, SMARTS get's you most
of the way where with recursion $(...) but you need to avoid matches back
on already mapped parts - CACTVS provides $$(...) syntax to do this. Also
the way recursion is handled in the CDK is also sub-optimial but have been
working on rewriting the SMARTS stack over Xmas.
John
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Cdk-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user