On 19/07/2011 17:17, Igor Filippov wrote: > Chris, > > Thank you. Simple approach - just pointers to OBMol's for reactans and > products is just fine for now. I looked at OBReaction and it seems > reasonably clear. > > At the moment I'm focusing on writing out reactions from assembled > OBMols into a file or string and not on the reading of reactions or any > fancy manipulation. How do I write out RSMI from OBReaction - do I use > OBConversion the same way as I do for regular file formats? Perhaps you > have a three line example?
Yes it is entirely analogous: OBConversion conv; conv.SetInAndOutFormats("rsmi","rsmi"); OBReaction react; conv.ReadFile(&react, "example.rsmi"); conv.Write(&react, &cout); Chris > Best regards, > Igor > > On Tue, 2011-07-19 at 12:01 -0400, Chris Morley wrote: >> Igor >> >> OpenBabel supports formats like, CMLreact, RXN Reaction SMILES, ChemKin, >> which specify reactions. The internal structure is OBReaction which for >> reaction formats is handled in the conversion routines like OBMol is for >> molecule formats. Reading a file containing >> c1ccccc1>>Nc1ccccc1 >> with rmsi format will make an OBReaction. OBReaction is fairly simple >> and is really just a container to hold shared_ptrs to the molecules >> which are the reactants, products, etc. OB doesn't have much for >> constructing or modifying reactions. >> >> I've written a version of chemdrawCDX.cpp which reads reactions as well >> as molecules. The code contains the construction of an OBReaction and >> its transfer to OB's conversion system. The email describing it that I >> sent to Abe Heifets (who may be who Geoff is referring to) is below. The >> files are at: >> http://gaseq.co.uk/OB/benzene-to-aniline-reaction.cdx >> http://gaseq.co.uk/OB/chemdrawcdx.h >> http://gaseq.co.uk/OB/chemdrawcdx.cpp >> >> This is stalled at the moment because of the need to add code to parse a >> geometric layout and derive which molecules are reactants, products, >> etc. I guess this is what you are doing, so I would be interested if you >> have a method already. >> >> Chris >> >> >> >> >> Abe >> You might be interested in this OpenBabel format for reading CDX files. >> It reads reactions as well as molecules, but only if they are single >> reactions and completely described. The attached example works but most >> of the examples from patents you sent me don't. The code needs some >> extra heuristics to find incompletely described reactions, but I haven't >> yet managed to write it in the past six months. >> >> The format generates OBReaction objects when it can, which can be output >> by rsmi, rxn, etc. Excess molecules are output as OBMol objects as >> normal. The option -am generates only molecules. Actually most molecule >> output formats will output the reactants and products if given an >> OBReaction. >> >> The parsing is separated from the interpretation to a greater extent >> than before, which should make it easier to do an XML version. >> >> It is also possible (-ad) to output the CDX tree, in a similar way to >> CDXHexDumper, except that it contains human-readable names. >> >> The attached file should replace the existing one, and I hope will >> compile ok. A copy of chemdrawcdx.h should be put in the /data directory >> so it can be parsed for the names. >> >> >> >> On 18/07/2011 16:33, Geoffrey Hutchison wrote: >>> Dear Igor, >>> >>> Open Babel supports CML (react) and MDL Rxn formats for reactions. I'm not >>> sure if there's great support for polymers, but that would definitely be a >>> nice addition. I know someone who's working on ChemDraw reaction support as >>> well. >>> >>> Chris Morley should have an example of a reaction file example -- I'm not >>> seeing anything at the moment in the OBReaction documentation. If Chris >>> doesn't respond today, I'll dig around tomorrow. >>> >>> Thanks and best regards, >>> -Geoff >>> >>> On Jul 18, 2011, at 11:25 AM, Igor Filippov [Contr] wrote: >>> >>>> Dear Geoff, >>>> >>>> Re: reaction recognition in OSRA - >>>> Is there any format or formats which OpenBabel can write that have >>>> support for reactions and/or polymers (brackets)? It doesn't have to be >>>> the same format for both. >>>> How would I go about creating a reaction file or a polymer in C++? >>>> >>>> Igor >>>> >> >> > > > ------------------------------------------------------------------------------ Magic Quadrant for Content-Aware Data Loss Prevention Research study explores the data loss prevention market. Includes in-depth analysis on the changes within the DLP market, and the criteria used to evaluate the strengths and weaknesses of these DLP solutions. http://www.accelacomm.com/jaw/sfnl/114/51385063/ _______________________________________________ OpenBabel-Devel mailing list OpenBabel-Devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-devel