-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnode.py
106 lines (75 loc) · 1.91 KB
/
node.py
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
104
105
from edge import Edge
class Node:
#id
#name
#inEdges
#outEdges
#extraInfluence
#geneName
#time
#status
#valid
#seedNeighborCount
#validOutDegree
STATUS_UP = "up"
STATUS_DOWN = "down"
STATUS_CONST = "constant"
def __init__(self, id, name, status):
self.id = id
self.name = name
self.status = status
self.inEdges = []
self.outEdges = []
self.valid = False
self.validOutDegree = 0
names = name.split('_')
self.geneName = names[0]
self.time = int(names[len(names)-1])
def __repr__(self):
return self.name
def getId(self):
return self.id
def getName(self):
return self.name
def getGeneName(self):
return self.geneName
def getTime(self):
return self.time
def isUpRegulated(self):
return self.status == Node.STATUS_UP
def isDownRegulated(self):
return self.status == Node.STATUS_DOWN
def isConstant(self):
return self.status == Node.STATUS_CONST
def getStatus(self):
return self.status
def getInEdges(self):
return self.inEdges
def getOutEdges(self):
return self.outEdges
def addInEdge(self, edge):
self.inEdges.append(edge)
def addOutEdge(self, edge):
self.outEdges.append(edge)
def getInDegree(self):
return len(self.inEdges)
def getOutDegree(self):
return len(self.outEdges)
def setValidOutDegree(self, outDegree):
self.validOutDegree = outDegree
def getValidOutDegree(self):
return self.validOutDegree
def setExtraInfluence(self, extraInfluence):
self.extraInfluence = extraInfluence
def getExtraInfluence(self):
return self.extraInfluence
def isValid(self):
return self.valid
def validate(self):
self.valid = True
def invalidate(self):
self.valid = False
def setSeedNeighborCount(self, seedNeighborCount):
self.seedNeighborCount = seedNeighborCount
def getSeedNeighborCount(self):
return self.seedNeighborCount