SBMLDataModule Dataloader¶
To load and simulate data from the SBML model, follow the steps below:
Step 1: 📦 Import the module
In [1]:
Copied!
import sys
import os
# Go up to the root where `vpeleaderboard/` is located
sys.path.append(os.path.abspath("../../"))
import sys
import os
# Go up to the root where `vpeleaderboard/` is located
sys.path.append(os.path.abspath("../../"))
In [2]:
Copied!
from vpeleaderboard.data.src.sbml_dataloader import SBMLDataModule
from vpeleaderboard.data.src.sbml_dataloader import SBMLDataModule
c:\Users\hsrak\Documents\VPELeaderboard\myenv\Lib\site-packages\tqdm\auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html from .autonotebook import tqdm as notebook_tqdm
Step 2: ⚙️ Initialize the SBMLDataModule
Initialize the module by specifying the model base name (without the .xml extension).
In [3]:
Copied!
# Initialize with model base name (without `.xml`)
module = SBMLDataModule(file_name="BIOMD0000000537_url")
# Initialize with model base name (without `.xml`)
module = SBMLDataModule(file_name="BIOMD0000000537_url")
Step 3: 🧹 Prepare the model and config
Prepare the model by loading the configuration YAML and locating the SBML file.
In [4]:
Copied!
module.prepare_data() # Loads config YAML and locates SBML file
module.prepare_data() # Loads config YAML and locates SBML file
Step 4: 🧠 Setup the SBML model
Set up the model using the basico method.
In [5]:
Copied!
module.setup() # Loads the model using basico
module.setup() # Loads the model using basico
Step 5: 📈 Run simulation and access train DataFrame
Run the simulation and extract the data into a Pandas DataFrame.
In [6]:
Copied!
# Load the dataloader
train_loader = module.train_dataloader()
# Extract the DataFrame directly from the dataset
train_df = train_loader.dataset.data
# Show simulation preview
train_df
# Load the dataloader
train_loader = module.train_dataloader()
# Extract the DataFrame directly from the dataset
train_df = train_loader.dataset.data
# Show simulation preview
train_df
Out[6]:
sR{serum} | sgp130{serum} | R_IL6_gp130{liver} | IL6{serum} | Ab{serum} | R | sR_IL6{gut} | sR_IL6{liver} | R_IL6_gp130{gut} | Ab_sR{serum} | ... | sgp130{liver} | sR_IL6_sgp130{gut} | Ab{peripheral} | sR_IL6_sgp130{liver} | pSTAT3{gut} | STAT3{liver} | CRP Suppression (%) | CRP (% of baseline) | CRP{liver} | geneProduct | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Time | |||||||||||||||||||||
0.0 | 4.253507 | 3.900000 | 0.000066 | 0.000436 | 2.381820e-29 | 0.438236 | 0.001307 | 0.000976 | 0.000084 | 6.104391e-26 | ... | 5.589699 | 0.136304 | 1.679209e-29 | 0.116344 | 9.389364 | 0.777537 | -0.000000 | 100.000000 | 158.325847 | 159.803597 |
1.0 | 0.000031 | 3.901765 | 0.000064 | 0.000638 | 6.753452e+02 | 0.000178 | 0.001055 | 0.000951 | 0.000072 | 7.791481e+00 | ... | 5.591034 | 0.127067 | 2.144021e-01 | 0.114914 | 9.389266 | 0.777559 | 0.000001 | 99.999999 | 158.325653 | 159.802738 |
2.0 | 0.000037 | 3.905215 | 0.000062 | 0.000739 | 6.522828e+02 | 0.000070 | 0.000959 | 0.000916 | 0.000068 | 9.015753e+00 | ... | 5.594230 | 0.115733 | 4.442855e-01 | 0.110774 | 9.388692 | 0.777686 | 0.000029 | 99.999971 | 158.324515 | 159.797695 |
3.0 | 0.000043 | 3.907882 | 0.000060 | 0.000756 | 6.303828e+02 | 0.000049 | 0.000887 | 0.000868 | 0.000065 | 1.019966e+01 | ... | 5.597806 | 0.107157 | 6.659729e-01 | 0.105075 | 9.387640 | 0.777986 | 0.000156 | 99.999844 | 158.321844 | 159.788467 |
4.0 | 0.000049 | 3.909825 | 0.000058 | 0.000755 | 6.095828e+02 | 0.000039 | 0.000826 | 0.000817 | 0.000062 | 1.134655e+01 | ... | 5.600867 | 0.099879 | 8.798707e-01 | 0.098958 | 9.386196 | 0.778528 | 0.000495 | 99.999505 | 158.317000 | 159.775787 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
96.0 | 0.000960 | 3.900048 | 0.000008 | 0.000643 | 1.690247e+02 | 0.000086 | 0.000002 | 0.000002 | 0.000009 | 6.443776e+01 | ... | 5.581057 | 0.000269 | 8.875419e+00 | 0.000263 | 8.689731 | 1.591484 | 4.118263 | 95.881737 | 150.735143 | 153.432452 |
97.0 | 0.000972 | 3.900045 | 0.000007 | 0.000643 | 1.680433e+02 | 0.000087 | 0.000002 | 0.000002 | 0.000009 | 6.483892e+01 | ... | 5.581051 | 0.000258 | 8.918491e+00 | 0.000252 | 8.677568 | 1.605962 | 4.200370 | 95.799630 | 150.594039 | 153.317467 |
98.0 | 0.000984 | 3.900042 | 0.000007 | 0.000643 | 1.670710e+02 | 0.000088 | 0.000002 | 0.000002 | 0.000009 | 6.523864e+01 | ... | 5.581045 | 0.000247 | 8.961150e+00 | 0.000241 | 8.665300 | 1.620560 | 4.283303 | 95.716697 | 150.451544 | 153.201341 |
99.0 | 0.000995 | 3.900039 | 0.000007 | 0.000643 | 1.661073e+02 | 0.000089 | 0.000002 | 0.000002 | 0.000009 | 6.563691e+01 | ... | 5.581040 | 0.000237 | 9.003399e+00 | 0.000232 | 8.652927 | 1.635279 | 4.367068 | 95.632932 | 150.307646 | 153.084063 |
100.0 | 0.001007 | 3.900036 | 0.000007 | 0.000643 | 1.651518e+02 | 0.000090 | 0.000002 | 0.000002 | 0.000009 | 6.603375e+01 | ... | 5.581035 | 0.000228 | 9.045242e+00 | 0.000222 | 8.640447 | 1.650118 | 4.451671 | 95.548329 | 150.162334 | 152.965623 |
101 rows × 44 columns
In [7]:
Copied!
# Load the dataloader
train_loader = module.val_dataloader()
# Extract the DataFrame directly from the dataset
train_df = train_loader.dataset.data
# Show simulation preview
train_df
# Load the dataloader
train_loader = module.val_dataloader()
# Extract the DataFrame directly from the dataset
train_df = train_loader.dataset.data
# Show simulation preview
train_df
Out[7]:
sR{serum} | sgp130{serum} | R_IL6_gp130{liver} | IL6{serum} | Ab{serum} | R | sR_IL6{gut} | sR_IL6{liver} | R_IL6_gp130{gut} | Ab_sR{serum} | ... | sgp130{liver} | sR_IL6_sgp130{gut} | Ab{peripheral} | sR_IL6_sgp130{liver} | pSTAT3{gut} | STAT3{liver} | CRP Suppression (%) | CRP (% of baseline) | CRP{liver} | geneProduct | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Time | |||||||||||||||||||||
100.0 | 0.001007 | 3.900036 | 0.000007 | 0.000643 | 165.151830 | 0.000090 | 0.000002 | 1.885293e-06 | 0.000009 | 66.033750 | ... | 5.581035 | 0.000228 | 9.045242 | 0.000222 | 8.640447 | 1.650118 | 4.451671 | 95.548329 | 150.162334 | 152.965623 |
100.3 | 0.001011 | 3.900036 | 0.000007 | 0.000643 | 164.866762 | 0.000090 | 0.000002 | 1.863234e-06 | 0.000009 | 66.152523 | ... | 5.581034 | 0.000225 | 9.057716 | 0.000220 | 8.636683 | 1.654593 | 4.477216 | 95.522784 | 150.118463 | 152.929863 |
100.6 | 0.001014 | 3.900035 | 0.000007 | 0.000643 | 164.582401 | 0.000091 | 0.000002 | 1.841614e-06 | 0.000009 | 66.271167 | ... | 5.581032 | 0.000223 | 9.070154 | 0.000217 | 8.632909 | 1.659079 | 4.502837 | 95.497163 | 150.074463 | 152.893997 |
100.9 | 0.001018 | 3.900034 | 0.000007 | 0.000643 | 164.298740 | 0.000091 | 0.000002 | 1.820424e-06 | 0.000009 | 66.389683 | ... | 5.581031 | 0.000220 | 9.082556 | 0.000214 | 8.629125 | 1.663576 | 4.528535 | 95.471465 | 150.030335 | 152.858025 |
101.2 | 0.001021 | 3.900034 | 0.000007 | 0.000643 | 164.015772 | 0.000091 | 0.000002 | 1.799658e-06 | 0.000009 | 66.508072 | ... | 5.581030 | 0.000218 | 9.094922 | 0.000212 | 8.625332 | 1.668085 | 4.554309 | 95.445691 | 149.986077 | 152.821947 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
128.8 | 0.001380 | 3.900005 | 0.000005 | 0.000643 | 140.176195 | 0.000128 | 0.000001 | 9.195297e-07 | 0.000007 | 76.867934 | ... | 5.580976 | 0.000113 | 10.088813 | 0.000106 | 8.232916 | 2.131595 | 7.278681 | 92.721319 | 145.316474 | 149.008650 |
129.1 | 0.001384 | 3.900005 | 0.000005 | 0.000643 | 139.935180 | 0.000128 | 0.000001 | 9.159466e-07 | 0.000007 | 76.974824 | ... | 5.580976 | 0.000113 | 10.098145 | 0.000106 | 8.228154 | 2.137183 | 7.312435 | 92.687565 | 145.258702 | 148.961374 |
129.4 | 0.001388 | 3.900005 | 0.000005 | 0.000643 | 139.694472 | 0.000129 | 0.000001 | 9.124256e-07 | 0.000007 | 77.081590 | ... | 5.580976 | 0.000113 | 10.107447 | 0.000106 | 8.223382 | 2.142783 | 7.346285 | 92.653715 | 145.200767 | 148.913962 |
129.7 | 0.001392 | 3.900005 | 0.000005 | 0.000643 | 139.454070 | 0.000129 | 0.000001 | 9.089656e-07 | 0.000007 | 77.188233 | ... | 5.580976 | 0.000112 | 10.116719 | 0.000105 | 8.218598 | 2.148395 | 7.380231 | 92.619769 | 145.142669 | 148.866414 |
130.0 | 0.001397 | 3.900005 | 0.000005 | 0.000643 | 139.213971 | 0.000129 | 0.000001 | 9.055653e-07 | 0.000007 | 77.294752 | ... | 5.580975 | 0.000112 | 10.125962 | 0.000105 | 8.213803 | 2.154020 | 7.414273 | 92.585727 | 145.084408 | 148.818730 |
101 rows × 44 columns
In [8]:
Copied!
# Load the dataloader
train_loader = module.test_dataloader()
# Extract the DataFrame directly from the dataset
train_df = train_loader.dataset.data
# Show simulation preview
train_df
# Load the dataloader
train_loader = module.test_dataloader()
# Extract the DataFrame directly from the dataset
train_df = train_loader.dataset.data
# Show simulation preview
train_df
Out[8]:
sR{serum} | sgp130{serum} | R_IL6_gp130{liver} | IL6{serum} | Ab{serum} | R | sR_IL6{gut} | sR_IL6{liver} | R_IL6_gp130{gut} | Ab_sR{serum} | ... | sgp130{liver} | sR_IL6_sgp130{gut} | Ab{peripheral} | sR_IL6_sgp130{liver} | pSTAT3{gut} | STAT3{liver} | CRP Suppression (%) | CRP (% of baseline) | CRP{liver} | geneProduct | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Time | |||||||||||||||||||||
130.0 | 0.001397 | 3.900005 | 0.000005 | 0.000643 | 139.213971 | 0.000129 | 1.021915e-06 | 9.055653e-07 | 0.000007 | 77.294752 | ... | 5.580975 | 0.000112 | 10.125962 | 0.000105 | 8.213803 | 2.154020 | 7.414273 | 92.585727 | 145.084408 | 148.818730 |
130.5 | 0.001404 | 3.900005 | 0.000005 | 0.000643 | 138.814482 | 0.000130 | 1.016836e-06 | 9.000287e-07 | 0.000007 | 77.472009 | ... | 5.580975 | 0.000111 | 10.141299 | 0.000104 | 8.205787 | 2.163421 | 7.471227 | 92.528773 | 144.986941 | 148.738951 |
131.0 | 0.001411 | 3.900005 | 0.000005 | 0.000643 | 138.415819 | 0.000131 | 1.011916e-06 | 8.946486e-07 | 0.000007 | 77.648924 | ... | 5.580975 | 0.000111 | 10.156554 | 0.000103 | 8.197739 | 2.172857 | 7.528449 | 92.471551 | 144.889019 | 148.658791 |
131.5 | 0.001418 | 3.900005 | 0.000005 | 0.000643 | 138.017981 | 0.000132 | 1.007151e-06 | 8.894215e-07 | 0.000007 | 77.825496 | ... | 5.580975 | 0.000110 | 10.171727 | 0.000103 | 8.189660 | 2.182326 | 7.585942 | 92.414058 | 144.790638 | 148.578249 |
132.0 | 0.001426 | 3.900004 | 0.000005 | 0.000643 | 137.620962 | 0.000132 | 1.002538e-06 | 8.843432e-07 | 0.000006 | 78.001725 | ... | 5.580974 | 0.000109 | 10.186818 | 0.000102 | 8.181550 | 2.191830 | 7.643706 | 92.356294 | 144.691798 | 148.497322 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
178.0 | 0.002237 | 3.900000 | 0.000003 | 0.000643 | 104.073070 | 0.000217 | 8.993366e-07 | 7.262020e-07 | 0.000004 | 92.687652 | ... | 5.580967 | 0.000095 | 11.249528 | 0.000085 | 7.293227 | 3.216138 | 14.272712 | 85.727288 | 133.382560 | 139.173850 |
178.5 | 0.002248 | 3.900000 | 0.000003 | 0.000643 | 103.737957 | 0.000218 | 9.000409e-07 | 7.261637e-07 | 0.000004 | 92.829869 | ... | 5.580967 | 0.000095 | 11.257798 | 0.000085 | 7.281962 | 3.228905 | 14.360736 | 85.639264 | 133.232879 | 139.049463 |
179.0 | 0.002259 | 3.900000 | 0.000003 | 0.000643 | 103.403456 | 0.000219 | 9.007694e-07 | 7.261462e-07 | 0.000004 | 92.971691 | ... | 5.580967 | 0.000095 | 11.266003 | 0.000085 | 7.270662 | 3.241707 | 14.449138 | 85.550862 | 133.082567 | 138.924522 |
179.5 | 0.002269 | 3.900000 | 0.000003 | 0.000643 | 103.069566 | 0.000220 | 9.015220e-07 | 7.261493e-07 | 0.000004 | 93.113118 | ... | 5.580967 | 0.000095 | 11.274143 | 0.000085 | 7.259326 | 3.254543 | 14.537921 | 85.462079 | 132.931624 | 138.799027 |
180.0 | 0.002280 | 3.900000 | 0.000003 | 0.000643 | 102.736288 | 0.000221 | 9.022986e-07 | 7.261728e-07 | 0.000004 | 93.254148 | ... | 5.580967 | 0.000095 | 11.282218 | 0.000085 | 7.247955 | 3.267413 | 14.627084 | 85.372916 | 132.780047 | 138.672974 |
101 rows × 44 columns