Augustus 3.4.0
Loading...
Searching...
No Matches
exoncand.hh
1/*
2 * exoncand.hh
3 *
4 * License: Artistic License, see file LICENSE.TXT or
5 * https://opensource.org/licenses/artistic-license-1.0
6 */
7
8#ifndef _EXONCAND_HH
9#define _EXONCAND_HH
10
11#include <stdint.h>
12
13#include "types.hh"
14#include "exonmodel.hh" // for OpenReadingFrame
15#define EXON_TYPES 17
16
17enum ExonType {UNKNOWN_EXON = -1,
18 // forward strand
19 singleGene, initial_0, initial_1, initial_2, internal_0, internal_1, internal_2, terminal_exon,
20 // reverse strand
21 rsingleGene, rinitial_exon, rinternal_0, rinternal_1, rinternal_2, rterminal_0, rterminal_1, rterminal_2
22};
23
24bool isPlusExon(ExonType t);
25bool hasStopCodon(ExonType t);
26
27extern const int exonTypeReadingFrames[EXON_TYPES-1];
28extern const char* stateExonTypeIdentifiers[EXON_TYPES-1];
29
30// converts a stateTypeIdentifier to the ExonType
31ExonType toExonType(const char* str);
32
46public:
47 ExonCandidate(ExonType s=UNKNOWN_EXON, long int b=0, long int e=0, double sc=0.0, Double up_sc=1.0, Double down_sc=1.0):
48 type(s),
49 begin(b),
50 end(e),
51 score(sc),
52 upScore(up_sc),
53 downScore(down_sc)
54 {}
56 begin = other->begin;
57 end = other->end;
58 type = other->type;
59 score = other->score;
60 upScore = other->upScore;
61 downScore = other->downScore;
62 }
64 ExonType type;
65 int begin, end;
66 double score;
67
68 int getStart();
69 int getEnd();
70 int frame() const { return exonTypeReadingFrames[type]; } // frame of the exon
71 int frame(int p) const { return isPlusExon(type) ? // frame at position p within the exon
72 mod3(frame() - (end + 1) + p) :
73 mod3(frame() + end + 1 - p);
74 }
75 Double getUpScore() const {return upScore;}
76 Double getDownScore() const {return downScore;}
77 double getScore() const {return score;}
78 void setUpScore(Double s) {upScore = s;}
79 void setDownScore(Double s) {downScore = s;}
80 void setScore(double s) {score = s;}
81
82 int getFirstCodingBase();
83 int getLastCodingBase();
84 int gff3Frame();
85 int len() {return end-begin+1;}
86 ExonType getExonType();
87 int complementType();
88 StateType getStateType();
89 string key();
90 int_fast64_t getKey(); // keys encodes all of: chrStart chrEnd type lenMod3
91 bool correctType(const char* dna, int dnalen); // verify ExonType on sequence
92 friend ostream& operator<<(ostream& strm, const ExonCandidate &ec);
93private:
94 Double upScore, downScore;
95};
96
97/*
98 * assqthresh, dssqthresh are between 0 and 1 and thresholds for the inclusion of
99 * acceptor/donor splice sites based on the pattern probability
100 * assqthresh=0.05 means that only acceptor ss are considered
101 * that have a pattern, such that 5% of true splice site patterns have lower probability.
102 * The default threshold of 0 means that all splice site patterns are considered.
103 */
104
105void findExonCands(map<int_fast64_t, ExonCandidate*> &ecs, map<int_fast64_t, ExonCandidate*> &addECs, const char *dna, int minLen=1, double assmotifqthresh=0.15, double assqthresh=0.3, double dssqthresh=0.7);
106
107//computes the score for the splice sites of an exon candidate
108Double computeSpliceSiteScore(Double exonScore, Double minProb, Double maxProb);
109
110// create new EC from a key encoding all of: chrStart chrEnd type lenMod3
111// verification of type, noInFrameStop, etc.
112ExonCandidate* create(int_fast64_t key, const char* dna, int dnalen);
113
114#endif // _EXONCAND_HH
Generation of exon candidates (=possible exons)
Definition exoncand.hh:45
This class implements a double object with a very large range.
Definition lldouble.hh:31