> > I don't have any problem with reading or writing RXN. I hope the cause 
> > of your trouble turns up.
> > >

Me too. Do you know who the author of OBReaction is by any chance?
I am just curious if I'm doing anything wrong here.

This is OB 2.3.1 as it comes with Fedora 15.
According to the backtrace the problem seem to be in the destructor:

#0  0x0000000000000181 in ?? ()
#1  0x00007ffff6e8f0dc in OpenBabel::OBConversion::~OBConversion() ()
   from /usr/lib64/libopenbabel.so.4
#2  0x00000000004970fe in convert_page_to_reaction (
    page_of_structures=std::vector of length 8, capacity 8 = {...}, 
    output_format="rxn", reactants=<optimized out>, 
    products=std::vector of length 1, capacity 1 = {...}, value="", 
    reversible=false) at osra_reaction.cpp:86


Here is the bottom part of "convert_page_to_reaction" function where the
segfault occurs:

 OBReaction react;
  for (int j=0; j<reactants.size(); j++)
    {
      shared_ptr<OBMol> reactant(new OBMol);
      conv.ReadString(reactant.get(), page_of_structures[reactants[j]]);
      react.AddReactant(reactant);
    }
  for (int j=0; j<products.size(); j++)
    {
      shared_ptr<OBMol> product(new OBMol);
      conv.ReadString(product.get(), page_of_structures[products[j]]);
      react.AddProduct(product);
    }

  if (reversible) react.SetReversible(true);

  trim(value);
  if (!value.empty())
  {
       react.SetComment(value);
  }
  strstr << conv.WriteString(&react, true);
  if (output_format == "rsmi" && !strstr.str().empty() && !
value.empty())
    strstr << " " << value;
  reaction = strstr.str(); 

  return(reaction);

Igor

On Wed, 2012-06-20 at 16:51 -0400, Chris Morley wrote:
> On 20/06/2012 15:37, Igor Filippov [Contr] wrote:
> > Chris,
> >
> > Thank you for working on this!
> > I do work on reaction recognition in OSRA - you can actually try for
> > yourself the svn trunk release 905:
> >
> > svn co -r 905 https://osra.svn.sourceforge.net/svnroot/osra/trunk
> 
> I would like to, but I would have to install at least 13 libraries, 
> including a compiler and deal with an openbabel static build. Too much 
> for an aging Windows user!
> 
> > I have a few additional questions about reactions in OB, if I may:
> >
> > 1) The only two formats that I got working for OBReaction output are
> > RSMI and CMLR. It would be great to output others, such as RXN, but I'm
> > getting a segfault on the exact same code when I try to generate RXN
> > instead of RSMI. Would you be interested in looking at the problem with
> > RXN output?

> > 2) Neither SetComment() nor SetData  seem to do anything for either RSMI
> > or CMLR output. It's not a huge deal but it would be nice to be able to
> > save some additional information about the reaction in a way which is
> > independent of the output format.
> CMLR now outputs comment data from Reactions. RXN now outputs title and 
> comment data.
> I don't know where a comment would go in Reaction SMILES. The text after 
> a space is regarded as the title.
> 
> >
> > 3) SetReversible doesn't seem to do anything for RSMI. I haven't tested
> > on CMLR because frankly I haven't found anything which can read CMLR
> > format.
> That's a pity because there is a need for a flexible reaction format. 
> XML is easy to extend in a forward and backward compatible way. The 
> datafiles for the Mesmer project 
> (http://sourceforge.net/projects/mesmer) are based on CMLR and the 
> reaction data can be read by OB.
> 
> I am also not sure it's possible to have a reversible reaction
> > in RSMI - I don't know that much about the format.
> >
> > Best regards,
> > Igor
> >
> >
> >
> > On Wed, 2012-06-20 at 07:28 -0400, Chris Morley wrote:
> >> I've replaced the format chemdrawcdx.cpp with a new version that can
> >> read *some* reactions as well as molecules.
> >>
> >> 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, although most OB
> >> molecule output formats will output the reactants and products if given
> >> an OBReaction.
> >>
> >> The parsing of the cdx file is separated from the interpretation to a
> >> greater extent than before, which should make it easier to do an XML
> >> version (but cdxmlformat.cpp has not been changed yet). The CDX tree can
> >> be displayed (-ad), in a similar way to Cambridgesoft's CDXHexDumper,
> >> except that it contains human-readable names, obtained by parsing the
> >> enums in the header file.
> >>
> >> The reaction parsing works only for cdx files which have single
> >> reactions which are completely described in the file's data tree, as in
> >> the attached file. This sadly is not the case for most cdx files where
> >> additional heuristics based on the position of the arrow in the image is
> >> necessary. I have been holding off committing these changes pending this
> >> improvement, but have got round to it. Parsing an ordinary image would
> >> be very similar, and I know Igor Filippov is working on this for OSRA,
> >> so maybe this could be applied in cdx parsing. Rich Apodaca also seems
> >> to have renewed interest,
> >> http://depth-first.com/articles/2012/06/01/reading-and-rendering-chemdraw-cdx-files-in-javascript/
> >> .
> >>
> >> Chris
> >>
> >
> >
> >
> 
> 



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
OpenBabel-Devel mailing list
OpenBabel-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-devel

Reply via email to