-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEdge.H
103 lines (87 loc) · 3.07 KB
/
Edge.H
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/****************************************************************
Edge.H
Copyright (C)2013 William H. Majoros ([email protected]).
This is OPEN SOURCE SOFTWARE governed by the Gnu General Public
License (GPL) version 3, as described at www.opensource.org.
****************************************************************/
#ifndef INCL_Edge_H
#define INCL_Edge_H
#include "BOOM/Interval.H"
#include "Signal.H"
#include "genezilla.H"
#include "ContentType.H"
#include "BOOM/Strand.H"
#define SignalPtr BOOM::SmartPointer<Signal>
//=================================================================
// class Edge
//=================================================================
/*
Abstract base class.
*/
class Edge
{
protected:
SignalPtr left, right;
Edge(SignalPtr left,SignalPtr right);
public:
virtual ~Edge();
SignalPtr getLeft();
SignalPtr getRight();
virtual void dropScores()=0;
virtual bool isPhased() const=0;
int getEdgeBegin(); // after last base of left signal's context window
int getEdgeEnd(); // first base of right signal's context window
int getFeatureBegin(); // specific to exon/intron/UTR/intergenic
int getFeatureEnd(); // specific to exon/intron/UTR/intergenic
int getFeatureLength() {return getFeatureEnd()-getFeatureBegin();}
Interval getFeatureInterval() { return Interval(getFeatureBegin(),getFeatureEnd()); }
ContentType getContentType() const;
Strand getStrand();
bool isCoding();
bool isIntron();
bool isIntergenic();
bool isUTR();
int propagateForward(int phase);
int propagateBackward(int phase);
virtual void printOn(ostream &) const;
};
ostream &operator<<(ostream &,const Edge &);
//=================================================================
// class PhasedEdge
//=================================================================
/*
Used for exons and introns. Note that the phase of an edge is the
phase of the preceding signal (i.e., its left vertex).
*/
class PhasedEdge : public Edge
{
double scores[3]; // these include duration and transition scores
public:
PhasedEdge(double scorePhase0,double scorePhase1,double scorePhase2,
SignalPtr left,SignalPtr right);
double getEdgeScore(int phase); // phase is of left signal
void setEdgeScore(int phase,double);
double getInductiveScore(int phase); // phase is of left signal
virtual bool isPhased() const;
virtual void printOn(ostream &) const;
virtual void dropScores() { for(int i=0 ; i<3 ; ++i) scores[i]=0; }
};
//=================================================================
// class NonPhasedEdge
//=================================================================
/*
Used for intergenic & UTR
*/
class NonPhasedEdge : public Edge
{
double score; // includes duration and transition scores
public:
NonPhasedEdge(double score,SignalPtr left,SignalPtr right);
double getEdgeScore();
void setEdgeScore(double);
double getInductiveScore();
virtual bool isPhased() const;
virtual void printOn(ostream &) const;
virtual void dropScores() { score=0; }
};
#endif