00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef OST_CHAIN_IMPL_HH
00020 #define OST_CHAIN_IMPL_HH
00021
00022 #include <boost/enable_shared_from_this.hpp>
00023
00024 #include <ost/mol/module_config.hh>
00025 #include <ost/geom/geom.hh>
00026
00027 #include <ost/mol/residue_prop.hh>
00028 #include <ost/mol/chain_type.hh>
00029 #include <ost/mol/impl/chain_impl_fw.hh>
00030 #include <ost/mol/impl/residue_impl_fw.hh>
00031 #include <ost/mol/impl/entity_impl_fw.hh>
00032 #include <ost/mol/entity_visitor_fw.hh>
00033 #include <ost/mol/impl/atom_impl_fw.hh>
00034
00035 #include <ost/generic_property.hh>
00036
00037 #include <ost/mol/sec_structure.hh>
00038
00039 namespace ost { namespace mol {namespace impl {
00040
00042 class ChainImpl: public GenericPropContainerImpl,
00043 public boost::enable_shared_from_this<ChainImpl>
00044 {
00045 public:
00046 ChainImpl(const EntityImplPtr& e, const String& name);
00047
00048 void SetName(const String& new_name);
00049 String GetName() const;
00050
00054 void SetType(const ChainType type)
00055 {
00056 type_ = type;
00057 }
00058
00062 ChainType GetType() const
00063 {
00064 return type_;
00065 }
00066
00068 bool IsPolymer() const
00069 {
00070 return type_==CHAINTYPE_POLY || this->IsPolypeptide() ||
00071 this->IsPolynucleotide() || this->IsPolysaccharide();
00072 }
00074 bool IsPolysaccharide() const
00075 {
00076 return type_==CHAINTYPE_POLY_SAC_D || type_==CHAINTYPE_POLY_SAC_L;
00077 }
00079 bool IsPolypeptide() const
00080 {
00081 return type_==CHAINTYPE_POLY_PEPTIDE_D || type_==CHAINTYPE_POLY_PEPTIDE_L;
00082 }
00084 bool IsPolynucleotide() const
00085 {
00086 return type_==CHAINTYPE_POLY_DN || type_==CHAINTYPE_POLY_RN ||
00087 type_==CHAINTYPE_POLY_DN_RN;
00088 }
00089
00093 void SetDescription(const String desc)
00094 {
00095 description_ = desc;
00096 }
00097
00101 String GetDescription() const
00102 {
00103 return description_;
00104 }
00105
00108
00109
00110 ResidueImplPtr AppendResidue(const ResidueImplPtr& res, bool deep);
00111
00112 ResidueImplPtr InsertResidueBefore(int index, const ResNum& n,
00113 const ResidueKey& k);
00114 ResidueImplPtr InsertResidueAfter(int index, const ResNum& n,
00115 const ResidueKey& k);
00120 ResidueImplPtr AppendResidue(const ResidueKey& k);
00121
00123 ResidueImplPtr AppendResidue(const ResidueKey& k, const ResNum& n);
00124
00125
00126
00127 ResidueImplPtr GetPrev(const ResidueImplPtr& r) const;
00128
00130 ResidueImplPtr GetNext(const ResidueImplPtr& r) const;
00131
00132 const ResidueImplList& GetResidueList() const;
00134 bool InSequence() const;
00135
00136 ResidueImplList& GetResidueList() {
00137 return residue_list_;
00138 }
00139
00140 Real GetMass() const;
00141 geom::Vec3 GetCenterOfMass() const;
00142 geom::Vec3 GetCenterOfAtoms() const;
00143
00145 geom::AlignedCuboid GetBounds() const;
00146
00147
00150 ResidueImplPtr FindResidue(const ResNum& number) const;
00151
00152 AtomImplPtr FindAtom(const ResNum& number,
00153 const String& atom_name) const;
00154
00156 int GetResidueCount() const;
00157
00159 int GetAtomCount() const;
00160
00162 int GetBondCount() const;
00163
00164 void Apply(EntityVisitor& v);
00165
00166 EntityImplPtr GetEntity() const;
00167
00168 void DeleteResidue(const ResNum& number);
00169
00170 void DeleteResidue(const ResidueImplPtr& residue);
00171
00172 void DeleteAllResidues();
00173
00174 void ReorderResidues();
00175
00176 void RenumberAllResidues(int start, bool keep_spacing);
00177
00178 void RenumberAllResidues(const ResNumList& new_numbers);
00179
00180 int GetIndex(const ResidueImplPtr& res) const;
00181 void AssignSecondaryStructure(SecStructure ss,
00182 const ResNum& start,
00183 const ResNum& end);
00184 int GetIndexForResNum(const ResNum& number) const;
00187 void SetInSequence(int index);
00188
00189 void UpdateTransformedPos();
00190
00191 private:
00192 int GetIndexForResNumInSequence(const ResNum& number) const;
00193 void UpdateShifts();
00194 typedef struct {
00195 int start;
00196 int shift;
00197 } Shift;
00198 std::list<Shift> shifts_;
00199 EntityImplW ent_;
00200 String name_;
00201 ResidueImplList residue_list_;
00204 bool in_sequence_;
00205 ChainType type_;
00206 String description_;
00207 };
00208
00209 }}}
00210
00211 #endif
00212