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 <shogun/lib/common.h>
00015 #include <shogun/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
00073 {
00074 return "LocalAlignmentStringKernel";
00075 }
00076
00077 protected:
00086 virtual float64_t compute(int32_t idx_a, int32_t idx_b);
00087
00088
00089 private:
00091 void init_logsum();
00092
00099 int32_t LogSum(int32_t p1, int32_t p2);
00100
00107 float32_t LogSum2(float32_t p1, float32_t p2);
00108
00117 float64_t LAkernelcompute(
00118 int32_t* aaX, int32_t* aaY, int32_t nX, int32_t nY);
00119
00122 void init_static_variables();
00123
00124 void init();
00125
00126 protected:
00128 bool initialized;
00129
00131 int32_t *isAA;
00133 int32_t *aaIndex;
00134
00136 int32_t m_opening;
00138 int32_t m_extension;
00139
00141 static int32_t logsum_lookup[LOGSUM_TBL];
00143 static const int32_t blosum[];
00145 int32_t* scaled_blosum;
00147 static const char* aaList;
00148 };
00149 }
00150 #endif