SHOGUN  v2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SNPStringKernel.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 2009-2010 Soeren Sonnenburg
8  * Copyright (C) 2009-2010 Berlin Institute of Technology
9  */
10 
11 #ifndef _SNPSTRINGKERNEL_H___
12 #define _SNPSTRINGKERNEL_H___
13 
14 #include <shogun/lib/common.h>
16 
17 namespace shogun
18 {
36 class CSNPStringKernel: public CStringKernel<char>
37 {
38  public:
41 
49  CSNPStringKernel(int32_t size, int32_t degree, int32_t win_len, bool inhomogene);
50 
61  int32_t degree, int32_t win_len, bool inhomogene);
62 
63  virtual ~CSNPStringKernel();
64 
71  virtual bool init(CFeatures* l, CFeatures* r);
72 
74  virtual void cleanup();
75 
81  {
82  return K_POLYMATCH;
83  }
84 
89  void set_minor_base_string(const char* str)
90  {
91  m_str_min=strdup(str);
92  }
93 
98  void set_major_base_string(const char* str)
99  {
100  m_str_maj=strdup(str);
101  }
102 
108  {
109  return m_str_min;
110  }
111 
117  {
118  return m_str_maj;
119  }
120 
122  void obtain_base_strings();
123 
128  virtual const char* get_name() const { return "SNPStringKernel"; }
129 
130  /* register the parameters
131  */
132  virtual void register_params();
133 
134  protected:
143  virtual float64_t compute(int32_t idx_a, int32_t idx_b);
144 
145  protected:
147  int32_t m_degree;
149  int32_t m_win_len;
150 
153 
156  int32_t m_str_len;
157 
159  char* m_str_min;
161  char* m_str_maj;
162 
163  private:
164  void init();
165 };
166 }
167 #endif /* _SNPSTRINGKERNEL_H___ */

SHOGUN Machine Learning Toolbox - Documentation