Exemple #1
0
bool hasReactionAtomMapping(const ChemicalReaction &rxn)
{
    RDKit::MOL_SPTR_VECT::const_iterator begin = getStartIterator(rxn, Reactant);
    RDKit::MOL_SPTR_VECT::const_iterator end = getEndIterator(rxn, Reactant);
    for(; begin != end; ++begin) {
        const ROMol &reactant = *begin->get();
        if(MolOps::getNumAtomsWithDistinctProperty(reactant, "molAtomMapNumber")) {
            return true;
        }
    }
    begin = getStartIterator(rxn, Product);
    end = getEndIterator(rxn, Product);
    for(; begin != end; ++begin) {
        const ROMol &reactant = *begin->get();
        if(MolOps::getNumAtomsWithDistinctProperty(reactant, "molAtomMapNumber")) {
            return true;
        }
    }
    return false;
}
ExplicitBitVect *generateFingerprintChemReactionAsBitVect(
    const ChemicalReaction &rxn, unsigned int fpSize, FingerprintType t,
    ReactionMoleculeType mt) {
  PRECONDITION(fpSize != 0, "fpSize==0");

  ExplicitBitVect *result = new ExplicitBitVect(fpSize);
  RDKit::MOL_SPTR_VECT::const_iterator begin = getStartIterator(rxn, mt);
  RDKit::MOL_SPTR_VECT::const_iterator end = getEndIterator(rxn, mt);
  for (; begin != end; ++begin) {
    ExplicitBitVect *tmp = generateFingerprintAsBitVect(**begin, fpSize, t);
    (*result) |= *tmp;
    delete tmp;
  }
  return result;
}
SparseIntVect<boost::uint32_t> *generateFingerprintChemReactionAsCountVect(
    const ChemicalReaction &rxn, unsigned int fpSize, FingerprintType t,
    ReactionMoleculeType mt) {
  PRECONDITION(fpSize != 0, "fpSize==0");

  SparseIntVect<boost::uint32_t> *result =
      new SparseIntVect<boost::uint32_t>(fpSize);
  RDKit::MOL_SPTR_VECT::const_iterator begin = getStartIterator(rxn, mt);
  RDKit::MOL_SPTR_VECT::const_iterator end = getEndIterator(rxn, mt);
  for (; begin != end; ++begin) {
    SparseIntVect<boost::uint32_t> *tmp =
        generateFingerprint(**begin, fpSize, t);
    (*result) += *tmp;
    delete tmp;
  }
  return result;
}