Rajarshi Guha wrote:

Ok, now hydrogen adder is working and atom count is correct, thank you.

Please can you solve another doubt?
Into the ethane molecule I have to search a substructure whose pattern 
is specified by this SMARTS:

C(~C)(~H)

the code should be this:

IMolecularDescriptor descriptor = new AromaticBondsCountDescriptor();
Object[] params = {true};
descriptor.setParameters(params);

IAtomContainer ac = sp.parseSmiles("CC");

CDKHueckelAromaticityDetector.detectAromaticity(ac);
CDKHydrogenAdder hd = 
CDKHydrogenAdder.getInstance(DefaultChemObjectBuilder.getInstance());
hd.addImplicitHydrogens(ac);
AtomContainerManipulator.convertImplicitToExplicitHydrogens(ac);

String pattern=?????? // What is the correct string to use here?

SMARTSQueryTool querytool = new SMARTSQueryTool(pattern);   
boolean result = querytool.matches(ac);
System.out.println(result);

What is the correct string to use as pattern?

Best Regards, Thank you


GF

>
> It's a good idea to use the current code from SVN since hydrogen 
> addition and aromaticity detection has been very much improved.
>
> The following code (based on the nightly build) works correctly:
>
>    IMolecularDescriptor descriptor = new AromaticBondsCountDescriptor();
>    Object[] params = {true};
>    descriptor.setParameters(params);
>
>    SmilesParser sp = new 
> SmilesParser(DefaultChemObjectBuilder.getInstance());
>    IAtomContainer mol = sp.parseSmiles("c1ccccc1"); // ethanol
>
>    CDKHueckelAromaticityDetector.detectAromaticity(mol);
>    CDKHydrogenAdder hd = 
> CDKHydrogenAdder.getInstance(DefaultChemObjectBuilder.getInstance());
>    hd.addImplicitHydrogens(mol);
>    AtomContainerManipulator.convertImplicitToExplicitHydrogens(mol);
>
>    System.out.println(mol.getAtomCount());
>
> -------------------------------------------------------------------
> Rajarshi Guha  <[EMAIL PROTECTED]>
> GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04  06F7 1BB9 E634 9B87 56EE
> -------------------------------------------------------------------
> All the passions make us commit faults; love makes us commit the most
> ridiculous ones.
>     -- La Rochefoucauld
>
>


-- 
Gianfranco Frau
CRS4 - Bioinformatics
Phone +39 070 9250 438
Loc. Pixina Manna Edificio 1 Pula 09010 (CA), Italy
http://www.bioinformatica.crs4.org
msn contact: [EMAIL PROTECTED]


-------------------------------------------------------------------------
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Cdk-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to