Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PDB.hh
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 /* */
3 /* ---- SPARTA ---- */
4 /* Shifts Prediction from Analogue of Residue type and Torsion Angle */
5 /* Yang Shen and Ad Bax */
6 /* J. Biomol. NMR, 38, 289-302 (2007) */
7 /* NIH, NIDDK, Laboratory of Chemical Physics */
8 /* version, 1.01 (build 2009.0928.17) */
9 /* */
10 /* for any problem, please contact */
11 /* shenyang@niddk.nih.gov */
12 /* */
13 /******************************************************************************/
14 
15 #ifndef PDB_H
16 #define PDB_H
17 
18 // AUTO-REMOVED #include <string>
19 #include <vector>
20 #include <map>
21 #include <algorithm>
22 #include <boost/unordered_map.hpp>
23 
24 #include <utility/vector0.hh>
25 
26 #include <core/pose/Pose.fwd.hh>
27 
28 #include <utility/vector1.hh>
29 
30 
31 namespace protocols {
32 namespace sparta {
33 
34 typedef float Vec3[3];
35 typedef float Mat3[3][3];
36 typedef boost::unordered_map<int, boost::unordered_map<int, double> > DoubleD2;
37 typedef boost::unordered_map<int, double> DoubleD1;
38 
39 typedef struct CORdata {
42  float X, Y, Z, B_Factor;
44 } PDB_Entry;
45 
46 
47 typedef struct {
48  int resID, atomNo;
50  PDB_Entry atoms[6];
51 
52  Vec3 coordA[6];
53  Vec3 center, norm;
55  float rad;
56 
57  float ringFact;
58 } RingData;
59 
60 typedef boost::unordered_map<int, PDB_Entry> Mol; //atom list indexed by atom number
61 typedef boost::unordered_map<int, Mol> Mols;
62 
63 
64 class PDB
65 {
66  long sgn(float x);
67  float arccos_(float x);
68  void Vec3Zero(Vec3 v);
69  void Vec3Copy(Vec3 v1, Vec3 v2);
70  float Vec3Abs(Vec3 v);
71  float Vec3DiffAbs(Vec3 v1, Vec3 v2);
72  void Vec3Norm(Vec3 v);
73  void Vec3Scale(Vec3 v, float s);
74  void Vec3Add(Vec3 v1, Vec3 v2);
75  void Vec3Sub(Vec3 v1, Vec3 v2);
76  float Vec3Scalar(Vec3 v1, Vec3 v2);
77  void Vec3Cross(Vec3 v1, Vec3 v2);
78  void Mat3VecMult(Vec3 v, Mat3 m);
79  void Vec3ScaleAdd(Vec3 v1, float s, Vec3 v2);
80 
81 public:
82 
84 
85  RingData Rings[2000]; //Aromatic ring list
86  int RingNo;
87 
89 
90  //molecules
92  //atom list indexed by conformer ID + atom number
93  boost::unordered_map<int, boost::unordered_map<int, boost::unordered_map< std::string, PDB_Entry> > > ATOMS;
94  //atom list indexed by conformer ID + residue number + atom name
95 
96  std::map<int, std::string> residList, residListOne; //resdiue lists with three-letter-aa and one-letter-aa name
97  int r1, rN;
98 
99  boost::unordered_map<int, int> acceptorList; // Acceptor List for H-bond indexed by atom index
100  boost::unordered_map<int, int> donorList; // Donor List for H-bond indexed by atom indeice of itself and its connected heavy atom
101  boost::unordered_map<int, boost::unordered_map< std::string, float> > HBDistList; // HBond distance indexed by residue number and atom name
102  boost::unordered_map<int, boost::unordered_map< std::string, float> > HBEnergyList; // HBond energy list indexed by residue number and atom name
103  boost::unordered_map<int, boost::unordered_map< std::string, float> > HB_DHO_AngleList; // HBond angle (Donator-H-O) indexed by residue number and atom name
104  boost::unordered_map<int, boost::unordered_map< std::string, float> > HB_HOA_AngleList; // HBond angle (H-O-Acceptor_base) indexed by residue number and atom name
105 
106 
109  int SurfPrec ;
110  boost::unordered_map< int, utility::vector0<int> > NeighborList;
111  // Neighboring atom list, indexed by atom number of target atom, and utility::vector0 list of neighbor atoms
112  boost::unordered_map< int,float> ResSurfaceFullList, ResSurfacePartList;
113  // Residue Surface list, indexed by residue number, and surface area for this residue
114 
115  boost::unordered_map<int, boost::unordered_map< std::string,float> > AtomSurfaceFullList, AtomSurfacePartList;
116  // Atom Surface list, indexed by residue number, atom name, and surface area for this residue
117  boost::unordered_map< std::string, float > VDW_RAD; //VDW radius for different type of atoms
118 
119  boost::unordered_map<int, float> HN_S2;
120  boost::unordered_map<int, boost::unordered_map< std::string, float> > ElectricField; // indexed by resID and atomName
121 
122  PDB();
123  PDB(const std::string& fileName);
124 
125  //amino acid name convertion
126  std::string getThreeAAName(char a);
128 
129  //load pdb coordinates
130  void loadPDB(const std::string &fileName);
131  void loadPDB(std::istream &file);
132 
133  void loadPDB( core::pose::Pose const& pose );
134 
135  void loadPDB_Entry(const std::string &str, PDB_Entry &entry);
136  std::string getField(const std::string &str, int index);
137 
138  //get atom
139  PDB_Entry getEntry(int conformerID, int rNum, const std::string &aName); //get atom by residue number and atom name
140  PDB_Entry getEntry(int conformerID, int aNum); //get atom by atom number
141 
142  //get angles and distances
143  float getBondAngle(Vec3 A, Vec3 B, Vec3 C);
146  float getPhi(int conformerID, int resNum);
147  float getPsi(int conformerID, int resNum);
148  float getOmega(int conformerID, int resNum);
149  float getChi1(int conformerID, int resNum);
150  float getChi2(int conformerID, int resNum);
151  float getDist(Vec3 A, Vec3 B);
152  float getDist(PDB_Entry A, PDB_Entry B);
153 
154  bool isSSBonded(int conformerID, int resNum);
155 
156  //get ring current shifts
157  void initOrbitalShift();
158  float getOrbitalShift(int conformerID, int resNum, const std::string &aName);
159  void calcPlane(RingData *ringP);
160 
161  //get H-bond information
162  void initHBond(float DIST=3.5, float ANGLE=35);
163  float getHBondDist(PDB_Entry D);
164  float getHBondDist(int resNum, std::string atomName);
165  PDB_Entry isAcceptor(PDB_Entry A); //check if an atom is an Acceptor for a H-Hond
166  PDB_Entry isDonor(PDB_Entry D); //check if an aotm is a Donor for a H-hond, and return the connected heavy atom
167 
168  // void SphereCalcPoints(int divNo, Vec3 **pointAP, int *pointNoP);
169  void calcTriangles( double x0, double y0, double z0,
170  double x1, double y1, double z1,
171  double x2, double y2, double z2,
172  int rowStartA[], int rowNo, int quad,
173  int row0, int ind0, int ind1,
174  int row2, int ind2,
175  Vec3 *pointA);
176  void findNeighors(float rad_sol);
177  // void initSurface(float rad_sol );
178  void calcSurface( float rad_sol );
179 
180  void calc_HN_S2( );
181  void calc_ElectricField( );
182 
183  void collect_HN_S2_and_EF( );
184 };
185 
186 }
187 }
188 
189 #endif
190