PTools.h

Go to the documentation of this file.
00001 /*
00002     LoopTK: Protein Loop Kinematic Toolkit
00003     Copyright (C) 2007 Stanford University
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License along
00016     with this program; if not, write to the Free Software Foundation, Inc.,
00017     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
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 //@package Inverse Kinematics
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     //static bool ApplyRotamer(PResidue *res);
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[]);
00163     static vector<vector<CDof> > GetBBDofs(vector<PProtein *> loops);
00164 
00170     static double RMSDBackbone(PProtein *protein0, PProtein *protein1, int loopstart, int loopend);
00171 
00177     static double RMSDAllAtom(PProtein *protein0, PProtein *protein1, int loopstart, int loopend);
00178 
00184     static bool CopyBackbone(PProtein *lpS, PProtein *lpD, int startS, int startD, int numRes);
00189     static bool CopyBackbone(PProtein *lpS, PProtein *lpD);
00195     static void RandomNullSpacePerturb(PProtein *lp, double pert_mag);
00199     static void RandomNullSpacePerturb(PProtein *lp, vector<vector<CDof> > Dofs, double pert_mag);
00203     static IKSolution CloseAlmostClosedLoop(PProtein *lp, Vector3 endPriorGoal,Vector3 endGoal, Vector3 endNextGoal);
00204     static int gsl_test();
00205   private:
00206 
00207 };
00208 //@package Conformation Analysis
00215 class PCluster {
00216  public:
00217 
00222   PCluster();
00223 
00229   PCluster(const PCluster &other);
00230 
00231   ~PCluster();
00232 
00238   void AddConformation(PLightChain *toAdd);
00239 
00246   void MergeWithCluster(PCluster &other);
00247 
00253   PLightChain *GetRepresentativeConformation() const;
00254 
00259   int size() const { return m_confs->size(); }
00260 
00266   bool empty() const { return m_confs->empty(); }
00267 
00273   list<PLightChain *> getConformations() const {
00274     return *m_confs;
00275   }
00276 
00277 
00278  private:
00279   list<PLightChain *> *m_confs;
00280   
00281 };
00282 
00283 #endif

Generated on Wed May 16 20:22:08 2007 for LoopTK: Protein Loop Kinematic Toolkit by  doxygen 1.5.1