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 type_==CHAINTYPE_POLY_PEPTIDE_DN_RN;
00073 }
00075 bool IsPolysaccharide() const
00076 {
00077 return type_==CHAINTYPE_POLY_SAC_D || type_==CHAINTYPE_POLY_SAC_L;
00078 }
00080 bool IsPolypeptide() const
00081 {
00082 return type_==CHAINTYPE_POLY_PEPTIDE_D || type_==CHAINTYPE_POLY_PEPTIDE_L ||
00083 type_==CHAINTYPE_CYCLIC_PSEUDO_PEPTIDE;
00084 }
00086 bool IsPolynucleotide() const
00087 {
00088 return type_==CHAINTYPE_POLY_DN || type_==CHAINTYPE_POLY_RN ||
00089 type_==CHAINTYPE_POLY_DN_RN;
00090 }
00091
00095 void SetDescription(const String desc)
00096 {
00097 description_ = desc;
00098 }
00099
00103 String GetDescription() const
00104 {
00105 return description_;
00106 }
00107
00110
00111
00112 ResidueImplPtr AppendResidue(const ResidueImplPtr& res, bool deep);
00113
00114 ResidueImplPtr InsertResidueBefore(int index, const ResNum& n,
00115 const ResidueKey& k);
00116 ResidueImplPtr InsertResidueAfter(int index, const ResNum& n,
00117 const ResidueKey& k);
00122 ResidueImplPtr AppendResidue(const ResidueKey& k);
00123
00125 ResidueImplPtr AppendResidue(const ResidueKey& k, const ResNum& n);
00126
00127
00128
00129 ResidueImplPtr GetPrev(const ResidueImplPtr& r) const;
00130
00132 ResidueImplPtr GetNext(const ResidueImplPtr& r) const;
00133
00134 const ResidueImplList& GetResidueList() const;
00136 bool InSequence() const;
00137
00138 ResidueImplList& GetResidueList() {
00139 return residue_list_;
00140 }
00141
00142 Real GetMass() const;
00143 geom::Vec3 GetCenterOfMass() const;
00144 geom::Vec3 GetCenterOfAtoms() const;
00145
00147 geom::AlignedCuboid GetBounds() const;
00148
00149
00152 ResidueImplPtr FindResidue(const ResNum& number) const;
00153
00154 AtomImplPtr FindAtom(const ResNum& number,
00155 const String& atom_name) const;
00156
00158 int GetResidueCount() const;
00159
00161 int GetAtomCount() const;
00162
00164 int GetBondCount() const;
00165
00166 void Apply(EntityVisitor& v);
00167
00168 EntityImplPtr GetEntity() const;
00169
00170 void DeleteResidue(const ResNum& number);
00171
00172 void DeleteResidue(const ResidueImplPtr& residue);
00173
00174 void DeleteAllResidues();
00175
00176 void ReorderResidues();
00177
00178 void RenumberAllResidues(int start, bool keep_spacing);
00179
00180 void RenumberAllResidues(const ResNumList& new_numbers);
00181
00182 int GetIndex(const ResidueImplPtr& res) const;
00183 void AssignSecondaryStructure(SecStructure ss,
00184 const ResNum& start,
00185 const ResNum& end);
00186 int GetIndexForResNum(const ResNum& number) const;
00189 void SetInSequence(int index);
00190
00191 void UpdateTransformedPos();
00192
00193 private:
00194 int GetIndexForResNumInSequence(const ResNum& number) const;
00195 void UpdateShifts();
00196 typedef struct {
00197 int start;
00198 int shift;
00199 } Shift;
00200 std::list<Shift> shifts_;
00201 EntityImplW ent_;
00202 String name_;
00203 ResidueImplList residue_list_;
00206 bool in_sequence_;
00207 ChainType type_;
00208 String description_;
00209 };
00210
00211 }}}
00212
00213 #endif
00214