LocalAlignmentStringKernel.h

Go to the documentation of this file.
00001 /*
00002  * This program is free software; you can redistribute it and/or modify
00003  * it under the terms of the GNU General Public License as published by
00004  * the Free Software Foundation; either version 3 of the License, or
00005  * (at your option) any later version.
00006  *
00007  * Written (W) 1999-2009 Soeren Sonnenburg
00008  * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
00009  */
00010 
00011 #ifndef _LOCALALIGNMENTSTRINGKERNEL_H___
00012 #define _LOCALALIGNMENTSTRINGKERNEL_H___
00013 
00014 #include <shogun/lib/common.h>
00015 #include <shogun/kernel/string/StringKernel.h>
00016 
00017 namespace shogun
00018 {
00019 
00021 const int32_t LOGSUM_TBL=10000;      
00022 
00029 class CLocalAlignmentStringKernel: public CStringKernel<char>
00030 {
00031     public:
00035         CLocalAlignmentStringKernel(int32_t size=0);
00036 
00044         CLocalAlignmentStringKernel(
00045             CStringFeatures<char>* l, CStringFeatures<char>* r,
00046             float64_t opening=12, float64_t extension=2);
00047 
00048         virtual ~CLocalAlignmentStringKernel();
00049 
00056         virtual bool init(CFeatures* l, CFeatures* r);
00057 
00059         virtual void cleanup();
00060 
00065         virtual EKernelType get_kernel_type()
00066         {
00067             return K_LOCALALIGNMENT;
00068         }
00069 
00074         virtual const char* get_name() const
00075         {
00076             return "LocalAlignmentStringKernel";
00077         }
00078 
00079     protected:
00088         virtual float64_t compute(int32_t idx_a, int32_t idx_b);
00089 
00090 
00091     private:
00093         void init_logsum();
00094 
00101         int32_t LogSum(int32_t p1, int32_t p2);
00102 
00109         float32_t LogSum2(float32_t p1, float32_t p2);
00110 
00119         float64_t LAkernelcompute(
00120             int32_t* aaX, int32_t* aaY, int32_t nX, int32_t nY);
00121 
00124         void init_static_variables();
00125 
00126         void init();
00127 
00128     protected:
00130         bool initialized;
00131 
00133         int32_t *isAA;
00135         int32_t *aaIndex;
00136 
00138         int32_t m_opening;
00140         int32_t m_extension;
00141 
00143         static int32_t logsum_lookup[LOGSUM_TBL];
00145         static const int32_t blosum[];
00147         int32_t* scaled_blosum;
00149         static const char* aaList;
00150 };
00151 }
00152 #endif /* _LOCALALIGNMENTSTRINGKERNEL_H__ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation