SNPStringKernel.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) 2009-2010 Soeren Sonnenburg
00008  * Copyright (C) 2009-2010 Berlin Institute of Technology
00009  */
00010 
00011 #ifndef _SNPSTRINGKERNEL_H___
00012 #define _SNPSTRINGKERNEL_H___
00013 
00014 #include "lib/common.h"
00015 #include "kernel/StringKernel.h"
00016 
00017 namespace shogun
00018 {
00036 class CSNPStringKernel: public CStringKernel<char>
00037 {
00038     public:
00040         CSNPStringKernel(void);
00041 
00049         CSNPStringKernel(int32_t size, int32_t degree, int32_t win_len, bool inhomogene);
00050 
00059         CSNPStringKernel(
00060             CStringFeatures<char>* l, CStringFeatures<char>* r,
00061             int32_t degree, int32_t win_len, bool inhomogene);
00062 
00063         virtual ~CSNPStringKernel();
00064 
00071         virtual bool init(CFeatures* l, CFeatures* r);
00072 
00074         virtual void cleanup();
00075 
00080         virtual EKernelType get_kernel_type()
00081         {
00082             return K_POLYMATCH;
00083         }
00084 
00085         void set_minor_base_string(const char* str)
00086         {
00087             m_str_min=strdup(str);
00088         }
00089 
00090         void set_major_base_string(const char* str)
00091         {
00092             m_str_maj=strdup(str);
00093         }
00094 
00095         char* get_minor_base_string()
00096         {
00097             return m_str_min;
00098         }
00099 
00100         char* get_major_base_string()
00101         {
00102             return m_str_maj;
00103         }
00104 
00105         void obtain_base_strings();
00106 
00111         virtual const char* get_name() const { return "SNPStringKernel"; }
00112 
00113     protected:
00122         virtual float64_t compute(int32_t idx_a, int32_t idx_b);
00123 
00124     protected:
00126         int32_t m_degree;
00128         int32_t m_win_len;
00129 
00131         bool m_inhomogene;
00132 
00135         int32_t m_str_len;
00136 
00138         char* m_str_min;
00140         char* m_str_maj;
00141 };
00142 }
00143 #endif /* _SNPSTRINGKERNEL_H___ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation