ARB
island_hopping.h
Go to the documentation of this file.
1 // =========================================================== //
2 // //
3 // File : island_hopping.h //
4 // Purpose : //
5 // //
6 // Coded by Ralf Westram (coder@reallysoft.de) //
7 // Institute of Microbiology (Technical University Munich) //
8 // http://www.arb-home.de/ //
9 // //
10 // =========================================================== //
11 
12 #ifndef ISLAND_HOPPING_H
13 #define ISLAND_HOPPING_H
14 
15 #ifndef ARBTOOLS_H
16 #include <arbtools.h>
17 #endif
18 #ifndef ARB_CORE_H
19 #include <arb_core.h>
20 #endif
21 #ifndef POS_RANGE_H
22 #include <pos_range.h>
23 #endif
24 
25 class IslandHopping;
26 
27 class IslandHoppingParameter FINAL_TYPE {
28  int use_user_freqs;
29  double fT;
30  double fC;
31  double fA;
32  double fG;
33 
34  double rTC;
35  double rTA;
36  double rTG;
37  double rCA;
38  double rCG;
39  double rAG;
40 
41  double dist;
42  double supp;
43  double gapA;
44  double gapB;
45  double gapC;
46  double thres;
47 
48  friend class IslandHopping;
49 
50 public:
51  IslandHoppingParameter(bool use_user_freqs_,
52  double fT_, double fC_, double fA_, double fG_,
53  double rTC_, double rTA_, double rTG_, double rCA_, double rCG_, double rAG_,
54  double dist_, double supp_, double gapA_, double gapB_, double gapC_, double thres_);
55 
56  virtual ~IslandHoppingParameter();
57 };
58 
59 class IslandHopping FINAL_TYPE : virtual Noncopyable {
60  static IslandHoppingParameter *para;
61 
62  int alignment_length;
63 
64  int firstColumn; // @@@ go PosRange
65  int lastColumn;
66 
67  const char *ref_sequence; // with gaps
68 
69  const char *toAlign_sequence; // with gaps
70 
71  char *ref_helix; // with gaps
72  const char *toAlign_helix; // with gaps (@@@ always the same as 'ref_helix'?)
73 
74  char *aligned_ref_sequence; //aligned (ref_sequence)
75  char *output_sequence; // aligned (toAlign_sequence)
76 
77  int output_alignment_length;
78 
79 
80 public:
81 
83  alignment_length = 0;
84 
85  firstColumn = 0;
86  lastColumn = -1;
87 
88  ref_sequence = NULp;
89 
90  toAlign_sequence = NULp;
91 
92  ref_helix = NULp;
93  toAlign_helix = NULp;
94 
95  output_sequence = NULp;
96  aligned_ref_sequence = NULp;
97  output_alignment_length = 0;
98  }
99 
100  void set_parameters(bool use_user_freqs,
101  double fT, double fC, double fA, double fG,
102  double rTC, double rTA, double rTG, double rCA, double rCG, double rAG,
103  double dist, double supp, double gapA, double gapB, double gapC, double thres)
104  {
105  delete para;
106  para = new IslandHoppingParameter(use_user_freqs, fT, fC , fA, fG, rTC, rTA, rTG, rCA, rCG, rAG , dist, supp, gapA, gapB, gapC, thres);
107  }
108 
109  virtual ~IslandHopping() {
110  delete output_sequence;
111  delete aligned_ref_sequence;
112  free(ref_helix);
113  }
114 
115  void set_alignment_length(int len) { alignment_length = len; }
116 
117  void set_ref_sequence(const char *ref_seq) { ref_sequence = ref_seq; }
118 
119  void set_toAlign_sequence(const char *toAlign_seq) { toAlign_sequence = toAlign_seq; }
120 
121  void set_helix(const char *hel) {
122  freedup(ref_helix, hel);
123  toAlign_helix = ref_helix;
124  }
125 
126  void set_range(ExplicitRange range) {
127  firstColumn = range.start();
128  lastColumn = range.end();
129  }
130 
131  const char *get_result() const { return output_sequence; }
132  const char *get_result_ref() const { return aligned_ref_sequence; }
133  int get_result_length() const { return output_alignment_length; }
134 
135  bool was_aligned() const { return output_sequence && aligned_ref_sequence; }
136 
137  GB_ERROR do_align();
138 
139 };
140 
141 #else
142 #error island_hopping.h included twice
143 #endif // ISLAND_HOPPING_H
const char * GB_ERROR
Definition: arb_core.h:25
void set_ref_sequence(const char *ref_seq)
bool was_aligned() const
static void do_align(int &score, long act_seq_length)
Definition: ClustalV.cxx:807
int start() const
Definition: pos_range.h:60
virtual ~IslandHopping()
void set_parameters(bool use_user_freqs, double fT, double fC, double fA, double fG, double rTC, double rTA, double rTG, double rCA, double rCG, double rAG, double dist, double supp, double gapA, double gapB, double gapC, double thres)
void set_helix(const char *hel)
void set_range(ExplicitRange range)
void set_toAlign_sequence(const char *toAlign_seq)
const char * get_result_ref() const
int get_result_length() const
xml element
const char * get_result() const
#define NULp
Definition: cxxforward.h:116
int end() const
Definition: pos_range.h:64
void set_alignment_length(int len)