00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef PTOOLS_H
00021 #define PTOOLS_H
00022
00023
00024 #include "PBasic.h"
00025 #include "PExtension.h"
00026 #include "PNumRoutines.h"
00027 #include <gsl/gsl_sf_bessel.h>
00028
00029
00030 typedef Real(*ConformationDistFn)(const PLightChain*, const PLightChain*);
00031
00032 struct NullSpaceRet{
00033 double *Sval;
00034 double **Svec;
00035 int *ns;
00036 int n_ns;
00037 };
00038
00039 class PCluster;
00040
00045 class PTools {
00046 public:
00047
00066 static void GetGoals(PAtom *anchorPrior, PAtom *anchorEnd, PAtom *effectorPrior, PAtom *effectorEnd,
00067 Real len, Real angle1, Real angle2, Vector3 &goalPrior, Vector3 &goalEnd);
00068
00074 static void GetGoals(PProtein *protein, ProteinSide side, Vector3 &goalPrior, Vector3 &goalEnd);
00075
00084 static ProteinSide GetGoals(PProtein *protein, Vector3 &goalPrior, Vector3 &goalEnd);
00085
00089 static PProtein *CreateSlimProtein(PProtein *protein);
00090 static PProtein *CreateSlimProtein(PProtein *protein, int startRes, int endRes);
00091
00097 static Real EffectorAnchorDist(PProtein *loop, ProteinSide side);
00098
00102 static PChain *LowestCommonChain(PChain *c1, PChain *c2);
00103
00109 static list<PCluster> GetClusters(const PConformationSpace &space,
00110 ConformationDistFn distFn,
00111 Real threshold);
00112
00117 static int getBackboneAtomIndex(int resIndex, const string &atomID);
00118
00127
00128
00133 static void ComputeJacobian(PProtein *loop, vector<int> ind, double **Jac, Vector3 p,bool forward);
00134
00139 static void ComputeJacobian(PProtein *loop, vector<int> ind, double **Jac, bool forward);
00140
00145 static void ComputeJacobian(PProtein *loop, double **Jac);
00146
00151 static void ComputePseudoInverse(double **A, int m, int n, double **Ainv);
00155 static void ComputeNullSpace(double **Jac, int dim, bool SixDimensional, NullSpaceRet* Ret);
00159 static void ProjectOnNullSpace(PProtein *loop, vector<int> ind, bool forward, double ToProject[], double AfterProject[]);
00160
00161 static void ProjectOnNullSpace(PProtein *loop, vector<int> ind, bool forward, double ToProject[], double AfterProject[], bool sixDimensional);
00165 static vector<vector<CDof> > GetBBDofs(vector<PProtein *> loops);
00166
00172 static double RMSDCalpha (PProtein *protein0, PProtein *protein1, int loopstart, int loopend);
00173
00174
00180 static double RMSDBackbone(PProtein *protein0, PProtein *protein1, int loopstart, int loopend);
00181
00187 static double RMSDAllAtom(PProtein *protein0, PProtein *protein1, int loopstart, int loopend);
00188
00194 static bool CopyBackbone(PProtein *lpS, PProtein *lpD, int startS, int startD, int numRes);
00199 static bool CopyBackbone(PProtein *lpS, PProtein *lpD);
00205 static void RandomNullSpacePerturb(PProtein *lp, double pert_mag);
00209 static void RandomNullSpacePerturb(PProtein *lp, vector<vector<CDof> > Dofs, double pert_mag);
00213 static IKSolution CloseAlmostClosedLoop(PProtein *lp, Vector3 endPriorGoal,Vector3 endGoal, Vector3 endNextGoal);
00214 static int gsl_test();
00215 private:
00216
00217 };
00218
00225 class PCluster {
00226 public:
00227
00232 PCluster();
00233
00239 PCluster(const PCluster &other);
00240
00241 ~PCluster();
00242
00248 void AddConformation(PLightChain *toAdd);
00249
00256 void MergeWithCluster(PCluster &other);
00257
00263 PLightChain *GetRepresentativeConformation() const;
00264
00269 int size() const { return m_confs->size(); }
00270
00276 bool empty() const { return m_confs->empty(); }
00277
00283 list<PLightChain *> getConformations() const {
00284 return *m_confs;
00285 }
00286
00287
00288 private:
00289 list<PLightChain *> *m_confs;
00290
00291 };
00292
00293 #endif