source: tags/cvs_2_svn/GENOM/GEN_gene.hxx

Last change on this file was 3011, checked in by westram, 20 years ago
  • added member 'selected_range' + access function (used to track range of selected gene)
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 KB
Line 
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
21class GEN_root;
22class GEN_graphic;
23
24//  -----------------------
25//      class GEN_gene
26//  -----------------------
27class GEN_gene {
28private:
29    GBDATA         *gb_gene;
30    GEN_root       *root;
31    std::string          name;
32    mutable std::string  nodeInfo;
33    long            pos1;
34    long            pos2;
35    bool            complement;
36
37    //     int       level; // on which "level" the gene is printed
38
39    // Note: if a gene is joined from several parts it is represented in several GEN_gene's!
40
41    void init(GBDATA *gb_gene_, GEN_root *root_);
42    GB_ERROR load_positions(int part);
43
44public:
45    GEN_gene(GBDATA *gb_gene_, GEN_root *root_, GB_ERROR& error);
46    GEN_gene(GBDATA *gb_gene_, GEN_root *root_, int partNumber, int maxParts, GB_ERROR& error);
47    virtual ~GEN_gene();
48
49    inline bool operator<(const GEN_gene& other) const {
50        long cmp     = pos1-other.pos1;
51        if (cmp) cmp = pos2-other.pos2;
52        return cmp<0;
53    }
54
55    long StartPos() const { return pos1; } // first position of gene (1..n)
56    long EndPos() const { return pos2; } // last position of gene (1..n)
57    long Length() const { return pos2-pos1+1; }
58    bool Complement() const { return complement; }
59    //     int Level() const { return level; }
60    const std::string& NodeInfo() const { return nodeInfo; }
61    const std::string& Name() const { return name; } // returns the short name of the gene
62    const GBDATA *GbGene() const { return gb_gene; }
63    GEN_root *Root() { return root; }
64
65    void reinit_NDS() const;
66};
67
68typedef std::multiset<GEN_gene> GEN_gene_set;
69typedef GEN_gene_set::iterator GEN_iterator;
70
71//  -----------------------
72//      class GEN_root
73//  -----------------------
74class GEN_root {
75private:
76    GBDATA      *gb_main;
77    GEN_graphic *gen_graphic;
78    std::string  organism_name; // name1 of current species
79    // (in case of a pseudo gene-species this is the name of the species it originated from)
80
81    std::string  gene_name;     // name of current gene
82    GEN_gene_set gene_set;
83    std::string  error_reason;  // reason why we can't display gene_map
84    long         length;        // length of organism sequence
85
86    GBDATA *gb_gene_data;       // i am build upon this
87
88    AW_world selected_range; // draw-range of selected gene (set by paint, used by GEN_jump_cb)
89
90
91public:
92    GEN_root(const char *organism_name_, const char *gene_name_, GBDATA *gb_main_, AW_root *aw_root, GEN_graphic *gen_graphic_);
93    virtual ~GEN_root();
94
95    const std::string& GeneName() const { return gene_name; }
96    const std::string& OrganismName() const { return organism_name; }
97
98    GBDATA *GbMain() { return gb_main; }
99
100    void set_GeneName(const std::string& gene_name_) { gene_name = gene_name_; }
101
102    void paint(AW_device *device);
103
104    void reinit_NDS() const;
105
106    const AW_world& get_selected_range() const { return selected_range; }
107};
108
109
110
111#else
112#error GEN_gene.hxx included twice
113#endif // GEN_GENE_HXX
Note: See TracBrowser for help on using the repository browser.