On 13/01/2011 12:39, NGUYEN Thanh Binh wrote:
> I have taken the database with SMILES from DIPPR. Now i want to use
> C++ in order to read these structures SMILES and give me the result
> with the number of the functions within it.
> For example : i have a SMILES C=CCC. It means that we have a substance
> : CH2=CH-CH2-CH3. The result that we can have is:
> number of CH2= : 01
> number of CH= : 01
> number of CH2 : 01
> number of CH3 : 01
> Is it available this code C++ on your open babel ? If possible, can
> you tell me something about it ?

Use SMARTS ( 
http://www.daylight.com/dayhtml/doc/theory/theory.smarts.html ) to 
define the groups you want to count.

Then something like: (untested and without error handling)

   OBConversion conv;
   conv.SetInFormat("smi");
   OBMol mol;
   conv.ReadString(&mol, "C=CCC"));

   std::string smarts = "[CH2]";
   OBSmartsPattern sp;
   sp.Init(smarts);
   sp.Match(&mol);
   unsigned int numberMatches = sp.GetUMapList().size();

See http://openbabel.org/dev-api/ .

In data/SMARTS_InteLigand.txt there is a list of SMARTS for more 
complicated groups.

Chris

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to