diff --git a/modules/conop/src/compound.hh b/modules/conop/src/compound.hh index c64e5d12094f0cb5c73683f0a5ff22252301e6a4..9e2547bbfbd44c689483d91a5c50cd22154fbf9f 100644 --- a/modules/conop/src/compound.hh +++ b/modules/conop/src/compound.hh @@ -148,6 +148,7 @@ public: formula_(), name_(), inchi_(), + inchi_key_(), atom_specs_(), bond_specs_(), chem_class_(), @@ -247,6 +248,10 @@ public: const String& GetInchi() { return inchi_; } + void SetInchiKey(const String& inchikey) { inchi_key_=inchikey; } + + const String& GetInchiKey() { return inchi_key_; } + const BondSpecList& GetBondSpecs() const { return bond_specs_; } @@ -275,6 +280,7 @@ private: String formula_; String name_; String inchi_; + String inchi_key_; AtomSpecList atom_specs_; BondSpecList bond_specs_; mol::ChemClass chem_class_; diff --git a/modules/conop/src/compound_lib.cc b/modules/conop/src/compound_lib.cc index 09b667b77526fbe206245a73e178d0ffbc45bbc4..508c31bd68f6453875a7f9128cabafeaa3f67b96 100644 --- a/modules/conop/src/compound_lib.cc +++ b/modules/conop/src/compound_lib.cc @@ -50,7 +50,8 @@ const char* CREATE_CMD[]={ " pdb_initial TIMESTAMP, " " pdb_modified TIMESTAMP, " " name VARCHAR(256), " -" inchi_code TEXT " +" inchi_code TEXT, " +" inchi_key TEXT " ");", " CREATE UNIQUE INDEX IF NOT EXISTS commpound_tlc_index ON chem_compounds " " (tlc, dialect)", @@ -86,8 +87,8 @@ const char* CREATE_CMD[]={ const char* INSERT_COMPOUND_STATEMENT="INSERT INTO chem_compounds " -" (tlc, olc, dialect, chem_class, chem_type, formula, pdb_initial, pdb_modified, name, inchi_code) " -" VALUES (?, ?, ?, ?, ?, ?, DATE(?), DATE(?), ?, ?)"; +" (tlc, olc, dialect, chem_class, chem_type, formula, pdb_initial, pdb_modified, name, inchi_code, inchi_key) " +" VALUES (?, ?, ?, ?, ?, ?, DATE(?), DATE(?), ?, ?, ?)"; const char* INSERT_ATOM_STATEMENT="INSERT INTO atoms " " (compound_id, name, alt_name, element, is_aromatic, stereo_conf, " @@ -229,6 +230,8 @@ void CompoundLib::AddCompound(const CompoundPtr& compound) compound->GetName().length(), NULL); sqlite3_bind_text(stmt, 10, compound->GetInchi().c_str(), compound->GetInchi().length(), NULL); + sqlite3_bind_text(stmt, 11, compound->GetInchiKey().c_str(), + compound->GetInchiKey().length(), NULL); } else { LOG_ERROR(sqlite3_errmsg(conn_)); sqlite3_finalize(stmt); diff --git a/modules/io/src/mol/chemdict_parser.cc b/modules/io/src/mol/chemdict_parser.cc index 841beb4b7686b3be718337244616fd53a72a30b9..47f7f6f2d369a9e446a4929ec6a914fa6aa179d4 100644 --- a/modules/io/src/mol/chemdict_parser.cc +++ b/modules/io/src/mol/chemdict_parser.cc @@ -83,6 +83,8 @@ void ChemdictParser::OnDataRow(const StarLoopDesc& header, return; } compound_->SetInchi(columns[indices_[DESC]].substr(6).str()); + } else if (columns[indices_[DESC_TYPE]] == StringRef("InChIKey", 8)) { + compound_->SetInchiKey(columns[indices_[DESC]].str()); } } }