Hi,

any help with this issue would be very much appreciated,

Kind regards,
Martin

-------- Originalnachricht --------
Betreff: Re: how to print SMARTS pattern without hydrogens
Datum: 02.12.2014 12:00
On 30 September 2014 at 09:30, Martin Guetlein
<martin.guetl...@googlemail.com> wrote:
> 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

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&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