-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodifyIt.py
More file actions
72 lines (63 loc) · 2.42 KB
/
modifyIt.py
File metadata and controls
72 lines (63 loc) · 2.42 KB
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
import argparse
import matplotlib.pyplot as plt
from scipy.integrate import odeint
from interactions import Interaction
from substrate import Enzyme
from substrate import Protein
from substrate import Influence
import storeIt
import openIt
import pickle
parser = argparse.ArgumentParser(description='change the values of substrates or interactions')
parser.add_argument('-i', '-input', help='input pickle file path', required=True)
# essentially can edit any of the substrate or interaction object attributes
def openTheNetwork(filePath):
return openIt.openNetwork(filePath)
def editSubstrate(network, name, storeFile=None, substrateType=None, initialValue=None, phosRate=None, dephosRate=None, maxValue=None, timeStart=None, timeEnd=None, currentValue=None):
for substrate in network.substrates:
if substrate.name == name:
if substrateType != None:
substrate.substrateType = substrateType
if initialValue != None:
substrate.initialValue = initialValue
if phosRate != None:
substrate.phosRate = phosRate
if dephosRate != None:
substrate.dephosRate = dephosRate
if maxValue != None:
substrate.maxValue = maxValue
if timeStart != None:
substrate.timeStart = timeStart
if timeEnd != None:
substrate.timeEnd = timeEnd
if currentValue != None:
substrate.currentValue = currentValue
print('Substrate Successfully Edited')
else:
continue
if storeFile == None:
return network
else:
storeIt.saveIt(network, storeFile)
def editInteraction(network, substrate1Name, substrate2Name, storeFile=None, behavior=None, rate=None):
for interaction in network.interactions:
if interaction.substrate1.name == substrate1Name and interaction.substrate2.name == substrate2Name:
if behavior != None:
interaction.behavior = behavior
if rate != None:
interaction.rate = float(rate)
print('Interaction Successfully Edited!')
else:
continue
if storeFile == None:
return network
else:
storeIt.saveIt(network, storeFile)
def addSubstrate():
return None
def addInteraction():
return None
def removeSubstrate():
return None
def removeInteraction():
return None