source: tags/ms_r16q4/SL/SEQUENCE/AP_seq_protein.hxx

Last change on this file was 15198, checked in by westram, 8 years ago
  • remove virtual if OVERRIDE is present
    • OVERRIDE implies 'implicit virtual' (if code compiles as C++11 ← tested on build server!)
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 KB
Line 
1// =============================================================== //
2//                                                                 //
3//   File      : AP_seq_protein.hxx                                //
4//   Purpose   :                                                   //
5//                                                                 //
6//   Institute of Microbiology (Technical University Munich)       //
7//   http://www.arb-home.de/                                       //
8//                                                                 //
9// =============================================================== //
10
11#ifndef AP_SEQ_PROTEIN_HXX
12#define AP_SEQ_PROTEIN_HXX
13
14#ifndef AP_SEQUENCE_HXX
15#include <AP_sequence.hxx>
16#endif
17#ifndef DOWNCAST_H
18#include <downcast.h>
19#endif
20
21enum AP_PROTEINS {
22    APP_ILLEGAL = 0,
23
24    APP_A    = (1 <<  0),       // Ala
25    APP_C    = (1 <<  1),       // Cys
26    APP_D    = (1 <<  2),       // Asp
27    APP_E    = (1 <<  3),       // Glu
28    APP_F    = (1 <<  4),       // Phe
29    APP_G    = (1 <<  5),       // Gly
30    APP_H    = (1 <<  6),       // His
31    APP_I    = (1 <<  7),       // Ile
32    APP_K    = (1 <<  8),       // Lys
33    APP_L    = (1 <<  9),       // Leu
34    APP_M    = (1 << 10),       // Met
35    APP_N    = (1 << 11),       // Asn
36    APP_P    = (1 << 12),       // Pro
37    APP_Q    = (1 << 13),       // Gln
38    APP_R    = (1 << 14),       // Arg
39    APP_S    = (1 << 15),       // Ser
40    APP_T    = (1 << 16),       // Thr
41    APP_V    = (1 << 17),       // Val
42    APP_W    = (1 << 18),       // Trp
43    APP_Y    = (1 << 19),       // Tyr
44    APP_STAR = (1 << 20),       // *
45    APP_GAP  = (1 << 21),       // known gap ('-')
46
47    // -------------------- above are bit values, below combinations of them
48
49    APP_X   = (APP_GAP-1),      // Xxx (any real codon)
50    APP_DOT = APP_X | APP_GAP,   // maybe a codon, maybe a gap
51
52    APP_B = APP_D | APP_N,      // Asx ( = Asp | Asn )
53    APP_Z = APP_E | APP_Q,      // Glx ( = Glu | Gln )
54
55    APP_MAX = (APP_GAP<<1)-1,
56};
57
58class AP_sequence_protein : public AP_sequence { // derived from a Noncopyable
59    AP_PROTEINS *seq_prot;
60    AP_PROTEINS *mut1; // combination of sequences reachable with up to 1 nucleotide mutation per codon
61    AP_PROTEINS *mut2; // combination of sequences reachable with up to 2 nucleotide mutations per codons
62    // Note: ANY protein or a gap is reachable with up to 3 mutations per codon
63
64    AP_FLOAT count_weighted_bases() const OVERRIDE;
65    void set(const char *isequence) OVERRIDE;
66    void unset() OVERRIDE;
67
68    const AP_PROTEINS *get_mut1() const { lazy_load_sequence(); ap_assert(mut1); return mut1; }
69    const AP_PROTEINS *get_mut2() const { lazy_load_sequence(); ap_assert(mut2); return mut2; }
70
71public:
72    AP_sequence_protein(const AliView *aliview);
73    ~AP_sequence_protein() OVERRIDE;
74
75    const AP_PROTEINS *get_sequence() const { lazy_load_sequence(); ap_assert(seq_prot); return seq_prot; }
76
77    AP_sequence *dup() const OVERRIDE;                       // used to get the real new element
78    AP_FLOAT combine(const AP_sequence* lefts, const AP_sequence *rights, char *mutation_per_site = 0) OVERRIDE;
79    void partial_match(const AP_sequence* part, long *overlap, long *penalty) const OVERRIDE;
80    uint32_t checksum() const OVERRIDE;
81
82    bool equals(const AP_sequence_protein *other) const;
83    bool equals(const AP_sequence *other) const OVERRIDE { return equals(DOWNCAST(const AP_sequence_protein*, other)); }
84};
85
86
87
88#else
89#error AP_seq_protein.hxx included twice
90#endif // AP_SEQ_PROTEIN_HXX
Note: See TracBrowser for help on using the repository browser.