void MolCatalogEntry::initFromStream(std::istream &ss) { delete dp_mol; dp_mol = nullptr; delete dp_props; dp_props = nullptr; // the molecule: dp_mol = new ROMol(); MolPickler::molFromPickle(ss, *const_cast<ROMol *>(dp_mol)); dp_props = new Dict(); boost::int32_t tmpInt; // the bitId: streamRead(ss, tmpInt); setBitId(tmpInt); // the order: streamRead(ss, tmpInt); setOrder(tmpInt); // the description: streamRead(ss, tmpInt); auto *tmpText = new char[tmpInt + 1]; ss.read(tmpText, tmpInt * sizeof(char)); tmpText[tmpInt] = 0; d_descrip = tmpText; delete[] tmpText; }
MolCatalogEntry::MolCatalogEntry(const ROMol *omol) { PRECONDITION(omol, "bad mol"); setBitId(-1); dp_props = new Dict(); d_descrip = ""; dp_mol = omol; }
FragCatalogEntry::FragCatalogEntry(const ROMol *omol, const PATH_TYPE &path, const MatchVectType &aidToFid) { PRECONDITION(omol, "bad mol"); // start with the assumption that this entry is not participating in // any find of fingerprinting d_aToFmap.clear(); setBitId(-1); INT_MAP_INT aIdxMap; // a map from atom id in omol to the new atoms id in mol dp_mol = Subgraphs::pathToSubmol(*omol, path, false, aIdxMap); // Using Subgraphs functionality d_order = path.size(); // using aIdxMap initialize the location (and their IDs) of the // functional groups on dp_mol for (const auto &mvtci : aidToFid) { int oldAid = mvtci.first; if (aIdxMap.find(oldAid) != aIdxMap.end()) { int newAid = aIdxMap[oldAid]; if (d_aToFmap.find(newAid) != d_aToFmap.end()) { d_aToFmap[newAid].push_back(mvtci.second); } else { INT_VECT tmpVect; tmpVect.clear(); tmpVect.push_back(mvtci.second); d_aToFmap[newAid] = tmpVect; } } } dp_props = new Dict(); d_descrip = ""; }
MolCatalogEntry::MolCatalogEntry(const MolCatalogEntry &other) { setBitId(other.getBitId()); d_descrip = other.d_descrip; dp_props = nullptr; dp_mol = nullptr; if (other.dp_props) { dp_props = new Dict(*other.dp_props); } if (other.dp_mol) { dp_mol = new ROMol(*other.dp_mol); } }
void FragmentCatalogEntry::initFromStream(std::istream &ss) { // the molecule: dp_mol = new ROMol(); MolPickler::molFromPickle(ss, *dp_mol); boost::int32_t tmpInt; // the bitId: streamRead(ss, tmpInt); setBitId(tmpInt); // the description: streamRead(ss, tmpInt); char *tmpText = new char[tmpInt + 1]; ss.read(tmpText, tmpInt * sizeof(char)); tmpText[tmpInt] = 0; d_descrip = tmpText; delete[] tmpText; }
void TransformCatalogEntry::initFromStream(std::istream &ss) { // the reaction: dp_transform = new ChemicalReaction(); ReactionPickler::reactionFromPickle(ss, *dp_transform); std::int32_t tmpInt; // the bitId: streamRead(ss, tmpInt); setBitId(tmpInt); // the description: streamRead(ss, tmpInt); char *tmpText = new char[tmpInt + 1]; ss.read(tmpText, tmpInt * sizeof(char)); tmpText[tmpInt] = 0; d_descrip = tmpText; delete[] tmpText; }
void FragCatalogEntry::initFromStream(std::istream &ss) { // the molecule: dp_mol = new ROMol(); MolPickler::molFromPickle(ss, *dp_mol); std::int32_t tmpInt; // the bitId: streamRead(ss, tmpInt); setBitId(tmpInt); // the description: streamRead(ss, tmpInt); auto *tmpText = new char[tmpInt + 1]; ss.read(tmpText, tmpInt * sizeof(char)); tmpText[tmpInt] = 0; d_descrip = tmpText; delete[] tmpText; streamRead(ss, tmpInt); d_order = tmpInt; // now the map: streamRead(ss, tmpInt); for (int i = 0; i < tmpInt; i++) { std::int32_t key, value, size; streamRead(ss, key); streamRead(ss, size); INT_VECT tmpVect; tmpVect.clear(); for (int j = 0; j < size; j++) { streamRead(ss, value); tmpVect.push_back(value); } d_aToFmap[key] = tmpVect; } }