Skip to content
Snippets Groups Projects
Commit 03b194ff authored by marco's avatar marco
Browse files

fix import of compounds with only one atom

components.cif does not use a loop_ section if the residue only
has one atom. Now we also handle these single atom residues
properly

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2214 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent 0f1676e7
No related branches found
No related tags found
No related merge requests found
...@@ -140,12 +140,23 @@ public: ...@@ -140,12 +140,23 @@ public:
} else if (item.GetName()==StringRef("pdbx_modified_date", 18)) { } else if (item.GetName()==StringRef("pdbx_modified_date", 18)) {
compound_->SetModificationDate(conop::Date::FromString(item.GetValue())); compound_->SetModificationDate(conop::Date::FromString(item.GetValue()));
} }
} else if (item.GetName()==StringRef("atom_id", 7)) {
atom_.name=item.GetValue().str();
} else if (item.GetName()==StringRef("alt_atom_id", 11)) {
atom_.alt_name=item.GetValue().str();
} else if (item.GetName()==StringRef("type_symbol", 11)) {
atom_.element=item.GetValue().str();
} else if (item.GetName()==StringRef("pdbx_ordinal", 12)) {
atom_.ordinal=item.GetValue().to_int().second-1;
} }
} }
virtual void OnEndData() virtual void OnEndData()
{ {
if (insert_) { if (insert_) {
if (compound_->GetAtomSpecs().empty()) {
compound_->AddAtom(atom_);
}
lib_->AddCompound(compound_); lib_->AddCompound(compound_);
} }
} }
...@@ -176,6 +187,7 @@ private: ...@@ -176,6 +187,7 @@ private:
static std::map<String, mol::ChemClass> tm_; static std::map<String, mol::ChemClass> tm_;
std::map<String, int> atom_map_; std::map<String, int> atom_map_;
LoopType loop_type_; LoopType loop_type_;
conop::AtomSpec atom_;
}; };
std::map<String, mol::ChemClass> ChemDictParser::tm_=std::map<String, mol::ChemClass>(); std::map<String, mol::ChemClass> ChemDictParser::tm_=std::map<String, mol::ChemClass>();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment