Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef _LOCALALIGNMENTSTRINGKERNEL_H___
00012 #define _LOCALALIGNMENTSTRINGKERNEL_H___
00013
00014 #include "lib/common.h"
00015 #include "kernel/StringKernel.h"
00016
00017 namespace shogun
00018 {
00019 #define LOGSUM_TBL 10000
00020
00027 class CLocalAlignmentStringKernel: public CStringKernel<char>
00028 {
00029 public:
00033 CLocalAlignmentStringKernel(int32_t size=0);
00034
00042 CLocalAlignmentStringKernel(
00043 CStringFeatures<char>* l, CStringFeatures<char>* r,
00044 float64_t opening=12, float64_t extension=2);
00045
00046 virtual ~CLocalAlignmentStringKernel();
00047
00054 virtual bool init(CFeatures* l, CFeatures* r);
00055
00057 virtual void cleanup();
00058
00063 virtual EKernelType get_kernel_type()
00064 {
00065 return K_LOCALALIGNMENT;
00066 }
00067
00072 virtual const char* get_name() const { return "LocalAlignment"; }
00073
00074 protected:
00083 virtual float64_t compute(int32_t idx_a, int32_t idx_b);
00084
00085
00086 private:
00088 void init_logsum();
00089
00096 int32_t LogSum(int32_t p1, int32_t p2);
00097
00104 float32_t LogSum2(float32_t p1, float32_t p2);
00105
00114 float64_t LAkernelcompute(
00115 int32_t* aaX, int32_t* aaY, int32_t nX, int32_t nY);
00116
00119 void init_static_variables();
00120
00121 void init();
00122
00123 protected:
00125 bool initialized;
00126
00128 int32_t *isAA;
00130 int32_t *aaIndex;
00131
00133 int32_t m_opening;
00135 int32_t m_extension;
00136
00138 static int32_t logsum_lookup[LOGSUM_TBL];
00140 static const int32_t blosum[];
00142 int32_t* scaled_blosum;
00144 static const char* aaList;
00145 };
00146 }
00147 #endif