1 |
tim |
66 |
#ifndef FASATOM_H |
2 |
|
|
#define FASATOM_H |
3 |
|
|
#include <iostream> |
4 |
|
|
#include <vector> |
5 |
|
|
#include "fasbond.h" |
6 |
|
|
using namespace std; |
7 |
|
|
|
8 |
|
|
class TFASModel; |
9 |
|
|
class TFASBond; |
10 |
|
|
class TFASResidue; |
11 |
|
|
class TFASMolecule; |
12 |
|
|
|
13 |
|
|
//ATOM Property Macros |
14 |
|
|
#define FAS_NORMAL_ATOM (1<<1) |
15 |
|
|
#define FAS_PROTEINBACK_ATOM (1<<2) |
16 |
|
|
#define FAS_NUCLEIC_ATOM (1<<3) |
17 |
|
|
#define FAS_AROMATIC_ATOM (1<<4) |
18 |
|
|
#define FAS_RING_ATOM (1<<5) |
19 |
|
|
#define FAS_CSTEREO_ATOM (1<<6) |
20 |
|
|
#define FAS_ACSTEREO_ATOM (1<<7) |
21 |
|
|
#define FAS_DONOR_ATOM (1<<8) |
22 |
|
|
#define FAS_ACCEPTOR_ATOM (1<<8) |
23 |
|
|
#define FAS_CHIRAL_ATOM (1<<10) |
24 |
|
|
|
25 |
|
|
namespace TAtomProp |
26 |
|
|
{ |
27 |
|
|
const int apNormal = FAS_NORMAL_ATOM; |
28 |
|
|
const int apProtein = FAS_PROTEINBACK_ATOM; |
29 |
|
|
const int apNucleic = FAS_NUCLEIC_ATOM; |
30 |
|
|
const int ap4Ring = FAS_4RING_ATOM; |
31 |
|
|
const int ap3Ring = FAS_3RING_ATOM; |
32 |
|
|
const int apAromatic = FAS_AROMATIC_ATOM; |
33 |
|
|
const int apRing = FAS_RING_ATOM; |
34 |
|
|
const int apCStereo = FAS_CSTEREO_ATOM; |
35 |
|
|
const int apACStereo = FAS_ACSTEREO_ATOM; |
36 |
|
|
const int apDonor = FAS_DONOR_ATOM; |
37 |
|
|
const int apAcceptor = FAS_ACCEPTOR_ATOM; |
38 |
|
|
const int apChiral = FAS_CHIRAL_ATOM; |
39 |
|
|
}; |
40 |
|
|
|
41 |
|
|
class TFASAtom |
42 |
|
|
{ |
43 |
|
|
protected: |
44 |
|
|
unsigned int _index; |
45 |
|
|
unsigned int _atomicNum; |
46 |
|
|
unsigned int _nameIndex; |
47 |
|
|
unsigned int _typeIndex; |
48 |
|
|
unsigned int _resid; |
49 |
|
|
unsigned int _residIndex; |
50 |
|
|
unsigned int _resnameIndex; |
51 |
|
|
unsigned int _chainIndex; |
52 |
|
|
unsigned int _segnameIndex; |
53 |
|
|
int _atomProp; |
54 |
|
|
|
55 |
|
|
//actually we can put these properties on an element table, but we may want to change them sometime, who |
56 |
|
|
//knows, anyway it is a trade off between space and speed |
57 |
|
|
float _mass; |
58 |
|
|
float _charge; |
59 |
|
|
float _covRadius; |
60 |
|
|
float _bondRadius; |
61 |
|
|
float _vdwRadius; |
62 |
|
|
float _maxBonds; |
63 |
|
|
float _pcharge; |
64 |
|
|
unsigned int _hyb; |
65 |
|
|
unsigned int _impval; |
66 |
|
|
|
67 |
|
|
TFASResidue *_residue; |
68 |
|
|
TFASMolecule *_mol; |
69 |
|
|
TFASModel * _model; |
70 |
|
|
vector<TFASBond *> _bondList; |
71 |
|
|
bool _pseudo; |
72 |
|
|
|
73 |
|
|
void SetAtomProp(int atomProp) { _atomProp |= atomProp;} |
74 |
|
|
void Clear(); |
75 |
|
|
public: |
76 |
|
|
TFASAtom(int index); |
77 |
|
|
~TFASAtom(); |
78 |
|
|
|
79 |
|
|
//methods to set atomic information |
80 |
|
|
void SetIndex(unsigned int index) { _index = index;} |
81 |
|
|
void SetAtomicNum(unsigned int atomicNum) { _atomicNum = atomicNum;} |
82 |
|
|
void SetNameIndex(unsigned int nameIndex) { _nameIndex = nameIndex;} |
83 |
|
|
void SetTypeIndex(unsigned int typeIndex) { _typeIndex = typeIndex;} |
84 |
|
|
void SetResid(unsigned int resid) { _resid=resid;} |
85 |
|
|
void SetResidIndex(unsigned int residIndex) { _residIndex = residIndex;} |
86 |
|
|
void SetResnameIndex(unsigned int resnameIndex) { _resnameIndex = resnameIndex;} |
87 |
|
|
void SetChainIndex(unsigned int chainIndex) { _chainIndex = chainIndex;} |
88 |
|
|
void SetSegnameIndex(unsigned int segnameIndex) { _segnameIndex = segnameIndex;} |
89 |
|
|
void SetResidue(TFASResidue *residue) { _residue = residue;} |
90 |
|
|
void SetMolecule(TFASMolecule *mol) { _mol = mol;} |
91 |
|
|
void SetModel(TFASModel *model) { _model = model;} |
92 |
|
|
void SetPseudo(bool pseudo) { _pseudo = pseudo;} |
93 |
|
|
void SetMass(float mass) { _mass = mass;} |
94 |
|
|
void SetCharge(float charge) { _charge = charge;} |
95 |
|
|
void SetPartialCharge(float pcharge) { _pcharge = pcharge;} |
96 |
|
|
void SetCovalentRadius(float covRadius) { _covRadius = covRadius;} |
97 |
|
|
void SetBondRadius(float bondRadius) { _bondRadius = bondRadius;} |
98 |
|
|
void SetVdwRadius(float vdwRadius) { _vdwRadius = vdwRadius;} |
99 |
|
|
void SetMaxBonds(float maxBonds) { _maxBonds=maxBonds;} |
100 |
|
|
void SetHyb(unsigned int hyb) { _hyb = hyb;} |
101 |
|
|
void SetImplicitValence (unsigned int impval) { _impval = impval;} |
102 |
|
|
|
103 |
|
|
//methods to get atomic information |
104 |
|
|
unsigned int GetIndex() { return _index;} |
105 |
|
|
unsigned int GetAtomicNum() { return _atomicNum;} |
106 |
|
|
unsigned int GetNameIndex() { return _nameIndex;} |
107 |
|
|
unsigned int GetTypeIndex() { return _typeIndex;} |
108 |
|
|
unsigned int GetResid() { return _resid;} |
109 |
|
|
unsigned int GetResidIndex() { return _residIndex;} |
110 |
|
|
unsigned int GetResnameIndex() { return _resnameIndex;} |
111 |
|
|
unsigned int GetChainIndex() { return _chainIndex;} |
112 |
|
|
unsigned int GetSegnameIndex() { return _segnameIndex;} |
113 |
|
|
|
114 |
|
|
TFASResidue *GetResidue() { return _residue;} |
115 |
|
|
TFASMolecule *GetMolecule() { return _mol;} |
116 |
|
|
TFASModel *GetModel() { return _model;} |
117 |
|
|
bool IsPseudo() { return _pseudo;} |
118 |
|
|
|
119 |
|
|
float GetMass() { return _mass;} |
120 |
|
|
float GetCharge() { return _charge;} |
121 |
|
|
float GetPartialCharge() { return _pcharge;} |
122 |
|
|
float GetCovalentRadius() { return _covRadius;} |
123 |
|
|
float GetBondRadius() { return _bondRadius;} |
124 |
|
|
float GetVdwRadius() { return _vdwRadius;} |
125 |
|
|
float GetMaxBonds() { return _maxBonds;} |
126 |
|
|
unsigned int GetHyb() { return _hyb;} |
127 |
|
|
unsigned int GetImplicitValence() { return _impval;} |
128 |
|
|
unsigned int GetHvyValence(); |
129 |
|
|
unsigned int GetValence() {return (unsigned int)_bondList.size();} |
130 |
|
|
|
131 |
|
|
//meothds to manipulate bond |
132 |
|
|
void AddBond(TFASBond * bond); |
133 |
|
|
void DeleteBond(TFASBond *bond); |
134 |
|
|
TFASBond *BeginBond(vector<TFASBond *>::iterator &i); |
135 |
|
|
TFASBond *NextBond(vector<TFASBond *>::iterator &i); |
136 |
|
|
TFASBond *GetBond(TFASAtom *nbrAtom); |
137 |
|
|
//methods to traverse neighbor atoms |
138 |
|
|
TFASAtom *BeginNbrAtom(vector<TFASBond *>::iterator &i); |
139 |
|
|
TFASAtom *NextNbrAtom(vector<TFASBond *>::iterator &i); |
140 |
|
|
|
141 |
|
|
// |
142 |
|
|
|
143 |
|
|
int GetAtomProp() { return _atomProp;} |
144 |
|
|
bool HasAtomProp(int atomProp) { return _atomProp & atomProp;} |
145 |
|
|
void SetAromatic() { SetAtomProp(TAtomProp::apAromatic);} |
146 |
|
|
void UnSetAromatic() { _atomProp &= ~TAtomProp::apAromatic;} |
147 |
|
|
|
148 |
|
|
void SetClockwiseStereo() |
149 |
|
|
{ |
150 |
|
|
_atomProp &= ~TAtomProp::apACStereo; |
151 |
|
|
SetAtomProp(TAtomProp::apCStereo|TAtomProp::apChiral); |
152 |
|
|
} |
153 |
|
|
|
154 |
|
|
void SetAntiClockwiseStereo() |
155 |
|
|
{ |
156 |
|
|
_atomProp &= ~TAtomProp::apCStereo; |
157 |
|
|
SetAtomProp(TAtomProp::apACStereo|TAtomProp::apChiral); |
158 |
|
|
} |
159 |
|
|
|
160 |
|
|
void UnSetStereo() |
161 |
|
|
{ |
162 |
|
|
_atomProp &= ~TAtomProp::apCStereo; |
163 |
|
|
_atomProp &= ~TAtomProp::apACStereo; |
164 |
|
|
_atomProp &= ~TAtomProp::apChiral; |
165 |
|
|
} |
166 |
|
|
|
167 |
|
|
void SetNormal() |
168 |
|
|
{ |
169 |
|
|
_atomProp &= ~TAtomProp::apProtein; |
170 |
|
|
_atomProp &= ~TAtomProp::apNucleic; |
171 |
|
|
} |
172 |
|
|
|
173 |
|
|
void SetProtein() |
174 |
|
|
{ |
175 |
|
|
_atomProp &= ~TAtomProp::apNormal; |
176 |
|
|
_atomProp &= ~TAtomProp::apNucleic; |
177 |
|
|
|
178 |
|
|
} |
179 |
|
|
|
180 |
|
|
void SetNucleic() |
181 |
|
|
{ |
182 |
|
|
_atomProp &= ~TAtomProp::apNormal; |
183 |
|
|
_atomProp &= ~TAtomProp::apProtein; |
184 |
|
|
|
185 |
|
|
} |
186 |
|
|
|
187 |
|
|
bool HasResidue() { return(_residue != NULL);} |
188 |
|
|
bool IsHydrogen() { return(_atomicNum == 1);} |
189 |
|
|
bool IsCarbon() { return(_atomicNum == 6);} |
190 |
|
|
bool IsNitrogen() { return(_atomicNum == 7);} |
191 |
|
|
bool IsOxygen() { return(_atomicNum == 8);} |
192 |
|
|
bool IsSulfur() { return(_atomicNum == 16);} |
193 |
|
|
bool IsPhosphorus() { return(_atomicNum == 15);} |
194 |
|
|
bool IsConnected(TFASAtom *atom); |
195 |
|
|
bool IsOneThree(TFASAtom *atom); |
196 |
|
|
bool IsOneFour(TFASAtom *atom); |
197 |
|
|
bool IsCarboxylOxygen(); |
198 |
|
|
bool IsPhosphateOxygen(); |
199 |
|
|
bool IsSulfateOxygen(); |
200 |
|
|
bool IsNitroOxygen(); |
201 |
|
|
bool IsAmideNitrogen(); |
202 |
|
|
bool IsPolarHydrogen(); |
203 |
|
|
bool IsNonPolarHydrogen(); |
204 |
|
|
bool IsInRing(); |
205 |
|
|
bool IsInRingSize(int ringSize); |
206 |
|
|
bool IsAromatic(); |
207 |
|
|
bool IsAromaticNOxide(); |
208 |
|
|
bool IsChiral(); |
209 |
|
|
bool IsAxial(); |
210 |
|
|
bool IsClockwise() { return HasAtomProp(TAtomProp::apCStereo);} |
211 |
|
|
bool IsAntiClockwise() { return HasAtomProp(TAtomProp::apACStereo);} |
212 |
|
|
bool HasChiralitySpecified() { return IsClockwise()|IsAntiClockwise(); } |
213 |
|
|
bool HasAlphaBetaUnsat(bool includePandS=true); |
214 |
|
|
bool HasBondOfOrder(int order); |
215 |
|
|
int CountBondsOfOrder(int order); |
216 |
|
|
bool HasSingleBond() { return(HasBondOfOrder(1)); } |
217 |
|
|
bool HasDoubleBond() { return(HasBondOfOrder(2)); } |
218 |
|
|
bool HasAromaticBond() { return(HasBondOfOrder(4)); } |
219 |
|
|
}; |
220 |
|
|
#endif |