1 | /********************************************************************************* |
---|
2 | * Coded by Ralf Westram (coder@reallysoft.de) in 2001 * |
---|
3 | * Institute of Microbiology (Technical University Munich) * |
---|
4 | * http://www.mikro.biologie.tu-muenchen.de/ * |
---|
5 | *********************************************************************************/ |
---|
6 | |
---|
7 | #ifndef GEN_GENE_HXX |
---|
8 | #define GEN_GENE_HXX |
---|
9 | |
---|
10 | #ifndef __SET__ |
---|
11 | #include <set> |
---|
12 | #endif |
---|
13 | #ifndef __STRING__ |
---|
14 | #include <string> |
---|
15 | #endif |
---|
16 | |
---|
17 | // ---------------------------------------- |
---|
18 | // display classes for ARB_GENE_MAP: |
---|
19 | // ---------------------------------------- |
---|
20 | |
---|
21 | class GEN_root; |
---|
22 | class GEN_graphic; |
---|
23 | struct GEN_position; |
---|
24 | |
---|
25 | // ----------------------- |
---|
26 | // class GEN_gene |
---|
27 | // ----------------------- |
---|
28 | class GEN_gene { |
---|
29 | private: |
---|
30 | GBDATA *gb_gene; |
---|
31 | GEN_root *root; |
---|
32 | std::string name; |
---|
33 | mutable std::string nodeInfo; |
---|
34 | long pos1; |
---|
35 | long pos2; |
---|
36 | bool complement; |
---|
37 | |
---|
38 | // int level; // on which "level" the gene is printed |
---|
39 | |
---|
40 | // Note: if a gene is joined from several parts it is represented in several GEN_gene's! |
---|
41 | |
---|
42 | void init(GBDATA *gb_gene_, GEN_root *root_); |
---|
43 | void load_location(int part, const GEN_position *location); |
---|
44 | |
---|
45 | public: |
---|
46 | GEN_gene(GBDATA *gb_gene_, GEN_root *root_, const GEN_position *location); |
---|
47 | GEN_gene(GBDATA *gb_gene_, GEN_root *root_, const GEN_position *location, int partNumber); |
---|
48 | ~GEN_gene() {} |
---|
49 | |
---|
50 | inline bool operator<(const GEN_gene& other) const { |
---|
51 | long cmp = pos1-other.pos1; |
---|
52 | if (cmp) cmp = pos2-other.pos2; |
---|
53 | return cmp<0; |
---|
54 | } |
---|
55 | |
---|
56 | long StartPos() const { return pos1; } // first position of gene (1..n) |
---|
57 | long EndPos() const { return pos2; } // last position of gene (1..n) |
---|
58 | long Length() const { return pos2-pos1+1; } |
---|
59 | bool Complement() const { return complement; } |
---|
60 | // int Level() const { return level; } |
---|
61 | const std::string& NodeInfo() const { return nodeInfo; } |
---|
62 | const std::string& Name() const { return name; } // returns the short name of the gene |
---|
63 | const GBDATA *GbGene() const { return gb_gene; } |
---|
64 | GEN_root *Root() { return root; } |
---|
65 | |
---|
66 | void reinit_NDS() const; |
---|
67 | }; |
---|
68 | |
---|
69 | typedef std::multiset<GEN_gene> GEN_gene_set; |
---|
70 | typedef GEN_gene_set::iterator GEN_iterator; |
---|
71 | |
---|
72 | // ----------------------- |
---|
73 | // class GEN_root |
---|
74 | // ----------------------- |
---|
75 | class GEN_root { |
---|
76 | private: |
---|
77 | GBDATA *gb_main; |
---|
78 | GEN_graphic *gen_graphic; |
---|
79 | std::string organism_name; // name1 of current species |
---|
80 | // (in case of a pseudo gene-species this is the name of the species it originated from) |
---|
81 | |
---|
82 | std::string gene_name; // name of current gene |
---|
83 | GEN_gene_set gene_set; |
---|
84 | std::string error_reason; // reason why we can't display gene_map |
---|
85 | long length; // length of organism sequence |
---|
86 | |
---|
87 | GBDATA *gb_gene_data; // i am build upon this |
---|
88 | |
---|
89 | AW_world selected_range; // draw-range of selected gene (set by paint, used by GEN_jump_cb) |
---|
90 | |
---|
91 | |
---|
92 | public: |
---|
93 | GEN_root(const char *organism_name_, const char *gene_name_, GBDATA *gb_main_, AW_root *aw_root, GEN_graphic *gen_graphic_); |
---|
94 | ~GEN_root() {} |
---|
95 | |
---|
96 | const std::string& GeneName() const { return gene_name; } |
---|
97 | const std::string& OrganismName() const { return organism_name; } |
---|
98 | |
---|
99 | GBDATA *GbMain() { return gb_main; } |
---|
100 | |
---|
101 | void set_GeneName(const std::string& gene_name_) { gene_name = gene_name_; } |
---|
102 | |
---|
103 | void paint(AW_device *device); |
---|
104 | |
---|
105 | void reinit_NDS() const; |
---|
106 | |
---|
107 | const AW_world& get_selected_range() const { return selected_range; } |
---|
108 | }; |
---|
109 | |
---|
110 | |
---|
111 | |
---|
112 | #else |
---|
113 | #error GEN_gene.hxx included twice |
---|
114 | #endif // GEN_GENE_HXX |
---|