source: tags/arb-6.0/ISLAND_HOPPING/island_hopping.h

Last change on this file was 8614, checked in by westram, 12 years ago

merge from e4fix [8168] [8169] [8170] [8171] [8178] [8180] [8181] [8182] [8183] [8184] [8185] [8187] [8188] [8189]

  • merge similar concepts UpdateRange and TargetRange into PosRange
    • moved to CORE
    • added ExplicitRange
    • added PosRange::contains()
    • able to intersect
    • use in
      • AlignParams
      • readCompactedSequence()
      • UnalignedBases + UnalignedBasesList → LooseBases
      • to handle selection (aka "block") in edit4
      • for update interval (draw functions)
      • build_probe_match_string
  • added AliChange
    • holds sequence before and after alignment
  • DRYed code of calc_intervall_displayed_in_rectangle vs calc_update_intervall
  • cache sequence length in ED4_orf_terminal
  • added test for UnalignedBasesList (documenting wrong behavior)
  • renamed all *.stamp to stamp.*
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.8 KB
Line 
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
25class IslandHopping;
26
27class IslandHoppingParameter {
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
50public:
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
59class IslandHopping : 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    const char *ref_helix; // with gaps
72    const char *toAlign_helix; // with gaps
73
74    char *aligned_ref_sequence; //aligned (ref_sequence)
75    char *output_sequence;      // aligned (toAlign_sequence)
76
77    int output_alignment_length;
78
79
80public:
81
82    IslandHopping() {
83
84        alignment_length = 0;
85
86        firstColumn = 0;
87        lastColumn = -1;
88
89        ref_sequence = 0;
90
91        toAlign_sequence = 0;
92
93        ref_helix = 0;
94        toAlign_helix = 0;
95
96        output_sequence         = 0;
97        aligned_ref_sequence    = 0;
98        output_alignment_length = 0;
99    }
100
101    void set_parameters(bool use_user_freqs,
102                        double fT, double fC, double fA, double fG,
103                        double rTC, double rTA, double rTG, double rCA, double rCG, double rAG,
104                        double dist, double supp, double gapA, double gapB, double gapC, double thres)
105    {
106        delete para;
107        para = new IslandHoppingParameter(use_user_freqs, fT, fC , fA, fG, rTC, rTA, rTG, rCA, rCG, rAG , dist, supp, gapA, gapB, gapC, thres);
108    }
109
110    virtual ~IslandHopping() {
111        delete output_sequence;
112        delete aligned_ref_sequence;
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        ref_helix     = hel;
123        toAlign_helix = hel;
124    }
125
126    void set_range(PosRange 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
Note: See TracBrowser for help on using the repository browser.