Hi,

I am currently migrating from cdk1.4 to 1.5. I am mining the maximum
common subgraph of two compounds and then print the resulting fragment
as SMARTS. This is working in 1.4, however in 1.5 the SmilesGenerator
is adding unwanted Hydrogens. How can I get rid of the Hydrogens?
See example below.
See also 
https://www.mail-archive.com/cdk-user@lists.sourceforge.net/msg02597.html

Thanks and kind regards,
Martin

The following code prints "mcs: c(c[cH])c[cH]" instead of "mcs: ccccc"
[[
SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
IAtomContainer mol1 = sp.parseSmiles("c1ccccc1NC");
IAtomContainer mol2 = sp.parseSmiles("c1cccnc1");
org.openscience.cdk.smsd.Isomorphism mcsFinder = new
org.openscience.cdk.smsd.Isomorphism(
org.openscience.cdk.smsd.interfaces.Algorithm.DEFAULT, true);
mcsFinder.init(mol1, mol2, true, true);
mcsFinder.setChemFilters(true, true, true);

mol1 = mcsFinder.getReactantMolecule();
IAtomContainer mcsmolecule =
DefaultChemObjectBuilder.getInstance().newInstance(IAtomContainer.class,
mol1);
List<IAtom> atomsToBeRemoved = new ArrayList<IAtom>();
for (IAtom atom : mcsmolecule.atoms())
{
int index = mcsmolecule.getAtomNumber(atom);
if (!mcsFinder.getFirstMapping().containsKey(index))
atomsToBeRemoved.add(atom);
}
for (IAtom atom : atomsToBeRemoved)
mcsmolecule.removeAtomAndConnectedElectronContainers(atom);

// has no effect
// mcsmolecule = AtomContainerManipulator.removeHydrogens(mcsmolecule);

SmilesGenerator g = new SmilesGenerator().aromatic();
System.out.println("mcs: " + g.create(mcsmolecule));
]]

-- 
Dipl-Inf. Martin Gütlein
Phone:
+49 (0)761 203 8442 (office)
+49 (0)177 623 9499 (mobile)
Email:
guetl...@informatik.uni-freiburg.de

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Cdk-user mailing list
Cdk-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to