00001
00009 #ifndef HAATGROUP_H
00010 #define HAATGROUP_H
00011
00012 #include "haio.h"
00013 #include "haatom.h"
00014 #include "habond.h"
00015 #include "halinalg.h"
00016
00017 class Expr;
00018
00019 class AtomIterator : public PointIterator
00021 {
00022 public:
00023
00024 virtual HaAtom* GetFirstAtom() = 0;
00025 virtual HaAtom* GetNextAtom() = 0;
00026
00027 };
00028
00029 class AtomCollection: public PointCollection
00031 {
00032 public:
00033 virtual AtomIterator* GetAtomIterator() = 0;
00034 virtual int GetNAtoms() const = 0;
00035
00036 virtual int IsMember(const HaAtom* aptr) const = 0;
00037 };
00038
00039 class AtomListIterator : public AtomIterator
00041 {
00042 public:
00043 AtomListIterator(AtomList* new_atlist);
00044 virtual ~AtomListIterator();
00045
00046 HaAtom* GetFirstAtom();
00047 HaAtom* GetNextAtom();
00048
00049 Vec3D* GetFirstPt() { return GetFirstAtom(); }
00050 Vec3D* GetNextPt() { return GetNextAtom(); }
00051
00052 protected:
00053 list<HaAtom*>::iterator aitrm;
00054
00055 AtomList* atlist;
00056 };
00057
00058 class AtomList : public list<HaAtom*>, public AtomCollection
00060 {
00061 public:
00062 AtomList() {}
00063 AtomList(const AtomList& ref_atset);
00064 AtomList(Expr* expr, HaMolSet* pmset);
00065 virtual ~AtomList();
00066
00067 list<HaAtom*>::iterator CurAtomItr;
00068
00069 virtual AtomIterator* GetAtomIterator() { return new AtomListIterator(this); }
00070 virtual int GetNAtoms() const { return size(); }
00071
00072
00073
00074 bool InsertAtom(HaAtom* aptr);
00075 bool DeleteAtom(HaAtom* aptr);
00076 int DelSelAtoms();
00077
00078 void BuildFrom(Expr* expr, HaMolSet* pmset );
00079 virtual int IsMember(const HaAtom* aptr) const;
00080
00081 HaAtom* GetFirstAtom();
00082 HaAtom* GetNextAtom();
00083
00084 const char* GetID() const;
00085 void SetID(const HaString& new_id);
00086
00087 HaString id;
00088
00089
00090
00091 virtual PointIterator* GetPointIterator();
00092 virtual int GetPtNum() { return size(); }
00093
00094 protected:
00095
00096 };
00097
00098 class HaMolSet;
00099
00100
00101
00102 class ChemGroup : public AtomList
00104 {
00105 public:
00106 ChemGroup();
00107 ChemGroup(HaMolSet* new_phost_mset, const char* new_id= "" );
00108 virtual ~ChemGroup();
00109
00110 bool FillRef(char* buf) const;
00111
00112 double GetProtect() const;
00113 bool SetProtect(const double new_protect);
00114
00115 friend class HaMolSet;
00116
00117 static HaString GetIDFromRef(const HaString& buf);
00118
00119 bool Print_info(ostream &sout, const int level) const;
00120
00121 protected:
00122
00123 HaMolSet* phost_mset;
00124
00125 double protect;
00126
00127 };
00128
00129 class HaChain;
00130
00131
00132
00133
00134
00135
00136 class HaResidue;
00137
00138 class AltChemState
00140 {
00141 public:
00142 AltChemState();
00143 AltChemState(AtomList* new_host_atom_set);
00144 AltChemState(const AltChemState& ref_state);
00145 virtual ~AltChemState();
00146
00148
00149 enum CHEM_STATE_TYPE { PROTONATED = 0, UNPROTONATED = 1, REDUCED = 2, OXIDIZED = 3 };
00150
00151 AtomList* GetHostAtomList() { return host_atom_list; }
00152 void SetStdParam();
00153
00154 HaString id;
00155 StrDoubleMap chmap;
00156 HaString mod_atom_name;
00157 int alt_state_type;
00158 double pk;
00159 double std_pk;
00160 int inactive_flag;
00161
00162 AtomList* host_atom_list;
00163 };
00164
00165
00166 typedef AtomListIterator AtomIteratorResidue;
00167
00169 class HaResidue : public AtomList
00170 {
00171 public:
00172 HaResidue();
00173 HaResidue(const HaResidue& ref_res);
00174 HaResidue(HaChain* new_phost_ch);
00175 virtual ~HaResidue();
00176
00177 bool SetParamFrom(const HaResidue& res_ref);
00178
00179 bool operator==(const HaResidue & rhs) const;
00180 bool operator< (const HaResidue & rhs) const;
00181
00182 HaAtom* AddNewAtom();
00183
00184 HaAtom* GetAtomByName(const char* atname);
00185 const HaAtom* GetAtomByName(const char* atname) const;
00186
00187 HaChain* GetHostChain() { return phost_ch; }
00188 bool SetHostChain(HaChain* new_phost) { phost_ch=new_phost; return true;}
00189 HaMolecule* GetHostMol();
00190 const HaMolecule* GetHostMol() const;
00191
00192 HaResidue* GetNextResInChain();
00193 HaResidue* GetPrevResInChain();
00194
00195 bool IsBonded(HaResidue* res2) ;
00196 int HasBackBHBond(HaResidue* res2);
00197
00198 const char* GetName() const;
00199 int SetName(const char* ptr, int max_len=0);
00200 void SetNameModifier( const char* new_name_mod) { NameModifier = new_name_mod; }
00201
00202 const char* GetNameModifier() { return NameModifier.c_str(); }
00203 HaString GetFullName() const;
00204
00206 static HaString GetResNameFromFullName(const char* res_full_name);
00207
00208 HaString GetRef() const;
00209 virtual bool FillRef(char* buf,int mode = 0) const;
00210
00211 int Selected();
00212
00213 bool SetUniqueAtomNames();
00214 HaString GetUniqueAtomName(int elem_no);
00215 bool SplitResidue();
00216
00217 int SetStdPK();
00218 int SetStdPK_G1();
00219
00220 bool SetStdPKforAtName(const char* at_name, double std_pk_new);
00221
00222 void PrintPK() const;
00223
00224 int GetNumAltStates() const;
00225 AltChemState* GetAltChemState(int alt_state_idx);
00226 AltChemState* GetAltChemStateByAtName(const char* at_name);
00227 int SetStdCharges();
00228 int SetAltCharges(AltChemState* alt_res_st, double weight=1.0);
00229 int InterpolResParams(const char* res_name_1, const char* res_name_2, double weight_1);
00230
00231 HaResidue* GetTemplate();
00232 int CheckStruct();
00233
00234 bool SetChargesForPH( double pH_val);
00235
00236 int GetSerNo() const { return serno; }
00237
00238 static const char* GetResNameInTable(const int j);
00239
00240
00241 bool IsAmino() const;
00242 bool IsAminoNucleo() const;
00243 bool IsNucleo() const;
00244 bool IsProtein() const;
00245 bool IsDNA() const;
00246 bool IsSolvent() const;
00247 bool IsWater() const;
00248 bool IsIon() const;
00249 bool IsPyrimidine() const;
00250 bool IsPurine() const;
00251 bool IsRNA() const;
00252 bool IsProline() const;
00253 bool IsHistidine() const;
00254 bool IsCysteine() const;
00255 bool IsAdenine() const;
00256 bool IsCytosine() const;
00257 bool IsGuanine() const;
00258 bool IsThymine() const;
00259 bool IsCoenzyme() const;
00260 bool IsTerm() const;
00261
00262 int CalcStdCrdSys(int fit_std_geom = FALSE);
00263
00264
00265
00266 static double CalcPhiAngle(const HaResidue* prev, const HaResidue* curr);
00267 static double CalcPsiAngle(const HaResidue* curr, const HaResidue* next );
00268
00269 HaChain* phost_ch;
00270 short serno;
00271 double width;
00272 short col1;
00273 short col2;
00274 char insert;
00275 int refno;
00276 Byte struc;
00277 Byte flag;
00278
00279 HaString NameModifier;
00280
00281 vector<AltChemState> alt_res_states;
00282 Vec3D_arr std_crd_sys;
00283
00284 static StrVec ResNames;
00285
00286 static int init_res_names_flag;
00287 static StrStrMap ResSynonym;
00288 static int InitStdResNames();
00289 static int InitResSynonym();
00290
00291 protected:
00292 void ResetData();
00293
00294 };
00295
00296 typedef list<HaBond>::iterator Bond_itr;
00297 typedef set<HaResidue, less<HaResidue> > Residues_type;
00298
00299 class HaChain
00301 {
00302 public:
00303 HaChain();
00304 HaChain(HaMolecule* new_phost_mol, const char new_ident=' ');
00305
00306 virtual ~HaChain();
00307
00308 bool SetParamFrom(const HaChain& chain_ref);
00309
00310 HaResidue* AddResidue(const int res_ser_no);
00311 int GetUniqResSerNo(const int term_res_flag=0) const;
00312
00313 bool SetUniqueResNo();
00314
00315 HaResidue* GetFirstRes();
00316 HaResidue* GetNextRes();
00317
00318 HaResidue* GetResBySerNo(const int res_ser_no);
00319
00320 int GetNRes() const { return Residues.size(); }
00321
00322 HaBond* AddBackB(HaAtom* src, HaAtom* dst,int flag);
00323
00324 HaBond* GetFirstBackB();
00325 HaBond* GetNextBackB();
00326
00327 bool operator==(const HaChain & rhs) const;
00328 bool operator< (const HaChain & rhs) const;
00329
00330
00331
00332 char ident;
00333
00334 set<HaResidue, less<HaResidue> > Residues;
00335 list<HaBond> BackBoneList;
00336
00337 HaMolecule* GetHostMol() { return phost_mol; }
00338 const HaMolecule* GetHostMol() const { return (const HaMolecule*) phost_mol; }
00339 void SetMolHost(HaMolecule* new_phost_mol) { phost_mol=new_phost_mol; }
00340
00341 protected:
00342
00343 void SetDefaultParam();
00344
00345 HaMolecule* phost_mol;
00346
00347 set<HaResidue, less<HaResidue> >::iterator CurResItr;
00348 list<HaBond>::iterator CurBackBoneItr;
00349
00350
00351 };
00352
00353 class Partition : public vector< AtomList >
00355 {
00356 public:
00357 Partition();
00358
00359 int SetDimensions(double xmin_new, double ymin_new, double zmin_new,
00360 double xmax_new, double ymax_new, double zmax_new);
00361
00362 int Reset() { clear(); resize(VOXSIZE); return True;}
00363
00364 double xmin;
00365 double ymin;
00366 double zmin;
00367
00368 double dx;
00369 double dy;
00370 double dz;
00371
00372 int VOXORDER;
00373 int VOXORDER2;
00374 int VOXSIZE;
00375
00376 int GetIdx_x( double x_coord );
00377 int GetIdx_y( double y_coord );
00378 int GetIdx_z( double z_coord );
00379
00380 int ixrad;
00381 int iyrad;
00382 int izrad;
00383
00384 int SetIncludeRad(double dist);
00385 int GetNeighbors(Vec3D& pt, AtomList& neighbors);
00386
00387 };
00388
00389 #endif
00390