Skip to content

Commit

Permalink
update init for simple high level func
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexPatrie committed Sep 6, 2024
1 parent 5f09472 commit 1f35b56
Show file tree
Hide file tree
Showing 5 changed files with 187 additions and 0 deletions.
33 changes: 33 additions & 0 deletions bio_compose/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,36 @@
with open(version_file_path, 'r') as f:
__version__ = f.read().strip()


def run_simulation(*args, **kwargs):
# TODO: implement this
pass


def verify(*args, **kwargs):
import time
from bio_compose.verifier import Verifier

verifier = Verifier()
simulators = kwargs.get('simulators')
run_sbml = False
for arg in args:
if isinstance(arg, int):
run_sbml = True
submission = None
if run_sbml:
submission = verifier.verify_sbml(*args, **kwargs)
else:
submission = verifier.verify_omex(*args, **kwargs)
job_id = submission.get('job_id')
output = None
if job_id is not None:
while True:
verification_result = verifier.get_output(job_id=job_id)
status = verification_result['content']['status']
if not 'COMPLETED' in status:
time.sleep(1)
else:
output = verification_result
break
return output
154 changes: 154 additions & 0 deletions tests/fixtures/sbml-core/BIOMD0000000001_url.xml.psc
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
# Generated by PySCeS 1.2.2 (2024-09-03 15:15)

# Keywords
Description: Edelstein1996 - EPSP ACh event
Modelname: BIOMD0000000001
Output_In_Conc: True
Species_In_Conc: True

# GlobalUnitDefinitions
UnitSubstance: mole, 1.0, 0, 1
UnitVolume: litre, 1.0, 0, 1
UnitTime: second, 1.0, 0, 1
UnitLength: metre, 1.0, 0, 1
UnitArea: metre, 1.0, 0, 2

# Compartments
Compartment: comp1, 1.0, 3

# Reactions
React0@comp1:
B = BL
comp1*(kf_0*B-kr_0*BL)

React1@comp1:
BL = BLL
comp1*(kf_1*BL-kr_1*BLL)

React2@comp1:
BLL = ALL
comp1*(kf_2*BLL-kr_2*ALL)

React3@comp1:
A = AL
comp1*(kf_3*A-kr_3*AL)

React4@comp1:
AL = ALL
comp1*(kf_4*AL-kr_4*ALL)

React5@comp1:
B = A
comp1*(kf_5*B-kr_5*A)

React6@comp1:
BL = AL
comp1*(kf_6*BL-kr_6*AL)

React7@comp1:
I = IL
comp1*(kf_7*I-kr_7*IL)

React8@comp1:
IL = ILL
comp1*(kf_8*IL-kr_8*ILL)

React9@comp1:
A = I
comp1*(kf_9*A-kr_9*I)

React10@comp1:
AL = IL
comp1*(kf_10*AL-kr_10*IL)

React11@comp1:
ALL = ILL
comp1*(kf_11*ALL-kr_11*ILL)

React12@comp1:
D = DL
comp1*(kf_12*D-kr_12*DL)

React13@comp1:
DL = DLL
comp1*(kf_13*DL-kr_13*DLL)

React14@comp1:
I = D
comp1*(kf_14*I-kr_14*D)

React15@comp1:
IL = DL
comp1*(kf_15*IL-kr_15*DL)

React16@comp1:
ILL = DLL
comp1*(kf_16*ILL-kr_16*DLL)

# Event definitions
Event: RemovalACh, _TIME_ > t2, delay=0.0, priority=None, persistent=True {
kf_0 = 0
kf_3 = 0
kf_7 = 0
kf_12 = 0
kf_1 = 0
kf_4 = 0
kf_8 = 0
kf_13 = 0
}


# Fixed species

# Variable species
BLL@comp1 = 0.0
IL@comp1 = 0.0
AL@comp1 = 0.0
A@comp1 = 0.0
BL@comp1 = 0.0
B@comp1 = 1.66057788110262e-05
DLL@comp1 = 0.0
D@comp1 = 0.0
ILL@comp1 = 0.0
DL@comp1 = 0.0
I@comp1 = 0.0
ALL@comp1 = 0.0

# Parameters
kf_0 = 3000.0
kr_0 = 8000.0
kf_1 = 1500.0
kr_1 = 16000.0
kf_2 = 30000.0
kr_2 = 700.0
kf_3 = 3000.0
kr_3 = 8.64
kf_4 = 1500.0
kr_4 = 17.28
kf_5 = 0.54
kr_5 = 10800.0
kf_6 = 130.0
kr_6 = 2740.0
kf_7 = 3000.0
kr_7 = 4.0
kf_8 = 1500.0
kr_8 = 8.0
kf_9 = 19.7
kr_9 = 3.74
kf_10 = 19.85
kr_10 = 1.74
kf_11 = 20.0
kr_11 = 0.81
kf_12 = 3000.0
kr_12 = 4.0
kf_13 = 1500.0
kr_13 = 8.0
kf_14 = 0.05
kr_14 = 0.0012
kf_15 = 0.05
kr_15 = 0.0012
kf_16 = 0.05
kr_16 = 0.0012
t2 = 20.0


Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 1f35b56

Please sign in to comment.