Пример #1
0
void CrfSaver::saveReaction (Reaction &reaction)
{
   _writeReactionInfo(reaction);

   int i;

   _atom_stereo_flags = 0;
   _bond_rc_flags = 0;
   _aam = 0;

   for (i = reaction.reactantBegin(); i < reaction.reactantEnd(); i = reaction.reactantNext(i))
         _writeReactionMolecule(reaction, i);

   for (i = reaction.productBegin(); i < reaction.productEnd(); i = reaction.productNext(i))
         _writeReactionMolecule(reaction, i);

   if (reaction.catalystCount() > 0)
   {
      for (i = reaction.catalystBegin(); i < reaction.catalystEnd(); i = reaction.catalystNext(i))
         _writeReactionMolecule(reaction, i);
   }

   if (_encoder.get() != 0)
      _encoder->finish();
}
Пример #2
0
void CrfSaver::saveReaction (Reaction &reaction)
{
   _writeReactionInfo(reaction);

   int i;

   _atom_stereo_flags = 0;
   _bond_rc_flags = 0;
   _aam = 0;

   for (i = reaction.reactantBegin(); i < reaction.reactantEnd(); i = reaction.reactantNext(i))
   {
      _atom_stereo_flags = reaction.getInversionArray(i).ptr();
      _bond_rc_flags = reaction.getReactingCenterArray(i).ptr();
      _aam = reaction.getAAMArray(i).ptr();
      _writeMolecule(reaction.getMolecule(i));
   }

   for (i = reaction.productBegin(); i < reaction.productEnd(); i = reaction.productNext(i))
   {
      _atom_stereo_flags = reaction.getInversionArray(i).ptr();
      _bond_rc_flags = reaction.getReactingCenterArray(i).ptr();
      _aam = reaction.getAAMArray(i).ptr();
      _writeMolecule(reaction.getMolecule(i));
   }

   if (_encoder.get() != 0)
      _encoder->finish();
}
Пример #3
0
void ReactionCmlSaver::saveReaction (Reaction &rxn)
{
   if (!skip_cml_tag)
   {
      _output.printf("<?xml version=\"1.0\" ?>\n");
      _output.printf("<cml>\n");
   }

   if (rxn.name.ptr() != 0)
   {
      if (strchr(rxn.name.ptr(), '\"') != NULL)
         throw Error("can not save reaction with '\"' in title");
      _output.printf("<reaction title=\"%s\">\n", rxn.name.ptr());
   }
   else
      _output.printf("<reaction>\n");

   int i;

   MoleculeCmlSaver molsaver(_output);

   molsaver.skip_cml_tag = true;

   if (rxn.reactantsCount() > 0)
   {
      _output.printf("<reactantList>\n");
      for (i = rxn.reactantBegin(); i != rxn.reactantEnd(); i = rxn.reactantNext(i))
         molsaver.saveMolecule(rxn.getMolecule(i));
      _output.printf("</reactantList>\n");
   }
   if (rxn.productsCount() > 0)
   {
      _output.printf("<productList>\n");
      for (i = rxn.productBegin(); i != rxn.productEnd(); i = rxn.productNext(i))
         molsaver.saveMolecule(rxn.getMolecule(i));
      _output.printf("</productList>\n");
   }
   if (rxn.catalystCount() > 0)
   {
      _output.printf("<spectatorList>\n");
      for (i = rxn.catalystBegin(); i != rxn.catalystEnd(); i = rxn.catalystNext(i))
         molsaver.saveMolecule(rxn.getMolecule(i));
      _output.printf("</spectatorList>\n");
   }
   _output.printf("</reaction>\n");
   if (!skip_cml_tag)
      _output.printf("</cml>\n");
}