structureMapper.h

Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 // $Id: structureMapper.h,v 1.29.8.1 2007/03/25 21:25:32 oliver Exp $
00005 //
00006 // Author:
00007 //   Oliver Kohlbacher
00008 //   Hans-Peter Lenhof
00009 //
00010 
00011 #ifndef BALL_STRUCTURE_STRUCTUREMAPPER_H
00012 #define BALL_STRUCTURE_STRUCTUREMAPPER_H
00013 
00014 #ifndef BALL_COMMON_H
00015 # include <BALL/common.h>
00016 #endif
00017 
00018 #ifndef BALL_CONCEPT_PROCESSOR_H
00019 # include <BALL/CONCEPT/processor.h>
00020 #endif
00021 
00022 #ifndef BALL_STRUCTURE_GEOMETRICTRANSFORMATIONS_H
00023 # include <BALL/STRUCTURE/geometricTransformations.h>
00024 #endif
00025 
00026 #ifndef BALL_DATATYPE_STRING_H
00027 # include <BALL/DATATYPE/string.h>
00028 #endif
00029 
00030 #ifndef BALL_KERNEL_PROTEIN_H
00031 # include <BALL/KERNEL/protein.h>
00032 #endif
00033 
00034 #ifndef BALL_KERNEL_ATOM_H
00035 # include <BALL/KERNEL/atom.h>
00036 #endif
00037 
00038 #ifndef BALL_MATHS_MATRIX44_H
00039 # include <BALL/MATHS/matrix44.h>
00040 #endif
00041 
00042 #ifndef BALL_STRUCTURE_ATOMBIJECTION_H
00043 # include <BALL/STRUCTURE/atomBijection.h>
00044 #endif
00045 
00046 #include <vector>
00047 #include <map>
00048 
00049 namespace BALL 
00050 {
00051 
00055   class BALL_EXPORT StructureMapper
00056     : public TransformationProcessor
00057   {
00058     public:
00059 
00063     
00066     StructureMapper();
00067 
00070     StructureMapper(AtomContainer& A, AtomContainer& B);
00071 
00074     virtual ~StructureMapper();
00075 
00077 
00080     void set(AtomContainer& A, AtomContainer& B);
00081     
00084     double calculateRMSD();
00085     
00089     bool calculateTransformation();
00090 
00093     void calculateDefaultBijection();
00094 
00097     const AtomBijection& getBijection() const { return bijection_; }
00098 
00101     AtomBijection calculateFragmentBijection
00102       (const vector<Fragment*>& A, const vector<Fragment*>& B);
00103 
00106     bool mapFragments
00107       (const vector<Fragment*>& A, const vector<Fragment*>& B, 
00108        Matrix4x4* transformation, double upper_bound = 8.0, double lower_bound = 2.5);
00109 
00118     static Matrix4x4 matchPoints
00119       (const Vector3& w1, const Vector3& w2, const Vector3& w3, 
00120        const Vector3& v1, const Vector3& v2, const Vector3& v3);
00121 
00124     static Matrix4x4 matchBackboneAtoms(const Residue& r1, const Residue& r2);
00125 
00128     Size mapResiduesByBackbone(const list<Residue*>& l1, const list<Residue*>& l2);
00129    
00132     vector<vector<Fragment*> >& searchPattern
00133       (vector<Fragment*>& pattern, AtomContainer& composite,
00134        double max_rmsd = 4.0,    double max_center_tolerance = 2.0,
00135        double upper_bound = 8.0, double lower_bound = 4.0);
00136 
00139     Matrix4x4 mapProteins
00140       (Protein& P1, Protein& P2, 
00141        std::map<String, Size>&  type_map,
00142        Size&              no_matched_ca,
00143        double&            rmsd,
00144        double             upper_bound = 8.0,
00145        double             lower_bound = 4.0,
00146        double             tolerance = 0.6);
00147 
00148     protected:
00149     // Count the fragments in an AtomContainer -- this is not implemented
00150     // in AtomContainer!
00151     Size countFragments_(const AtomContainer& ac) const;
00152 
00153     /*_ The first of two composites - the "original" 
00154     */
00155     AtomContainer*  A_;
00156 
00157     /*_ The second composites - the "copy" to be mapped 
00158     */
00159     AtomContainer*  B_;
00160     
00161     /*_ The current atom bijection.
00162         Required for the caclulation of the RMSD.
00163     */
00164     AtomBijection bijection_;
00165     
00166     /*_ The rmsd of the last mapping executed 
00167     */
00168     double  rmsd_;
00169   };
00170 
00171 } // namespace BALL
00172 
00173 #endif // BALL_STRUCTURE_STRUCTUREMAPPER_H
00174