diff --git a/modules/conop/src/chemdict_tool.cc b/modules/conop/src/chemdict_tool.cc index 156b7f2d1444e087225d86cd78121c32ecce005f..8671b4fa4ebcba3bd1ece97d8aceab47c58c522d 100644 --- a/modules/conop/src/chemdict_tool.cc +++ b/modules/conop/src/chemdict_tool.cc @@ -122,13 +122,19 @@ public: for (String::iterator i=type.begin(), e=type.end(); i!=e; ++i) { *i=toupper(*i); } - std::map<String, mol::ChemClass>::iterator i=tm_.find(type); - if (i!=tm_.end()) { - compound_->SetChemClass(i->second); + // The type of water is set to "?". let's change it to water... + if (compound_->GetID()=="HOH") { + compound_->SetChemClass(mol::ChemClass(mol::ChemClass::Water)); } else { - std::cout << "unknown type '" << type << "' for compound " - << compound_->GetID() << std::endl; + std::map<String, mol::ChemClass>::iterator i=tm_.find(type); + if (i!=tm_.end()) { + compound_->SetChemClass(i->second); + } else { + std::cout << "unknown type '" << type << "' for compound " + << compound_->GetID() << std::endl; + } } + } else if (item.GetName()==StringRef("formula", 7)) { compound_->SetFormula(item.GetValue().str()); } else if (item.GetName()==StringRef("one_letter_code", 15)) { diff --git a/modules/conop/src/heuristic_builder.cc b/modules/conop/src/heuristic_builder.cc index 5429a569737568875c61607d1763210219a4c62e..bb4a63a229bfdc5b270b447538115df02a8b9659 100644 --- a/modules/conop/src/heuristic_builder.cc +++ b/modules/conop/src/heuristic_builder.cc @@ -309,11 +309,18 @@ void ConnectPrevNext(HeuristicBuilder* builder,mol::ResidueHandle res0, if(res0_atom && res1_atom) { LOG_DEBUG(fname << ": found atoms, connecting"); if(flag) { - if (builder->DoesPeptideBondExist(res0_atom, res1_atom)) + if (builder->DoesPeptideBondExist(res0_atom, res1_atom)) { editor.Connect(res0_atom,res1_atom); + res0.SetIsProtein(true); + res1.SetIsProtein(true); + } } else { - if (builder->DoesPeptideBondExist(res1_atom, res0_atom)) + if (builder->DoesPeptideBondExist(res1_atom, res0_atom)) { editor.Connect(res1_atom, res0_atom); + res0.SetIsProtein(true); + res1.SetIsProtein(true); + } + } } } else { diff --git a/modules/conop/src/rule_based_builder.cc b/modules/conop/src/rule_based_builder.cc index 755d03dd5904d1b8ea0e2564ab70d49d817bb5bc..3353dfb461eabe59773beb6fc8c764df9556f81c 100644 --- a/modules/conop/src/rule_based_builder.cc +++ b/modules/conop/src/rule_based_builder.cc @@ -202,6 +202,8 @@ void RuleBasedBuilder::ConnectResidueToNext(mol::ResidueHandle rh, // the peptide bond. if (c.IsValid() && n.IsValid() && this->DoesPeptideBondExist(c, n)) { e.Connect(c, n, 1); + rh.SetIsProtein(true); + next.SetIsProtein(true); } } diff --git a/modules/mol/base/src/chem_class.hh b/modules/mol/base/src/chem_class.hh index b7740a94257ef64f7ec8feb365a7fd8ab25b3fe9..f9c0f8279666df6fee4f2370b2ed40ba29432203 100644 --- a/modules/mol/base/src/chem_class.hh +++ b/modules/mol/base/src/chem_class.hh @@ -37,6 +37,7 @@ struct ChemClass { const static char LSaccharide ='X'; const static char DSaccharide ='Y'; const static char Saccharide ='Z'; + const static char Water ='W'; const static char Unknown ='U'; explicit ChemClass(char chem_class) : chem_class_(chem_class) { @@ -62,6 +63,8 @@ struct ChemClass { return (chem_class_==ChemClass::DNALinking || chem_class_==ChemClass::RNALinking); } + + bool IsWater() const { return chem_class_==ChemClass::Water; } operator char() const { return chem_class_; } diff --git a/modules/mol/base/src/impl/residue_impl.hh b/modules/mol/base/src/impl/residue_impl.hh index 0e03937674307b4b3b625c417bb86fa2046320c9..183a9ccefe8c5025f2790109b0ab3d26acfc17f8 100644 --- a/modules/mol/base/src/impl/residue_impl.hh +++ b/modules/mol/base/src/impl/residue_impl.hh @@ -199,6 +199,9 @@ public: int GetIntProperty(Prop::ID prop_id) const; + void SetProtein(bool protein) { protein_=protein; } + + bool IsProtein() const { return protein_; } private: void AddAltAtom(const String& group, const AtomImplPtr& atom, const geom::Vec3& position); @@ -207,13 +210,15 @@ private: AtomEntryGroups alt_groups_; EntityImplW ent_; ChainImplW chain_; - ResNum num_; + ResNum num_; ResidueKey key_; AtomImplList atom_list_; TorsionImplList torsion_list_; SecStructure sec_structure_; ChemClass chem_class_; char olc_; + // whether the residue is part of the protein. + bool protein_; }; }}} // ns diff --git a/modules/mol/base/src/property_id.cc b/modules/mol/base/src/property_id.cc index ed19a4f3e85d5d17955d84fd67241f043fb510d4..a6408b83e97407a26060faac0824dc0659403493 100644 --- a/modules/mol/base/src/property_id.cc +++ b/modules/mol/base/src/property_id.cc @@ -49,7 +49,9 @@ struct Properties : public boost::spirit::symbols<Prop> { ("abfac", Prop(Prop::ABFAC, Prop::FLOAT, Prop::ATOM)) ("rbfac", Prop(Prop::RBFAC, Prop::FLOAT, Prop::RESIDUE)) ("peptide", Prop(Prop::PEPTIDE, Prop::INT, Prop::RESIDUE)) - ("rindex", Prop(Prop::RINDEX, Prop::INT, Prop::RESIDUE)) + ("rindex", Prop(Prop::RINDEX, Prop::INT, Prop::RESIDUE)) + ("protein", Prop(Prop::PROTEIN, Prop::INT, Prop::RESIDUE)) + ("water", Prop(Prop::WATER, Prop::INT, Prop::RESIDUE)) ("acharge", Prop(Prop::ACHARGE, Prop::FLOAT, Prop::ATOM)); } } properties; @@ -112,6 +114,10 @@ String Prop::GetName() const return "acharge"; case RINDEX: return "rindex"; + case PROTEIN: + return "protein"; + case WATER: + return "water"; default: return ""; } diff --git a/modules/mol/base/src/property_id.hh b/modules/mol/base/src/property_id.hh index dfc984bc2b465fa70c502fdd8c6653efd82bba14..4ea4be13fc66c96512edfca18169967602f747da 100644 --- a/modules/mol/base/src/property_id.hh +++ b/modules/mol/base/src/property_id.hh @@ -40,7 +40,8 @@ public: /// respectively. typedef enum { RNAME, ANAME, CNAME, ELE, RNUM, ANUM, AX, AY, AZ, OCC, RTYPE, ISHETATM, - RBFAC, ABFAC, PEPTIDE, ACHARGE, RINDEX, WITHIN, UNDEF, CUSTOM + RBFAC, ABFAC, PEPTIDE, ACHARGE, RINDEX, PROTEIN, WATER, WITHIN, + UNDEF, CUSTOM } ID; typedef enum { diff --git a/modules/mol/base/src/query_state.cc b/modules/mol/base/src/query_state.cc index c84670d782b9d95699020d264aed8c240c5fb417..95dc07e16ef138132fc9b8a43c93c23061e994ee 100644 --- a/modules/mol/base/src/query_state.cc +++ b/modules/mol/base/src/query_state.cc @@ -198,7 +198,7 @@ boost::logic::tribool QueryState::EvalResidue(const impl::ResidueImplPtr& r) { s_[*i]=cmp_num<int>(ss.comp_op,int_value,boost::get<int>(ss.param)); break; case Prop::PEPTIDE: - int_value=r->GetChemClass().IsPeptideLinking() ? 1 : 0; + int_value=r->GetChemClass().IsPeptideLinking(); s_[*i] = cmp_num<int>(ss.comp_op,int_value,boost::get<int>(ss.param)); break; case Prop::RBFAC: @@ -209,6 +209,14 @@ boost::logic::tribool QueryState::EvalResidue(const impl::ResidueImplPtr& r) { s_[*i] = cmp_num<Real>(ss.comp_op, float_value, boost::get<float>(ss.param)); break; + case Prop::PROTEIN: + int_value=r->IsProtein(); + s_[*i]=cmp_num<int>(ss.comp_op,int_value,boost::get<int>(ss.param)); + break; + case Prop::WATER: + int_value=r->GetChemClass().IsWater(); + s_[*i]=cmp_num<int>(ss.comp_op,int_value,boost::get<int>(ss.param)); + break; case Prop::RTYPE: p=boost::get<String>(ss.param); if (p.length()>1) { diff --git a/modules/mol/base/src/residue_base.cc b/modules/mol/base/src/residue_base.cc index f4ce54ee5aafc307e7f31efff4f05ef6975ed7d7..9ae05d783a17e7885f3f1b2f8896cdcb1a7894be 100644 --- a/modules/mol/base/src/residue_base.cc +++ b/modules/mol/base/src/residue_base.cc @@ -181,5 +181,17 @@ int ResidueBase::GetIntProperty(Prop::ID prop_id) const return Impl()->GetIntProperty(prop_id); } +bool ResidueBase::IsProtein() const +{ + this->CheckValidity(); + return Impl()->IsProtein(); +} + +void ResidueBase::SetIsProtein(bool protein) +{ + this->CheckValidity(); + Impl()->SetProtein(protein); +} + }} diff --git a/modules/mol/base/src/residue_base.hh b/modules/mol/base/src/residue_base.hh index 69749ed492dbc566ad1d3eb72eabb3ad23999257..1ad7438795fa240422afc912645ab5025c48d50d 100644 --- a/modules/mol/base/src/residue_base.hh +++ b/modules/mol/base/src/residue_base.hh @@ -139,7 +139,11 @@ public: /// \brief Get int property by id int GetIntProperty(Prop::ID prop_id) const; - + + /// \brief whether the residue is part of the protein. + bool IsProtein() const; + + void SetIsProtein(bool protein); public: impl::ResidueImplPtr& Impl(); diff --git a/modules/mol/base/src/residue_handle.hh b/modules/mol/base/src/residue_handle.hh index 57b7c56192d3bdb9b0b9aa125e3eb4ec659d9b8b..f1eb07850185a9b1ea404eeceaedb589e1feff9b 100644 --- a/modules/mol/base/src/residue_handle.hh +++ b/modules/mol/base/src/residue_handle.hh @@ -197,7 +197,7 @@ public: /// \brief return view based on query String. /// \sa Query EntityView Select(const String& query_string, QueryFlags flags=0) const; - + bool operator==(const ResidueHandle& ref) const; bool operator!=(const ResidueHandle& ref) const;