27enum Statename{type_unknown=-1, CDS, utr3, utr5, intron, utr3Intron, utr5Intron};
49 plus0, plus1, plus2, minus0, minus1, minus2, T_plus1, TA_plus2, TG_plus2, T_minus1, C_minus1, YY_minus0,
51 utr5intr, TLstart, TLstop, utr3intr, rutr5intr, rTLstart, rTLstop, rutr3intr, utrExon,
80 Status(Statename s=type_unknown,
int b=0,
int e=0,
double sc=0.0,
const void *it=NULL,
Status *n=NULL):
94 bool isIntron()
const {
return (name >= intron);}
95 bool isExon()
const {
return (name >= CDS && name <= utr5);}
96 bool isCDS()
const {
return (name == CDS);}
97 bool isUTR()
const {
return (name == utr3 || name == utr5);}
98 float getPostProb()
const {
return (item)? ((
State*)item)->apostprob : 0.0;}
99 int getLen()
const {
return end-begin+1;}
100 int getFrame()
const {
return isCDS()? ((
State*)item)->frame() : -1;}
101 bool hasEvidence()
const {
return ((
State*)item)->evidence;}
102 bool hasEvidence(
string srcname)
const;
103 int numEvidence()
const {
return hasEvidence()? ((
State*)item)->evidence->numEvidence : 0;}
110 Node(
int s=0,
int e=0,
float sc=0.0,
const void *it=NULL, NodeType t=NOT_KNOWN,
Node *p=NULL,
bool b=0,
Node *nn=NULL,
Node *pn=NULL):
118 nextNontrivialNeutNode(nn),
119 prevNontrivialNeutNode(pn)
128 Node *nextNontrivialNeutNode;
129 Node *prevNontrivialNeutNode;
133 StateType castToStateType();
134 void addWeight(
float weight);
137 bool isSampled()
const {
return(n_type == sampled || n_type == utrExon);}
172 Graph(list<Status> *states) : statelist(states) {}
175 void addBackEdgesComp();
177 void tarjanAlg(
Node* from, stack<Node*> &S,
size_t &index);
179 list<Node*> nodelist;
180 list<Status> *statelist;
182 map<string,Node*> existingNodes;
188 template<
class T>
inline bool alreadyProcessed(T *temp){
189 return(existingNodes[getKey(temp)]!=NULL);
191 inline bool alreadyProcessed(
string key){
192 return(existingNodes[key]!=NULL);
194 template<
class T>
inline Node* getNode(T *temp){
195 return existingNodes[getKey(temp)];
197 inline Node* getNode(
string key){
198 return existingNodes[key];
202 bool edgeExists(
Node *e1,
Node *e2);
203 inline void addToHash(
Node *n){
204 existingNodes[getKey(n)] = n;
206 Node* addExon(
Status *exon, vector<Node*> &neutralLine);
207 void addPair(
Status *exon1,
Status *exon2, vector<Node*> &neutralLine);
208 void createNeutralLine(vector<Node*> &neutralLine,
double weight=0.0,
bool onlyComplete=
false);
209 void addCompatibleEdges();
210 void insertIntron(
Node *exon1,
Node *exon2);
211 int minInQueue(queue<Node*> *q);
212 bool nonneutralIncomingEdge(
Node *exon);
213 void printGraphToShell();
214 void getSizeNeutralLine();
215 void addWeightToEdge();
218 virtual bool exonAtGeneStart(
Status *st)=0;
219 virtual bool exonAtGeneEnd(
Status *st)=0;
220 virtual string getKey(
Node *n)=0;
221 virtual string getKey(
Status *st)=0;
222 virtual string getKey(
State *st)=0;
224 virtual double getIntronScore(
Status *predExon,
Status *nextExon)=0;
225 virtual void addEdgeFromHead(
Status *exon)=0;
226 virtual void addEdgeToTail(
Status *exon)=0;
227 virtual bool compatible(
Node *exon1,
Node *exon2)=0;
228 virtual double setScore(
Status *st)=0;
229 virtual void calculateBaseScores()=0;
230 virtual void printGraph(
string filename)=0;
231 virtual void printGraph2(
string filename)=0;
232 virtual bool mergedStopcodon(
Node* exon1,
Node* exon2)=0;
233 virtual bool mergedStopcodon(
Status* exon1,
Status* exon2)=0;
234 virtual bool mergedStopcodon(StateType type1, StateType type2,
int end1,
int begin2)=0;
235 virtual float getAvgBaseProb(
Status *st) =0;
246 AugustusGraph(list<Status> *states,
const char* dna) :
Graph(states), sequence(dna), seqlength(strlen(dna)){
248 utr = Properties::getBoolProperty(
"UTR");
253 alpha_e = Properties::getdoubleProperty(
"/MeaPrediction/alpha_E");
258 alpha_i = Properties::getdoubleProperty(
"/MeaPrediction/alpha_I");
263 x0_e = Properties::getdoubleProperty(
"/MeaPrediction/x0_E");
268 x0_i = Properties::getdoubleProperty(
"/MeaPrediction/x0_I");
273 x1_e = Properties::getdoubleProperty(
"/MeaPrediction/x1_E");
278 x1_i = Properties::getdoubleProperty(
"/MeaPrediction/x1_I");
283 y0_e = Properties::getdoubleProperty(
"/MeaPrediction/y0_E");
288 y0_i = Properties::getdoubleProperty(
"/MeaPrediction/y0_I");
293 i1_e = Properties::getdoubleProperty(
"/MeaPrediction/i1_E");
298 i1_i = Properties::getdoubleProperty(
"/MeaPrediction/i1_I");
303 i2_e = Properties::getdoubleProperty(
"/MeaPrediction/i2_E");
308 i2_i = Properties::getdoubleProperty(
"/MeaPrediction/i2_I");
313 j1_e = Properties::getdoubleProperty(
"/MeaPrediction/j1_E");
318 j1_i = Properties::getdoubleProperty(
"/MeaPrediction/j1_I");
323 j2_e = Properties::getdoubleProperty(
"/MeaPrediction/j2_E");
328 j2_i = Properties::getdoubleProperty(
"/MeaPrediction/j2_I");
333 r_be = Properties::getdoubleProperty(
"/MeaPrediction/r_be");
338 r_bi = Properties::getdoubleProperty(
"/MeaPrediction/r_bi");
343 for(
int i = 0; i < seqlength*10; i++)
344 baseScore.push_back(0);
347 bool exonAtGeneStart(
Status *st);
348 bool exonAtGeneEnd(
Status *st);
349 bool exonAtCodingStart(
Node *st);
350 bool exonAtCodingEnd(
Node *st);
351 string getKey(
Node *n);
352 string getKey(
Status *st);
353 string getKey(
State *st);
355 double getIntronScore(
Status *predExon,
Status *nextExon);
356 void addEdgeFromHead(
Status *exon);
357 void addEdgeToTail(
Status *exon);
358 bool compatible(
Node *exon1,
Node *exon2);
359 bool sameStrand(StateType typeA, StateType typeB);
360 bool sameReadingFrame(
Node *e1,
Node *e2);
361 void calculateBaseScores();
362 double setScore(
Status *st);
363 int getBasetype(
Status *st,
int pos);
364 void printGraph(
string filename);
365 void printGraph2(
string filename);
366 bool mergedStopcodon(
Node* exon1,
Node* exon2);
368 bool mergedStopcodon(StateType type1, StateType type2,
int end1,
int begin2);
369 void getPoints(
Status *st,
double p,
double *a1,
double *a2,
double *b1,
double *b2);
370 float getAvgBaseProb(
Status *st);
373 const char* sequence;
375 vector<double> baseScore;