source: branches/port5/GENOM/GEN_gene.hxx

Last change on this file was 5768, checked in by westram, 16 years ago
  • rewrote genome importer
  • remove redundant 'translation' entries of genes during import
  • whole code is using
    • 'pos_start' instead of 'pos_begin*'
    • 'pos_stop' instead of 'pos_end*'
    • 'pos_certain' instead of 'pos_uncertain*'
    • 'pos_complement' instead of 'complement'
  • convert gene locations in old genome DBs into new format
  • added several gene functions to ARBDB
    • GEN_create_nonexisting_gene…()
    • GEN_find_or_create_gene..()
    • GEN_global_gene_identifier()
  • added code to handle gene locations into ARBDB (type GEN_position represents every flavour of a Genbank/EMBL feature location)
  • added GBT_write_byte()
  • rewrote GBT_read_gene_sequence() (adding GBT_read_gene_sequence_and_length)
  • changed codon tables according to NCBI code info
    • added start codon(s) for code 3, 9, 13
    • changed code names
  • when importing to a new DB, reset DB type if import fails (before ARB had to be restarted, after one try with wrong genome/non-genome import)
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.6 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;
23struct GEN_position;
24
25//  -----------------------
26//      class GEN_gene
27//  -----------------------
28class GEN_gene {
29private:
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
45public:
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
69typedef std::multiset<GEN_gene> GEN_gene_set;
70typedef GEN_gene_set::iterator GEN_iterator;
71
72//  -----------------------
73//      class GEN_root
74//  -----------------------
75class GEN_root {
76private:
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
92public:
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
Note: See TracBrowser for help on using the repository browser.