Quantcast

How to find of to which class of molecules a molecule belongs.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to find of to which class of molecules a molecule belongs.

Carsten Niehaus-2
Moin moin

I am coding an c++-application using OpenBabel for the chemistry.

I am using chem-file.sf.net as the database.


I would like to check if a given file is for example an alcohol or a
ketone. So far I think that I could use obgrep for this:

  obgrep 'OH' foo.smi

for alcohols, but I'd like to use the c++-API and furthermore I have
either mol- or cml-file, but not .smi files.

Is this possible using cml or mol-file?


Thanks,

Carsten

PS: Only the 2.2.x-API is available, the 2.3.0 has not been generated to
far (it seems): http://openbabel.org/api/2.2.0/index.shtml

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to find of to which class of molecules a molecule belongs.

Chris Morley-3
On 18/12/2010 13:23, Carsten Niehaus wrote:

> Moin moin
>
> I am coding an c++-application using OpenBabel for the chemistry.
>
> I am using chem-file.sf.net as the database.
>
>
> I would like to check if a given file is for example an alcohol or a
> ketone. So far I think that I could use obgrep for this:
>
>    obgrep 'OH' foo.smi
>
> for alcohols, but I'd like to use the c++-API and furthermore I have
> either mol- or cml-file, but not .smi files.
>
> Is this possible using cml or mol-file?
>
>
> Thanks,
>
> Carsten
>
> PS: Only the 2.2.x-API is available, the 2.3.0 has not been generated to
> far (it seems): http://openbabel.org/api/2.2.0/index.shtml

Maybe what you want is http://openbabel.org/dev-api/

In data/SMARTS_InteLigand.txt is an extensive list of SMARTS patterns
to match functional groups. Use on the command line or via the API.

The following has no error checking and is untested, but should point
you in the right direction.

std::string smarts(...);
std::string filename;
ifstream ifs(filename.c_str());

OBConversion conv;
OBFormat* format = conv.FormatFromExt(filename);
conv.SetInFormat(format);

OBMol mol;
conv.Read(mol, &ifs);

OBSmartsPattern sp;
sp.Init(smarts.c_str());
if(sp.Match(mol))
   std::cout << filename << " is a ..." << endl;


On the command line obabel is a more versatile alternative to obgrep:

   obabel infile.xxx -oyyy -s smarts

The input and output formats can be anything. Only molecules matching
the smarts will be converted.

In 2.3.0 you can draw a svg picture with the functional group
highlighted, e.g. for an alcohol

   obabel infile.xxx -O out.svg -s
"[OX2H][CX4;!$(C([OX2H])[O,S,#7,#15])] green" -xu

You can get a list of the functional groups (and some other features)
in a molecule by:

   obabel infile.xxx -ofpt -xfFP4 -xs

Chris




------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to find of to which class of molecules a molecule belongs.

Noel O'Boyle
Administrator
In reply to this post by Carsten Niehaus-2
On 18 December 2010 13:23, Carsten Niehaus <[hidden email]> wrote:

> Moin moin
>
> I am coding an c++-application using OpenBabel for the chemistry.
>
> I am using chem-file.sf.net as the database.
>
>
> I would like to check if a given file is for example an alcohol or a
> ketone. So far I think that I could use obgrep for this:
>
>  obgrep 'OH' foo.smi
>
> for alcohols, but I'd like to use the c++-API and furthermore I have
> either mol- or cml-file, but not .smi files.
>
> Is this possible using cml or mol-file?
>
>
> Thanks,
>
> Carsten
>
> PS: Only the 2.2.x-API is available, the 2.3.0 has not been generated to
> far (it seems): http://openbabel.org/api/2.2.0/index.shtml

2.3.0 now redirects to 2.3, which was the correct link.

> ------------------------------------------------------------------------------
> Lotusphere 2011
> Register now for Lotusphere 2011 and learn how
> to connect the dots, take your collaborative environment
> to the next level, and enter the era of Social Business.
> http://p.sf.net/sfu/lotusphere-d2d
> _______________________________________________
> OpenBabel-discuss mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Loading...