void CrfSaver::_writeReactionInfo (Reaction &reaction) { _output.writeByte(reaction.reactantsCount()); _output.writeByte(reaction.productsCount()); byte have_aam = 1; _output.writeByte(have_aam); }
void CrfSaver::_writeReactionInfo (Reaction &reaction) { _output.writePackedUInt(reaction.reactantsCount()); _output.writePackedUInt(reaction.productsCount()); byte features = CrfFeatureFlags::CRF_AAM; if (reaction.catalystCount() > 0) features |= CrfFeatureFlags::CRF_CATALYST; _output.writeByte(features); if (reaction.catalystCount() > 0) _output.writePackedUInt(reaction.catalystCount()); }
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"); }