API Reference
pkpd.macros
clearance(species, compartment, cl)
Generate a reaction for the systemic clearance of a species from a compartment.
Note that species
is not required to be "concrete".
Parameters:
Name | Type | Description | Default |
---|---|---|---|
species
|
(Monomer, MonomerPattern or ComplexPattern)
|
The species undergoing linear elimination. If a Monomer, sites are considered as unbound and in their default state. If a pattern, must be concrete. |
required |
compartment
|
Compartment
|
The compartment from which the species is being lost. |
required |
cl
|
Parameters or number
|
Clearance rate in volume/time. If a Parameter is passed, it will be used directly in
the generated Rule. If a number is passed, a Parameter will be created
with an automatically generated name based on the names and site states
of the components of |
required |
Returns:
Name | Type | Description |
---|---|---|
components |
ComponentSet
|
The generated components. Contains the unidirectional clearance Rule, an Expression for the conversion of the clearance rate to a unidirectional rate constant, and optionally a Parameter if cl was given as a number. |
Examples:
Linear elimination all Drug in the Central compartment::
Model()
Compartment('CENTRAL')
Monomer('Drug')
clearace(Drug, CENTRAL, 1.)
Execution::
>>> Model() # doctest:+ELLIPSIS
<Model '_interactive_' ...>
>>> Monomer('Drug')
Monomer('Drug')
>>> Compartment('CENTRAL', size=30.)
Compartment(name='CENTRAL', parent=None, dimension=3, size=30.)
>>> clearance(Drug, CENTRAL, 1.) # doctest:+NORMALIZE_WHITESPACE
ComponentSet([
Rule('clearance_Drug_CENTRAL', Drug() ** CENTRAL >> None, k_CL_expr_Drug_CENTRAL),
Expression('k_CL_expr_Drug_CENTRAL', CL_Drug_CENTRAL/V_CENTRAL),
Parameter('CL_Drug_CENTRAL', 1.0),
])
Source code in src\pysb\pkpd\macros.py
422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 |
|
distribute(species, c1, c2, klist)
Generate the unimolecular reversible equilibrium reaction to distribute/redistribute the species between the two compartments: species ** c1 <-> species ** c2.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
species
|
Monomer or MonomerPattern
|
|
required |
c1
|
Compartment
|
|
required |
c2
|
Compartment
|
|
required |
klist
|
list of 2 Parameters or list of 2 numbers
|
Forward (S1 -> S2) and reverse rate constants (in that order). If Parameters are passed, they will be used directly in the generated Rules. If numbers are passed, Parameters will be created with automatically generated names based on the names and states of S1 and S2 and these parameters will be included at the end of the returned component list. |
required |
Returns:
Name | Type | Description |
---|---|---|
components |
ComponentSet
|
The generated components. Contains one reversible Rule and optionally two Parameters if klist was given as plain numbers. |
Examples:
Distribution/redistribution of Drug between the CENTRAL and PERIPHERAL compartments::
Model()
Monomer('Drug')
Compartment("CENTRAL")
Compartment("PERIPHERAL")
distribute(Drug, CENTRAL, PERIPHERAL, [1, 1])
Execution::
>>> Model() # doctest:+ELLIPSIS
<Model '_interactive_' ...>
>>> Monomer('Drug')
Monomer('Drug')
>>> Compartment("CENTRAL")
Compartment(name='CENTRAL', parent=None, dimension=3, size=1.),
>>> Compartment("PERIPERAL")
Compartment(name='PERIPHERAL', parent=None, dimension=3, size=1.),
>>> distribute(Drug, CENTRAL, PERIPHERAL [1, 1]) # doctest:+NORMALIZE_WHITESPACE
ComponentSet([
Rule('distribute_Drug_CENTRAL_to_PERIPHERAL', Drug() ** CENTRAL | Drug() ** PERIPHERAL, distribute_Drug_CENTRAL_to_PERIPHERAL_kf, distribute_Drug_CENTRAL_to_PERIPHERAL_kr),
Parameter('distribute_Drug_CENTRAL_to_PERIPHERAL_kf', 1.0),
Parameter('distribute_Drug_CENTRAL_to_PERIPHERAL_kr', 1.0),
])
Source code in src\pysb\pkpd\macros.py
dose_absorbed(species, compartment, dose, ka, f)
A dose that is absorbed into the compartment via first order kinetics with a given bioavailability.
Note that species
is not required to be "concrete". The dose should be given in
amount such as weight, mass, or moles.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
species
|
(Monomer, MonomerPattern or ComplexPattern)
|
The species to set with Initial. If a Monomer, sites are considered as unbound and in their default state. If a pattern, must be concrete. |
required |
compartment
|
Compartment
|
The compartment to which the species is added. |
required |
dose
|
Parameter or number
|
The bolus dose amount. If a Parameter is passed, it will be used directly in
the generated Rule. If a number is passed, a Parameter will be created
with an automatically generated name based on the names and site states
of the components of |
required |
ka
|
Parameter or number
|
The first-order kinetic rate parameter for the absorption process. Units should be amount/time. |
required |
f
|
Parameter or number
|
The bioavailability of the drug/species (fraction 0 to 1). |
required |
Returns:
Name | Type | Description |
---|---|---|
components |
ComponentSet
|
The generated components. Contains the unidirectional absorption Rule, an expression for the effective rate (ka * f), and optionally three Parameters if dose, ka, and f were given as numbers. |
Examples:
Absorbed dose to central compartment::
Model()
Monomer("Drug")
Compartment('CENTRAL')
dose_absorbed(Drug, CENTRAL, 100., 1.1, 0.8)
Execution::
>>> Model() # doctest:+ELLIPSIS
<Model '_interactive_' ...>
>>> Monomer('Drug')
Monomer('Drug')
>>> Compartment('CENTRAL', size=30.)
Compartment(name='CENTRAL', parent=None, dimension=3, size=30.)
>>> dose_absorbed(Drug, CENTRAL, 100.) # doctest:+NORMALIZE_WHITESPACE
ComponentSet([
Rule('absorb_Drug_CENTRAL', None >> Drug() ** CENTRAL, expr_Drug_CENTRAL_absorb_rate),
Parameter('dose_Drug_CENTRAL', 100.0),
Expression('expr_Drug_CENTRAL_dose', dose_Drug_CENTRAL/V_CENTRAL),
Parameter('ka_Drug_CENTRAL', 1.1),
Parameter('F_Drug_CENTRAL', 0.8),
Expression('expr_Drug_CENTRAL_absorb_rate', F_Drug_CENTRAL*ka_Drug_CENTRAL*(expr_Drug_CENTRAL_dose - _obs_ka_expr_Drug_CENTRAL)/V_CENTRAL),
])
Source code in src\pysb\pkpd\macros.py
1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 |
|
dose_bolus(species, compartment, dose)
An instantaneous, or bolus, dose of species in compartment.
Note that species
is not required to be "concrete". The dose should be given in
amount such as weight, mass, or moles which is converted into a concentration
by dividing by the compartment size. This is set as the initial concentration at
time zero.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
species
|
(Monomer, MonomerPattern or ComplexPattern)
|
The species to set with Initial. If a Monomer, sites are considered as unbound and in their default state. If a pattern, must be concrete. |
required |
compartment
|
Compartment
|
The compartment to which the species is added. |
required |
dose
|
Parameter or number
|
The bolus dose amount. If a Parameter is passed, it will be used directly in
the generated Rule. If a number is passed, a Parameter will be created
with an automatically generated name based on the names and site states
of the components of |
required |
Returns:
Name | Type | Description |
---|---|---|
components |
ComponentSet
|
The generated components. Contains the unidirectional elimination Rule and optionally a Parameter if kel was given as a number. |
Examples:
Linear elimination all Drug in the Central compartment::
Model()
Compartment('Central')
Monomer('Drug')
dose_bolus(Drug, Central, 100.)
Execution::
>>> Model() # doctest:+ELLIPSIS
<Model '_interactive_' ...>
>>> Monomer('Drug')
Monomer('Drug')
>>> Compartment('CENTRAL', size=30.)
Compartment(name='CENTRAL', parent=None, dimension=3, size=30.)
>>> dose_bolus(Drug, CENTRAL, 100.) # doctest:+NORMALIZE_WHITESPACE
ComponentSet([
Parameter('dose_Drug_CENTRAL', 100.0),
Expression('expr_Drug_CENTRAL_0', dose_Drug_CENTRAL/V_CENTRAL),
])
Source code in src\pysb\pkpd\macros.py
1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 |
|
dose_infusion(species, compartment, dose)
A continuous, zero-order, infusion dose of species in compartment.
Note that species
is not required to be "concrete". Here, dose should be given in
amount per time such as weight/s, mass/s, or moles/s which is converted into a
concentration per unit time by dividing by the compartment size.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
species
|
(Monomer, MonomerPattern or ComplexPattern)
|
The species to set with Initial. If a Monomer, sites are considered as unbound and in their default state. If a pattern, must be concrete. |
required |
compartment
|
Compartment
|
The compartment to which the species is added. |
required |
dose
|
Parameter or number
|
The infusion dose rate. If a Parameter is passed, it will be used directly in
the generated Rule. If a number is passed, a Parameter will be created
with an automatically generated name based on the names and site states
of the components of |
required |
Returns:
Name | Type | Description |
---|---|---|
components |
ComponentSet
|
The generated components. Contains the unidirectional elimination Rule and optionally a Parameter if kel was given as a number. |
Examples:
Linear elimination all Drug in the Central compartment::
Model()
Compartment('CENTRAL')
Monomer('Drug')
dose_infusion(Drug, Central, 100.)
Execution::
>>> Model() # doctest:+ELLIPSIS
<Model '_interactive_' ...>
>>> Monomer('Drug')
Monomer('Drug')
>>> Compartment('CENTRAL', size=30.)
Compartment(name='CENTRAL', parent=None, dimension=3, size=30.)
>>> dose_infusion(Drug, CENTRAL, 100.) # doctest:+NORMALIZE_WHITESPACE
ComponentSet([
Rule('infuse_Drug_CENTRAL', None >> Drug() ** CENTRAL, expr_Drug_CENTRAL_k0),
Parameter('dose_Drug_CENTRAL', 1.0),
Expression('expr_Drug_CENTRAL_k0', dose_Drug_CENTRAL/V_CENTRAL),
])
Source code in src\pysb\pkpd\macros.py
1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 |
|
drug_monomer(name='Drug')
Adds a new simple Monomer representing the drug to the model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
string
|
The name of the drug. Default=Drug. |
'Drug'
|
Returns:
Name | Type | Description |
---|---|---|
components |
ComponentSet
|
The generated components. Contains drug Monomer. |
Examples:
Add a drug name "chaidil"::
Model()
drug_monomer(name="chaidil")
Execution::
>>> Model() # doctest:+ELLIPSIS
<Model '_interactive_' ...>
>>> drug_monomer(name="chaidil") # doctest:+NORMALIZE_WHITESPACE
ComponentSet([
Monomer('chaidil')
])
Source code in src\pysb\pkpd\macros.py
eliminate(species, compartment, kel)
Generate a reaction for linear elimination of a species from a compartment.
Note that species
is not required to be "concrete".
Parameters:
Name | Type | Description | Default |
---|---|---|---|
species
|
(Monomer, MonomerPattern or ComplexPattern)
|
The species undergoing linear elimination. If a Monomer, sites are considered as unbound and in their default state. If a pattern, must be concrete. |
required |
compartment
|
Compartment
|
The compartment from which the species is being lost. |
required |
kel
|
Parameters or number
|
Linear elimination rate. If a Parameter is passed, it will be used directly in
the generated Rule. If a number is passed, a Parameter will be created
with an automatically generated name based on the names and site states
of the components of |
required |
Returns:
Name | Type | Description |
---|---|---|
components |
ComponentSet
|
The generated components. Contains the unidirectional elimination Rule and optionally a Parameter if kel was given as a number. |
Examples:
Linear elimination all Drug in the Central compartment::
Model()
Compartment('Central')
Monomer('Drug')
elimination(Drug, Central, 1e-4)
Execution::
>>> Model() # doctest:+ELLIPSIS
<Model '_interactive_' ...>
>>> Monomer('Drug')
Monomer('Drug')
>>> Compartment('CENTRAL', size=30.)
Compartment(name='CENTRAL', parent=None, dimension=3, size=30.)
>>> eliminate(Drug, CENTRAL, 1e-3) # doctest:+NORMALIZE_WHITESPACE
ComponentSet([
Rule('eliminate_Drug_CENTRAL', Drug() ** CENTRAL >> None, eliminate_Drug_CENTRAL_k),
Parameter('eliminate_Drug_CENTRAL_k', 0.001),
])
Source code in src\pysb\pkpd\macros.py
eliminate_mm(species, compartment, vmax, km)
Generate a reaction for Michaelis-Menten elimination of a species from a compartment.
Note that species
is not required to be "concrete".
Parameters:
Name | Type | Description | Default |
---|---|---|---|
species
|
(Monomer, MonomerPattern or ComplexPattern)
|
The species undergoing linear elimination. If a Monomer, sites are considered as unbound and in their default state. If a pattern, must be concrete. |
required |
compartment
|
Compartment
|
The compartment from which the species is being lost. |
required |
vmax
|
Parameter or number
|
The maximum velocity (or limiting rate) for the reaction. If a Parameter
is passed, it will be used directly in the generated Rule. If a number
is passed, a Parameter will be created with an automatically generated
name based on the names and site states of the components of |
required |
km
|
Parameter or number
|
The Michaelis constant for the reaction. If a Parameter
is passed, it will be used directly in the generated Rule. If a number
is passed, a Parameter will be created with an automatically generated
name based on the names and site states of the components of |
required |
Returns:
Name | Type | Description |
---|---|---|
components |
ComponentSet
|
The generated components. Contains the unidirectional elimination Rule and optionally two Parameters if vmax and km were given as numbers. |
Examples:
Non-linear elimination of Drug in the CENTRAL compartment::
Model()
Compartment('CENTRAL')
Monomer('Drug')
eliminate_mm(Drug, Central, 1., 15.)
Execution::
>>> Model() # doctest:+ELLIPSIS
<Model '_interactive_' ...>
>>> Monomer('Drug')
Monomer('Drug')
>>> Compartment('CENTRAL', size=30.)
Compartment(name='CENTRAL', parent=None, dimension=3, size=30.)
>>> eliminate_mm(Drug, CENTRAL, 1., 15.) # doctest:+NORMALIZE_WHITESPACE
ComponentSet([
Rule('eliminate_mm_Drug_CENTRAL', Drug() ** CENTRAL >> None, k_expr_Drug_CENTRAL),
Parameter('Vmax_Drug_CENTRAL', 1.0),
Parameter('Km_Drug_CENTRAL', 15.0),
Observable('_obs_expr_Drug_CENTRAL', Drug() ** CENTRAL),
Expression('k_expr_Drug_CENTRAL', Vmax_Drug_CENTRAL/(_obs_expr_Drug_CENTRAL + Km_Drug_CENTRAL)),
])
Source code in src\pysb\pkpd\macros.py
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 |
|
emax(species, compartment, emax, ec50)
Generate an expression for Emax model for effect of species in a compartment: emax * [species ** compartment] / ( [species ** compartment] + ec50 )
Note that species
is not required to be "concrete".
Parameters:
Name | Type | Description | Default |
---|---|---|---|
species
|
(Monomer, MonomerPattern or ComplexPattern)
|
The species undergoing linear elimination. If a Monomer, sites are considered as unbound and in their default state. If a pattern, must be concrete. |
required |
compartment
|
Compartment
|
The compartment for which the effect is being measured. |
required |
emax
|
Parameter or number
|
Maximum effect value. If a Parameter is passed, it will be used directly in
the generated Rule. If a number is passed, a Parameter will be created
with an automatically generated name based on the names and site states
of the components of |
required |
ec50
|
Parameter or number
|
The 50% effect concentration. If a Parameter is passed, it will be used directly in
the generated Rule. If a number is passed, a Parameter will be created
with an automatically generated name based on the names and site states
of the components of |
required |
Returns:
Name | Type | Description |
---|---|---|
components |
ComponentSet
|
The generated components. Contains the Emax expression, a corresponding observable for the species concentration, and optionally up to two Parameters if emax and ec50 were given as numbers. |
Examples:
Emax effect for Drug in the Central compartment::
Model()
Compartment('Central')
Monomer('Drug')
emax(Drug, Central, 2.4, 100.)
Execution::
>>> Model() # doctest:+ELLIPSIS
<Model '_interactive_' ...>
>>> Monomer('Drug')
Monomer('Drug')
>>> Compartment('CENTRAL', size=30.)
Compartment(name='CENTRAL', parent=None, dimension=3, size=30.)
>>> emax(Drug, Central 2.4, 100.) # doctest:+NORMALIZE_WHITESPACE
ComponentSet([
Observable('_obs_emax_expr_Drug_CENTRAL', Drug() ** CENTRAL),
Expression('Emax_expr_Drug_CENTRAL', _obs_emax_expr_Drug_CENTRAL*Emax_Drug_CENTRAL/(_obs_emax_expr_Drug_CENTRAL + EC50_Drug_CENTRAL)),
Parameter('Emax_Drug_CENTRAL', 2.4),
Parameter('EC50_Drug_CENTRAL', 100.0),
])
Source code in src\pysb\pkpd\macros.py
638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 |
|
fixed_effect(species, compartment, e_fixed, c_threshold)
Generate an expression for Fixed-effect model with species in a compartment: effect = E_fixed , [species ** compartment] > c_threshold effect = 0 , [species ** compartment] < c_threshold
Note that species
is not required to be "concrete".
Parameters:
Name | Type | Description | Default |
---|---|---|---|
species
|
(Monomer, MonomerPattern or ComplexPattern)
|
The species/drug whose effect is being measured. If a Monomer, sites are considered as unbound and in their default state. If a pattern, must be concrete. |
required |
compartment
|
Compartment
|
The compartment for which the effect is being measured. |
required |
e_fixed
|
Parameter or number
|
The fixed-effect value. If a
Parameter is passed, it will be used directly in the generated Rule.
If a number is passed, a Parameter will be created
with an automatically generated name based on the names and site states
of the components of |
required |
c_threshold
|
Parameter or number
|
The threshold concentration for the fixed-effect. If a
Parameter is passed, it will be used directly in the generated Rule.
If a number is passed, a Parameter will be created
with an automatically generated name based on the names and site states
of the components of |
required |
Returns:
Name | Type | Description |
---|---|---|
components |
ComponentSet
|
The generated components. Contains the Linear expression, a corresponding observable for the species concentration, and optionally a Parameter if slope was given as a number. |
Examples:
Fixed-effect for Drug in the Central compartment::
Model()
Compartment('Central')
Monomer('Drug')
fixed_effect(Drug, Central, 2.3, 10.0)
Execution::
>>> Model() # doctest:+ELLIPSIS
<Model '_interactive_' ...>
>>> Monomer('Drug')
Monomer('Drug')
>>> Compartment('CENTRAL', size=30.)
Compartment(name='CENTRAL', parent=None, dimension=3, size=30.)
>>> fixed_effect(Drug, CENTRAL, 2.3, 10.0) # doctest:+NORMALIZE_WHITESPACE
ComponentSet([
Observable('_obs_fixedeffect_expr_Drug_Central', Drug() ** Central),
Expression('FixedEffect_expr_Drug_Central', Piecewise((Efixed_Drug_Central, _obs_fixedeffect_expr_Drug_Central > Cthreshold_Drug_Central), (0, True))),
Parameter('Efixed_Drug_Central', 2.3),
Parameter('Cthreshold_Drug_Central', 10.0),
])
Source code in src\pysb\pkpd\macros.py
1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 |
|
linear_effect(species, compartment, slope, intercept=0.0)
Generate an expression for linear model for effect of species in a compartment: effect = slope * [species ** compartment] + intercept
Note that species
is not required to be "concrete".
Parameters:
Name | Type | Description | Default |
---|---|---|---|
species
|
(Monomer, MonomerPattern or ComplexPattern)
|
The species/drug whose effect is being measured. If a Monomer, sites are considered as unbound and in their default state. If a pattern, must be concrete. |
required |
compartment
|
Compartment
|
The compartment for which the effect is being measured. |
required |
slope
|
Parameter or number
|
The proportinality factor or slope in the linear relationship. If a
Parameter is passed, it will be used directly in the generated Rule.
If a number is passed, a Parameter will be created
with an automatically generated name based on the names and site states
of the components of |
required |
slope
|
Parameter or number
|
The y-intercept in the linear relationship. If a
Parameter is passed, it will be used directly in the generated Rule.
If a number is passed, a Parameter will be created
with an automatically generated name based on the names and site states
of the components of |
required |
Returns:
Name | Type | Description |
---|---|---|
components |
ComponentSet
|
The generated components. Contains the Linear expression, a corresponding observable for the species concentration, and optionally a Parameter if slope was given as a number. |
Examples:
Linear effect for Drug in the Central compartment::
Model()
Compartment('Central')
Monomer('Drug')
linear_effect(Drug, Central, 0.35, intercept=0.1)
Execution::
>>> Model() # doctest:+ELLIPSIS
<Model '_interactive_' ...>
>>> Monomer('Drug')
Monomer('Drug')
>>> Compartment('CENTRAL', size=30.)
Compartment(name='CENTRAL', parent=None, dimension=3, size=30.)
>>> linear_effect(Drug, CENTRAL, 0.35, intercept=0.1) # doctest:+NORMALIZE_WHITESPACE
ComponentSet([
Observable('_obs_lineffect_expr_Drug_Central', Drug() ** Central),
Expression('LinearEffect_expr_Drug_Central', _obs_lineffect_expr_Drug_Central*LinEffect_Slope_Drug_Central + LinEffect_Intercept_Drug_Central),
Parameter('LinEffect_Slope_Drug_Central', 0.35),
Parameter('LinEffect_Intercept_Drug_Central', 0.1),
])
Source code in src\pysb\pkpd\macros.py
828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 |
|
loglinear_effect(species, compartment, slope, intercept=0.0, base=None)
Generate an expression for log-linear model for effect of species in a compartment: effect = slope * log([species ** compartment]) + intercept
Note that species
is not required to be "concrete".
Parameters:
Name | Type | Description | Default |
---|---|---|---|
species
|
(Monomer, MonomerPattern or ComplexPattern)
|
The species/drug whose effect is being measured. If a Monomer, sites are considered as unbound and in their default state. If a pattern, must be concrete. |
required |
compartment
|
Compartment
|
The compartment for which the effect is being measured. |
required |
slope
|
Parameter or number
|
The proportinality factor or slope in the linear relationship. If a
Parameter is passed, it will be used directly in the generated Rule.
If a number is passed, a Parameter will be created
with an automatically generated name based on the names and site states
of the components of |
required |
slope
|
Parameter or number - Defaults to 0
|
The y-intercept in the linear relationship. If a
Parameter is passed, it will be used directly in the generated Rule.
If a number is passed, a Parameter will be created
with an automatically generated name based on the names and site states
of the components of |
required |
base
|
int, float, or None
|
The base of the logarithm. Defaults to None. If None, the log function defaults to the natural logarithm. |
None
|
Returns:
Name | Type | Description |
---|---|---|
components |
ComponentSet
|
The generated components. Contains the Linear expression, a corresponding observable for the species concentration, and optionally a Parameter if slope was given as a number. |
Examples:
Log-linear effect for Drug in the Central compartment::
Model()
Compartment('Central')
Monomer('Drug')
loglinear_effect(Drug, Central, 0.35, intercept=0.1)
Execution::
>>> Model() # doctest:+ELLIPSIS
<Model '_interactive_' ...>
>>> Monomer('Drug')
Monomer('Drug')
>>> Compartment('CENTRAL', size=30.)
Compartment(name='CENTRAL', parent=None, dimension=3, size=30.)
>>> loglinear_effect(Drug, CENTRAL, 0.35, intercept=0.1) # doctest:+NORMALIZE_WHITESPACE
ComponentSet([
Observable('_obs_loglinearffect_expr_Drug_Central', Drug() ** Central),
Expression('LogLinearEffect_expr_Drug_Central', LogLinEffect_Intercept_Drug_Central + LogLinEffect_Slope_Drug_Central*log(_obs_loglinearffect_expr_Drug_Central)),
Parameter('LogLinEffect_Slope_Drug_Central', 0.35),
Parameter('LogLinEffect_Intercept_Drug_Central', 0.1),
])
Source code in src\pysb\pkpd\macros.py
919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 |
|
one_compartment(c1_name='CENTRAL', c1_size=1.0)
Generate a compartment for a one-compartment model, or to add an additional compartment to a multi-compartment model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
c1_name
|
string
|
The name of the compartment. If a number is passed a Parameter will be created and given as the size for Compartment. Default=CENTRAL. |
'CENTRAL'
|
c1_size
|
Parameter or number
|
The volume of the compartment. If a number is passed a Parameter will be created and given as the size for the Compartment. Default=1.0 |
1.0
|
Returns:
Name | Type | Description |
---|---|---|
components |
ComponentSet
|
The generated components. Contains the compartment and optionally a Parameter if c1_size was given as a number. |
Examples:
Define a central compartment for a one-compartment model::
Model()
one_comapartment()
Execution::
>>> Model() # doctest:+ELLIPSIS
<Model '_interactive_' ...>
>>> one_compartment() # doctest:+NORMALIZE_WHITESPACE
ComponentSet([
Compartment(name='CENTRAL', parent=None, dimension=3, size=V_CENTRAL),
Parameter('V_CENTRAL', 1.0),
])
Source code in src\pysb\pkpd\macros.py
sigmoidal_emax(species, compartment, emax, ec50, n)
Generate an expression for sigmoidal Emax model for effect of species in a compartment: emax * [species ** compartment] ** n / ( [species ** compartment] ** n + ec50 ** n)
Note that species
is not required to be "concrete".
Parameters:
Name | Type | Description | Default |
---|---|---|---|
species
|
(Monomer, MonomerPattern or ComplexPattern)
|
The species undergoing linear elimination. If a Monomer, sites are considered as unbound and in their default state. If a pattern, must be concrete. |
required |
compartment
|
Compartment
|
The compartment for which the effect is being measured. |
required |
emax
|
Parameter or number
|
Maximum effect value. If a Parameter is passed, it will be used directly in
the generated Rule. If a number is passed, a Parameter will be created
with an automatically generated name based on the names and site states
of the components of |
required |
ec50
|
Parameter or number
|
The 50% effect concentration. If a Parameter is passed, it will be used directly in
the generated Rule. If a number is passed, a Parameter will be created
with an automatically generated name based on the names and site states
of the components of |
required |
n
|
Parameter or number
|
The Hill coefficient. If a Parameter is passed, it will be used directly in
the generated Rule. If a number is passed, a Parameter will be created
with an automatically generated name based on the names and site states
of the components of |
required |
Returns:
Name | Type | Description |
---|---|---|
components |
ComponentSet
|
The generated components. Contains the Emax expression, a corresponding observable for the species concentration, and optionally up to three Parameters if emax, ec50, and n were given as numbers. |
Examples:
Emax effect for Drug in the Central compartment::
Model()
Compartment('Peripheral')
Monomer('Drug')
sigmoidal_emax(Drug, Peripheral, 4.4, 50.)
Execution::
>>> Model() # doctest:+ELLIPSIS
<Model '_interactive_' ...>
>>> Monomer('Drug')
Monomer('Drug')
>>> Compartment('CENTRAL', size=30.)
Compartment(name='CENTRAL', parent=None, dimension=3, size=30.)
>>> emax(Drug, Central 2.4, 100.) # doctest:+NORMALIZE_WHITESPACE
ComponentSet([
Observable('_obs_emax_expr_Drug_PERIPHERAL', Drug() ** PERIPHERAL),
Expression('Emax_expr_Drug_PERIPHERAL', _obs_emax_expr_Drug_PERIPHERAL**n_Drug_PERIPHERAL*Emax_Drug_PERIPHERAL/(_obs_emax_expr_Drug_PERIPHERAL**n_Drug_PERIPHERAL + EC50_Drug_PERIPHERAL**n_Drug_PERIPHERAL)),
Parameter('Emax_Drug_PERIPHERAL', 4.4),
Parameter('EC50_Drug_PERIPHERAL', 50.0),
Parameter('n_Drug_PERIPHERAL', 1.7),
])
Source code in src\pysb\pkpd\macros.py
728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 |
|
three_compartments(c1_name='CENTRAL', c1_size=1.0, c2_name='PERIPHERAL', c2_size=1.0, c3_name='DEEPPERIPHERAL', c3_size=1.0)
Generate compartments for a three-compartment model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
c1_name
|
string
|
The name of compartment 1. Default=CENTRAL. |
'CENTRAL'
|
c1_size
|
Parameter or number
|
The volume of compartment 1. If a number is passed a Parameter will be created and given as the size for Compartment 1. Default=1.0 |
1.0
|
c2_name
|
string
|
The name of compartment 2. If a number is passed a Parameter will be created and given as the size for Compartment 2. Default=PERIPHERAL. |
'PERIPHERAL'
|
c2_size
|
Parameter or number
|
The volume of compartment 2. Default=1.0 |
1.0
|
c3_name
|
string
|
The name of compartment 2. If a number is passed a Parameter will be created and given as the size for Compartment 3. Default=DEEPPERIPHERAL. |
'DEEPPERIPHERAL'
|
c3_size
|
Parameter or number
|
The volume of compartment 3. Default=1.0 |
1.0
|
Returns:
Name | Type | Description |
---|---|---|
components |
ComponentSet
|
The generated components. Contains the three compartments and optionally three Parameters if c1_size, c2_size and c3_size were given as numbers. |
Examples:
Use the default compartments:
Model()
three_comapartments()
Execution::
>>> Model() # doctest:+ELLIPSIS
<Model '_interactive_' ...>
>>> two_compartments() # doctest:+NORMALIZE_WHITESPACE
ComponentSet([
Compartment(name='CENTRAL', parent=None, dimension=3, size=V_CENTRAL),
Compartment(name='PERIPHERAL', parent=None, dimension=3, size=V_PERIPHERAL),
Compartment(name='DEEPPERIPHERAL', parent=None, dimension=3, size=V_DEEPPERIPHERAL),
Parameter('V_CENTRAL', 1.0),
Parameter('V_PERIPHERAL', 1.0),
Parameter('V_DEEPPERIPHERAL', 1.0),
])
Source code in src\pysb\pkpd\macros.py
transfer(species, c1, c2, k)
Generate a unimolecular irreversible reaction to transfer a species from one compartment to another: species ** c1 --> species ** c2.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
species
|
Monomer or MonomerPattern
|
|
required |
c1
|
Compartment
|
|
required |
c2
|
Compartment
|
|
required |
k
|
Parameter or number
|
|
required |
Returns:
Name | Type | Description |
---|---|---|
components |
ComponentSet
|
The generated components. Contains one reversible Rule and optionally two Parameters if klist was given as plain numbers. |
Examples:
Transfer drug irreveribly from the Central to Peripheral compartment::
Model()
Monomer('Drug')
Compartment("CENTRAL")
Compartment("PERIPHERAL")
transfer(Drug, CENTRAL, PERIPHERAL, 1.)
Execution::
>>> Model() # doctest:+ELLIPSIS
<Model '_interactive_' ...>
>>> Monomer('Drug')
Monomer('Drug')
>>> Compartment("CENTRAL")
Compartment(name='CENTRAL', parent=None, dimension=3, size=1.),
>>> Compartment("PERIPERAL")
Compartment(name='PERIPHERAL', parent=None, dimension=3, size=1.),
>>> transfer(Drug, CENTRAL, PERIPHERAL, 1.) # doctest:+NORMALIZE_WHITESPACE
ComponentSet([
Rule('transfer_Drug_CENTRAL_to_PERIPHERAL', Drug() ** CENTRAL >> Drug() ** PERIPHERAL, transfer_Drug_CENTRAL_to_PERIPHERAL_k),
Parameter('transfer_Drug_CENTRAL_to_PERIPHERAL_k', 1.0),
])
Source code in src\pysb\pkpd\macros.py
two_compartments(c1_name='CENTRAL', c1_size=1.0, c2_name='PERIPHERAL', c2_size=1.0)
Generate compartments for a two-compartment model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
c1_name
|
string
|
The name of compartment 1. If a number is passed a Parameter will be created and given as the size for Compartment 1. Default=CENTRAL. |
'CENTRAL'
|
c1_size
|
Parameter or number
|
The volume of compartment 1. If a number is passed a Parameter will be created and given as the size for Compartment 1. Default=1.0 |
1.0
|
c2_name
|
string
|
The name of compartment 2. Default=PERIPHERAL. |
'PERIPHERAL'
|
c2_size
|
Parameter or number
|
The volume of compartment 2. If a number is passed a Parameter will be created and given as the size for Compartment 2. Default=1.0 |
1.0
|
Returns:
Name | Type | Description |
---|---|---|
components |
ComponentSet
|
The generated components. Contains the two compartments and optionally two Parameters if c1_size and c2_size were given as numbers. |
Examples:
Use the default compartment names but adjust the size::
Model()
two_comapartments(c1_size=30., c2_size=20.)
Execution::
>>> Model() # doctest:+ELLIPSIS
<Model '_interactive_' ...>
>>> two_compartments() # doctest:+NORMALIZE_WHITESPACE
ComponentSet([
Compartment(name='CENTRAL', parent=None, dimension=3, size=V_CENTRAL),
Compartment(name='PERIPHERAL', parent=None, dimension=3, size=V_PERIPHERAL),
Parameter('V_CENTRAL', 1.0),
Parameter('V_PERIPHERAL', 1.0),
])
Source code in src\pysb\pkpd\macros.py
pkpd.standard
one_compartment_model(dose_amount, dose_route='iv-bolus', dose_parameters=None, volume_distribution=1.0, clearance=0.5, pd_model=None)
Generates a standard one-compartment PK/PD model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dose_amount
|
float
|
The amount of drug in the dose. |
required |
dose_route
|
str
|
The route of drug adminstration. Default="iv-bolus". Options: 'iv-bolus', 'iv-infusion', 'oral'. |
'iv-bolus'
|
dose_parameters
|
dict | None
|
Additional special dose/route parameters. Only required for the 'oral' route with parameters: 'ka' - 1st-order absorption rate constant. 'f' - bioavailibity fraction. |
None
|
volume_distribution
|
float
|
Volume of distribution; i.e., the volume of the central compartment. Default=1.. |
1.0
|
clearance
|
float
|
Clearance rate of the drug (volume/time). Default=0.5. |
0.5
|
pd_model
|
dict | None
|
Set the PD model and its paramters. Default=None. Options: 'emax' - parameters: 'emax', 'ec50' 'sigmoidal-emax' - parameters: 'emax', 'ec50', 'n' 'linear' - parameters: 'slope', 'intercept' 'log-linear' - parameters: 'slope', 'intercept' 'fixed' - parameters: 'e_fixed', 'c_threshold' |
None
|
Returns:
Name | Type | Description |
---|---|---|
model |
Model
|
The generated model. |
Examples:
Oral administration with Emax PD::
model = one_compartment_model(
100.0, # mg
dose_route="oral",
dose_parameters={
'ka': 1e-1, # min^-1
'f': 0.95,
},
volume_distribution=10.0, # L
clearance=0.750, # L/min
pd_model={
"emax": {
"emax": 2.2,
"ec50": 50.0, # mg
}
},
)
I.V. infusion administration with linear PD::
model = one_compartment_model(
100.0, # mg
dose_route="iv-infusion",
volume_distribution=10.0, # L
clearance=0.750, # L/min
pd_model={
"linear": {
"slope": 0.2, # mg^-1
"intercept": 1.2,
}
},
)
Source code in src\pysb\pkpd\standard.py
three_compartment_model(dose_amount, dose_route='iv-bolus', dose_parameters=None, volume_central=1.0, volume_peripheral=1.0, volume_deep_peripheral=1.0, k12=0.1, k21=0.01, k13=0.001, k31=0.0001, clearance=0.5, pd_model=None)
Generates a standard three-compartment PK/PD model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dose_amount
|
float
|
The amount of drug in the dose. |
required |
dose_route
|
str
|
The route of drug adminstration. Default="iv-bolus". Options: 'iv-bolus', 'iv-infusion', 'oral'. |
'iv-bolus'
|
dose_parameters
|
dict | None
|
Additional special dose/route parameters. Only required for the 'oral' route with parameters: 'ka' - 1st-order absorption rate constant. 'f' - bioavailibity fraction. |
None
|
volume_central
|
float
|
Volume of the central compartment. Default=1.. |
1.0
|
volume_peripheral
|
float
|
Volume of the peripheral compartment. Default=1.. |
1.0
|
k12
|
float
|
The rate constant for distribution from the cental to peripheral compartment. Default=0.1. |
0.1
|
k21
|
float
|
The rate constant for redistribution from the peripheral to central compartment. Default=0.01. |
0.01
|
k13
|
float
|
The rate constant for distribution from the cental to deep peripheral compartment. Default=0.001. |
0.001
|
k31
|
float
|
The rate constant for redistribution from the deep peripheral to central compartment. Default=0.0001. |
0.0001
|
clearance
|
float
|
Clearance rate of the drug (volume/time). Default=0.5. |
0.5
|
pd_model
|
dict | None
|
Set the PD model and its paramters. Default=None. Options: 'emax' - parameters: 'emax', 'ec50' 'sigmoidal-emax' - parameters: 'emax', 'ec50', 'n' 'linear' - parameters: 'slope', 'intercept' 'log-linear' - parameters: 'slope', 'intercept' 'fixed' - parameters: 'e_fixed', 'c_threshold' |
None
|
Returns:
Name | Type | Description |
---|---|---|
model |
Model
|
The generated model. |
Examples:
Oral administration with Emax PD::
model = three_compartment_model(
100.0, # mg
dose_route="oral",
dose_parameters={
'ka': 1e-1, # min^-1
'f': 0.95,
},
volume_central=10.0, # L
volume_peripheral=2.0, # L
k12=1e-2, # min^-1
k21=1e-4, # min^-1
k13=1e-3, # min^-1
k31=1e-5, # min^-1
clearance=0.750, # L/min
pd_model={
"emax": {
"emax": 2.2,
"ec50": 50.0, # mg
}
},
)
I.V. infusion administration with linear PD::
model = three_compartment_model(
100.0, # mg
dose_route="iv-infusion",
volume_central=10.0, # L
volume_peripheral=2.0, # L
k12=1e-2, # min^-1
k21=1e-4, # min^-1
k13=1e-3, # min^-1
k31=1e-5, # min^-1
clearance=0.750, # L/min
pd_model={
"linear": {
"slope": 0.2, # mg^-1
"intercept": 1.2,
}
},
)
Source code in src\pysb\pkpd\standard.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 |
|
two_compartment_model(dose_amount, dose_route='iv-bolus', dose_parameters=None, volume_central=1.0, volume_peripheral=1.0, k12=0.1, k21=0.01, clearance=0.5, pd_model=None)
Generates a standard two-compartment PK/PD model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dose_amount
|
float
|
The amount of drug in the dose. |
required |
dose_route
|
str
|
The route of drug adminstration. Default="iv-bolus". Options: 'iv-bolus', 'iv-infusion', 'oral'. |
'iv-bolus'
|
dose_parameters
|
dict | None
|
Additional special dose/route parameters. Only required for the 'oral' route with parameters: 'ka' - 1st-order absorption rate constant. 'f' - bioavailibity fraction. |
None
|
volume_central
|
float
|
Volume of the central compartment. Default=1.. |
1.0
|
volume_peripheral
|
float
|
Volume of the peripheral compartment. Default=1.. |
1.0
|
k12
|
float, optional)
|
The rate constant for distribution from the cental to peripheral compartment. Default=0.1. |
0.1
|
k21
|
float
|
The rate constant for redistribution from the peripheral to central compartment. Default=0.01. |
0.01
|
clearance
|
float
|
Clearance rate of the drug (volume/time). Default=0.5. |
0.5
|
pd_model
|
dict | None
|
Set the PD model and its paramters. Default=None. Options: 'emax' - parameters: 'emax', 'ec50' 'sigmoidal-emax' - parameters: 'emax', 'ec50', 'n' 'linear' - parameters: 'slope', 'intercept' 'log-linear' - parameters: 'slope', 'intercept' 'fixed' - parameters: 'e_fixed', 'c_threshold' |
None
|
Returns:
Name | Type | Description |
---|---|---|
model |
Model
|
The generated model. |
Examples:
Oral administration with Emax PD::
model = two_compartment_model(
100.0, # mg
dose_route="oral",
dose_parameters={
'ka': 1e-1, # min^-1
'f': 0.95,
},
volume_central=10.0, # L
volume_peripheral=2.0, # L
k12=1e-2, # min^-1
k21=1e-4, # min^-1
clearance=0.750, # L/min
pd_model={
"emax": {
"emax": 2.2,
"ec50": 50.0, # mg
}
},
)
I.V. infusion administration with linear PD::
model = two_compartment_model(
100.0, # mg
dose_route="iv-infusion",
volume_central=10.0, # L
volume_peripheral=2.0, # L
k12=1e-2, # min^-1
k21=1e-4, # min^-1
clearance=0.750, # L/min
pd_model={
"linear": {
"slope": 0.2, # mg^-1
"intercept": 1.2,
}
},
)
Source code in src\pysb\pkpd\standard.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
|
pkpd.util
simulate(model, tspan, param_values=None, initials=None, nprocs=1)
Simulate the given model using the ScipyOdeSimulator.
This function abstracts setting up and running a simulation of the model using the ScipyOdeSimulator with the lsoda integrator. It returns the corresponding model trajectory.
Args: model: The input PySB model to simulate. tspan: The time span to simulate the model over. param_values: Optional specification of parameters to use when simulating the model. If None, the nominal/default model parameters will be used. The input can be None, a single parameter vector, or a list of parameter vectors that will each be simulated. initials: Optional specification of initial concentrations to use when simulating the model. If None, the nominal/default model values will be used. The input can be None, a single vector, or a list of vectors that will each be simulated.
Returns: The PySB model simulation trajectory as a structured NumPy array.