-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLightEdge.H
88 lines (80 loc) · 2.76 KB
/
LightEdge.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
/****************************************************************
LightEdge.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_LightEdge_H
#define INCL_LightEdge_H
#include <iostream>
#include "BOOM/Vector.H"
#include "BOOM/Array1D.H"
#include "BOOM/Strand.H"
#include "BOOM/Interval.H"
#include "ContentType.H"
using namespace std;
using namespace BOOM;
class LightVertex;
class LightEdge {
public:
LightEdge(const String &substrate,ContentType,LightVertex *,LightVertex *,
int begin,int end,Strand,int ID);
virtual ~LightEdge() {}
ContentType getType() const;
inline ContentType getEdgeType() const { return getType(); }
bool isExon() const;
bool isCoding() const;
bool isIntron() const;
bool isIntergenic() const;
int getBegin() const;
int getEnd() const;
Interval asInterval() const { return Interval(begin,end); }
int getLength() const;
LightVertex *getLeft();
LightVertex *getRight();
float getScore(int frame=0) const;
void setScore(int frame,float score);
void setScore(float score) { setScore(0,score); }
Strand getStrand() const;
virtual void printOn(ostream &);
Array1D<int> getFrames() const;
void subsumeVertexScores();
int propagateForward(int phase) const;
int propagateBackward(int phase) const;
bool isSupported() const;
void setSupport(bool);
bool isBroken() const { return !supported; }
bool setBroken(bool b) { supported=!b; }
const String &getSubstrate() const { return substrate; }
int getID() const { return ID; }
void setID(int id) { ID=id; }
bool operator==(const LightEdge &) const;
virtual void setAnnotated(bool a) { annotated=a; }
virtual bool isAnnotated() { return annotated; }
protected:
LightVertex *left, *right;
ContentType type;
int begin, end;
float score[3];
int ID;
Strand strand;
String substrate;
bool supported; // False if broken splice site
bool annotated;
int posmod(int) const;
};
ostream &operator<<(ostream &,const LightEdge &);
struct LightEdgeComparator : public Comparator<LightEdge*> {
bool equal(LightEdge* &a,LightEdge* &b)
{return a->getBegin()==b->getBegin();}
bool greater(LightEdge* &a,LightEdge* &b)
{return a->getBegin()>b->getBegin();}
bool less(LightEdge* &a,LightEdge* &b)
{return a->getBegin()<b->getBegin();}
};
struct EdgeEndComparator : public Comparator<LightEdge*> {
bool equal(LightEdge* &a,LightEdge* &b) {return a->getEnd()==b->getEnd();}
bool greater(LightEdge* &a,LightEdge* &b) {return a->getEnd()>b->getEnd();}
bool less(LightEdge* &a,LightEdge* &b) {return a->getEnd()<b->getEnd();}
};
#endif