Skip to content

pbpk physiology

The physiology of the PBPK library: the reference physiology and its scaling, the physiology over age, the differences of the sexes, the populations and the virtual populations, the impairment, the observers and the sinks, see Physiology, Virtual populations, Impairment and Observers.

physiology

The standard human physiology and its scaling to an individual.

The physiology is a set of SBML parameters of the top model. The covariates of the individual (BW, HEIGHT, AGE) and the factors of organ function are constant parameters which an experiment changes before the simulation, as it changes BW today; everything else follows from them by initial assignments on constant parameters, which sbmlsim evaluates again after the changes of an experiment (a value which no rule recomputes during the integration keeps the compiled model small and fast to load):

  • the reference values of the sex of the build (ICRP 89, database/tables/physiology_human.toml) and of the age: the reference values are curves of AGE (pkpdsim.pbpk.age, the reference children of ICRP 89 and the aging of the adults, 1 at 35 years); the sex is chosen when the model is built, a study of both sexes uses one model per sex;
  • the default individual (BW, HEIGHT, AGE) is the reference individual of the sex of the population of the build (pkpdsim.pbpk.populations, ICRP 89 by default); the reference anatomy stays ICRP 89 for every population, the organs of another population's individual follow from the scaling;
  • body mass index, body surface area (Du Bois 1916) and fat-free mass (Janmahasatian 2005);
  • the tissues scale as in Huisinga 2012 (eqs. 9, 10, 12): brain is constant, skin scales with the body surface area, the other lean organs and the blood with the fat-free mass less brain and skin (SV_tis); adipose is the remainder of the body weight;
  • the cardiac output scales as the tissues, SV_tis (Huisinga 2012 eq. 13), and the organ flows are fractions of it, renormalised over the organs so that they sum to the cardiac output;
  • the GFR scales with the body surface area and matures and declines with the age (fage_GFR); the hematocrit, the fat-free mass and the flow fractions carry their factors of the age (fage_<id>).

An organ volume is the volume of its tissue and its blood, M<o>/density + blood*Vblood; the body weight is the mass of the tissues without blood and of the blood, sum(M<o>) + Vblood*rho_blood. The vascular fraction of an organ volume is its blood, blood*Vblood/V<o>, so that the vascular spaces of the organs and the pools are the blood volume for every individual; the interstitial fraction is the interstitial fraction of the tissue without blood (Schmitt 2008) times the tissue share 1 - f_vas.

A covariate or a factor of organ function is an initial value: changed before the simulation (a change of an experiment, init(...) in roadrunner), every quantity which depends on it follows; changed during a simulation, nothing follows (unless the definition names it dynamic, see pkpdsim.pbpk.builder).

The impaired organ function (pkpdsim.pbpk.impairment) multiplies cardiac output, the blood flows, the GFR, the hematocrit and the kidney mass by its factors (factors of physiology_objects); without them the physiology is the healthy one.

ADULT_AGE module-attribute

ADULT_AGE = 20.0

The age (years) at which the growth ends: the reference values of the children reach the adult of ICRP 89 at this age (ICRP 89 Section 1.4.2 para 14: adults are 20 to 50 years).

AGE_REFERENCE module-attribute

AGE_REFERENCE = 35.0

The age (years) of the adult reference values of ICRP 89 (Section 1.4.2 para 14: "an average age of 35 years is used"), the default age of the individual and the age at which every factor of age is 1.

LEAN_ORGANS module-attribute

LEAN_ORGANS = tuple(
    o for o in Organ if o is not Organ.ADIPOSE
)

The organs whose tissue mass scales with the individual; adipose is the rest.

DEFAULT_POPULATION module-attribute

DEFAULT_POPULATION = 'european_icrp'

The population of a model which does not choose one (pkpdsim.pbpk.populations).

MODEL_DEFAULT module-attribute

MODEL_DEFAULT = 'Model default without a source.'

The notes of a parameter whose value is a choice of the model, not data.

LIVER_DEFAULTS module-attribute

LIVER_DEFAULTS = {ids.F_SHUNT: 0.0, ids.F_FUNCTIONAL: 1.0}

The healthy liver: no portosystemic shunt, all tissue functional. The values at runtime are those of the hepatic impairment (pkpdsim.impairment), which sets them as an experiment sets a covariate.

Sex

Bases: StrEnum

The sex of a model build, the sex of its reference individual.

ReferenceIndividual dataclass

ReferenceIndividual(
    sex,
    bw,
    height,
    gfr,
    volumes,
    tissue_volumes,
    intracellular_volumes,
    lumen_volumes,
)

The reference individual of a sex (ICRP 89, database/tables/physiology_human.toml).

The individual whose anatomy the physiology scales, the default individual of the populations of ICRP 89: a model which states a value of the hand-written models per litre of an organ or per kg of body weight converts it with these numbers instead of copies of them.

Attributes:

Name Type Description
sex Sex

the sex.

bw float

the body weight [kg], BW of the default individual.

height float

the height [cm], HEIGHT of the default individual.

gfr float

the healthy GFR [l/min], the GFR at renal function 1 of the default individual (GFR_base, the reference GFR GFR_ref of the sex at its own body surface area), which healthy_gfr of the build of the sex gives in ml/min; the GFR of a component which a model keeps outside the library (the fluid model of hctz) reads it instead of a copy.

volumes Mapping[Organ, float]

the organ volumes with their blood V<o> [l], M<o>/density + blood*Vblood as in the model.

tissue_volumes Mapping[Organ, float]

the tissue volumes without blood [l] (reference_tissue_volumes).

intracellular_volumes Mapping[Organ, float]

the volumes of the cells of the organs [l], V<o>*(1 - f_vas_<o> - f_int_<o>) as in the model (the tissue volume without its interstitial fraction), the intracellular space Vic of the full form (the hepatocytes of the liver, 1.3859 l of a man).

lumen_volumes Mapping[str, float]

the fluid volumes of the lumen segments of the segmented intestine by their token (ids.GUT_SEGMENTS) [l], Vlumen_<seg>, the same for both sexes (the small intestine du to ile2 0.105 l).

BodyComposition dataclass

BodyComposition(
    sex,
    bw,
    height,
    age,
    bmi,
    bsa,
    ffm,
    fm,
    sv_tis,
    lean,
    blood,
    adipose,
)

The body composition of an individual of the scaling of the library.

The quantities the build computes from the covariates (Huisinga 2012 with the fat-free mass of Janmahasatian 2005), as numbers: a table of the documentation, a test and an experiment read them instead of restating the equations.

Attributes:

Name Type Description
sex Sex

the sex of the build.

bw float

the body weight [kg].

height float

the height [cm].

age float

the age [years].

bmi float

the body mass index [kg/m2].

bsa float

the body surface area [m2], Du Bois.

ffm float

the fat-free mass [kg], FFM.

fm float

the body fat mass [kg], FM = BW - FFM.

sv_tis float

the scaling factor of the lean tissues, SV_tis.

lean float

the mass of the lean organ tissues [kg], Mlean.

blood float

the blood volume [l], Vblood.

adipose float

the mass of the adipose tissue compartment [kg], Mad, the remainder of the body weight.

physiology_table

physiology_table(species)

The table of the reference physiology of a species, physiology_rat.

physiology_objects

physiology_objects(
    sex=MALE,
    factors=None,
    population=DEFAULT_POPULATION,
    species=HUMAN,
    over_age=False,
)

The parameters and initial assignments of the standard physiology.

Parameters:

Name Type Description Default
sex Sex

the sex of the model: its reference values and the default individual (BW, HEIGHT). A study of both sexes uses one model per sex.

MALE
factors Mapping[str, str] | None

the factors of the impaired organ function by the id of the quantity they multiply (pkpdsim.pbpk.impairment.physiology_factors): the formula of the quantity is multiplied by the factor (a formula); the hematocrit becomes HCT = HCT_ref * factor. None: the healthy physiology.

None
population str

the population (pkpdsim.pbpk.populations) whose reference individual of the sex is the default individual (BW, HEIGHT, AGE); the reference anatomy stays ICRP 89.

DEFAULT_POPULATION
species Species

the species: the human of ICRP 89 or a laboratory animal (_AnimalPhysiology, the reference animal of database/tables/physiology_<species>.toml scaled with the body weight; the default population only).

HUMAN
over_age bool

the physiology is a function of the age AGE (PBPKDefinition.age): the reference values and the factors are the curves of pkpdsim.pbpk.age. Without it (the default) they are the constants of the reference individual of AGE_REFERENCE and the model has no AGE.

False

Returns:

Type Description
list[Sbase]

The constant parameters and their initial assignments of the top model.

Raises:

Type Description
ValueError

if the reference individual leaves no mass for adipose, a unit of the data is not the unit of the model, a factor names no quantity of the physiology with an initial assignment, or the population is unknown.

reference_fractions

reference_fractions(organ, species=HUMAN)

The vascular and interstitial fraction of an organ volume of the reference individuals.

Parameters:

Name Type Description Default
organ Organ

the organ.

required
species Species

the species.

HUMAN

Returns:

Type Description
dict[Sex, tuple[float, float]]

(f_vas, f_int) of physiology_<species>.toml by sex, the sexes of

dict[Sex, tuple[float, float]]

the table.

normal_gfr

normal_gfr(sex, age=AGE_REFERENCE)

The GFR per 1.73 m2 body surface area of a healthy individual.

Parameters:

Name Type Description Default
sex Sex

the sex of the individual.

required
age float

the age (years); the GFR per 1.73 m2 matures in the children and declines in the adults (fage_GFR), 35 years the adult of ICRP 89.

AGE_REFERENCE

Returns:

Type Description
float

The reference GFR scaled to 1.73 m2 with the reference body surface

float

area (l/min) times the factor of the age, the GFR of the normal renal

float

function of the age.

reference_tissue_volumes

reference_tissue_volumes(
    sex, age=AGE_REFERENCE, species=HUMAN
)

The tissue volumes of the organs of a reference individual.

The tissue volume of an organ is its volume without its blood, V<o>*(1 - f_vas_<o>) = M<o>/density; adipose is the remainder of the body weight, as in the model.

Parameters:

Name Type Description Default
sex Sex

the sex of the reference individual.

required
age float

the age of the reference individual (years), of a human.

AGE_REFERENCE
species Species

the species; a laboratory animal is its reference animal (no age).

HUMAN

Returns:

Type Description
dict[Organ, float]

The tissue volume (l) by organ.

scaled_cardiac_output

scaled_cardiac_output(sex, bw, height, age=AGE_REFERENCE)

The cardiac output of the scaling of a build before the factor of the sex.

CO_ref*SV_tis (Huisinga 2012 eq. 13) of an individual without impairment: the reference cardiac output of the sex and the age times the fat-free mass less brain and skin relative to the reference individual of the age, as the model computes CO_base without fsex_CO.

Parameters:

Name Type Description Default
sex Sex

the sex of the build.

required
bw float

the body weight (kg).

required
height float

the height (cm).

required
age float

the age (years).

AGE_REFERENCE

Returns:

Type Description
float

The cardiac output (l/min).

reference_hematocrit

reference_hematocrit(sex, age=AGE_REFERENCE, species=HUMAN)

The hematocrit of a reference individual.

Parameters:

Name Type Description Default
sex Sex

the sex of the reference individual.

required
age float

the age of the reference individual (years), of a human.

AGE_REFERENCE
species Species

the species; a laboratory animal has no factor of the age.

HUMAN

Returns:

Type Description
float

The hematocrit of physiology_<species>.toml, of the human times the

float

factor of the age.

reference_liver_flow

reference_liver_flow(species, sex=MALE)

The total blood flow of the liver of the reference individual (l/min).

QH = QHA + QPO of the model: the flow fractions of the liver and of the PORTAL_ORGANS, renormalised over the organs in parallel as the model does, times the reference cardiac output.

Parameters:

Name Type Description Default
species Species

the species.

required
sex Sex

the sex of the reference individual.

MALE

Returns:

Type Description
float

The flow, at the reference body weight and without impairment.

reference_flow

reference_flow(species)

Get the reference blood flow through the whole liver of a species (l/min).

The total liver flow QH = QHA + QPO of the library for its reference individual (reference_liver_flow): the flow fractions of the liver and of the portal organs, renormalised over the organs in parallel as the library does, times the cardiac output. The value with its provenance, which the zonation engine takes as its reference flow (ZonationSettings.reference_flow): the engine follows the renormalised library fractions, so the zonated liver carries the flow of the PBPK liver it stands in for.

The value is an aggregate of rows of physiology_<species>.toml, so its source is the source of those rows (_liver_flow_sources): their one key where they agree on it, with the derivation in the notes as a derived row of the tables has it, and ModelChoice where they differ, with every key the aggregate rests on in the notes. The source of a Value is a key of database/sources.toml, which cite() resolves, so a model which writes this flow as a parameter carries the citation of the physiology the flow comes from (tests/pbpk/test_physiology.py resolves it for every species).

Parameters:

Name Type Description Default
species Species

the species.

required

Returns:

Type Description
Value

The flow in l/min.

reference_individual cached

reference_individual(sex, age=AGE_REFERENCE)

The reference individual of a sex and an age.

Parameters:

Name Type Description Default
sex Sex

the sex of the reference individual.

required
age float

the age (years), the adult of ICRP 89 by default; a child is the interpolation of the reference children of ICRP 89, an older adult the adult with the factors of the age (pkpdsim.pbpk.age).

AGE_REFERENCE

Returns:

Type Description
ReferenceIndividual

Its body weight, height, healthy GFR, organ, cell and lumen volumes.

body_composition

body_composition(sex, bw, height, age=AGE_REFERENCE)

The body composition of a human individual of the scaling of the library.

Parameters:

Name Type Description Default
sex Sex

the sex of the build.

required
bw float

the body weight (kg).

required
height float

the height (cm).

required
age float

the age (years).

AGE_REFERENCE

Returns:

Type Description
BodyComposition

The composition, the quantities the build computes from BW and

BodyComposition

HEIGHT (pkpdsim.pbpk.adipose exposes them in the model as FM,

BodyComposition

BFF, FMI, LBW, VAT and SAT).

age

The physiology over age: growth, maturation and aging of a sex.

The reference values and the factors of the physiology are curves of the covariate AGE (pkpdsim.pbpk.curves), written once and evaluated as a number (Curve.value, the reference individual of an age, the tables of the documentation, the virtual individuals) and as the formula of an initial assignment of the model (Curve.formula). An individual of any age from birth to 100 years follows from the scaling of the physiology to its body weight and height (Huisinga 2012) relative to the reference individual of its age and sex:

  • growth (reference_curves): the reference children of ICRP 89 at birth and 1, 5, 10 and 15 years (database/tables/children_human.toml) and the adult of ICRP 89 (physiology_human.toml) at ADULT_AGE, interpolated linearly in age: the reference body weight and height, the tissue masses of the lean organs, the blood volume and the cardiac output; Huisinga 2012 take the reference individual of the age class, the interpolation between the classes is a choice of the library;
  • aging of the adults: the adult reference value times an aging factor of the age (database/tables/age_human.toml) at a fixed body size, 1 at AGE_REFERENCE (35 years, the adult of ICRP 89), so the default individual of ICRP 89 keeps its values: the liver and the kidney mass, the cardiac output;
  • the factors of the functions (factor_curves), 1 at 35 years: the GFR (maturation of Rhodin 2009 and aging), the hematocrit (neonates and NHANES), the albumin and the alpha-1-acid glycoprotein of the binding, the fat-free mass of the children (Al-Sallami 2015) and the blood flows (the brain of the children, the liver and the kidney of the elderly, flow_factors);
  • the ontogeny of the enzymes and transporters (protein_factor, database/tables/ontogeny.toml).

The differences of the sexes beyond the reference anatomy of each sex are pkpdsim.pbpk.sex_differences.

The age enters the formulas as AGE in years; every curve is constant beyond the ages of its data.

ADULT_AGE module-attribute

ADULT_AGE = 20.0

The age (years) at which the growth ends: the reference values of the children reach the adult of ICRP 89 at this age (ICRP 89 Section 1.4.2 para 14: adults are 20 to 50 years).

AGE_REFERENCE module-attribute

AGE_REFERENCE = 35.0

The age (years) of the adult reference values of ICRP 89 (Section 1.4.2 para 14: "an average age of 35 years is used"), the default age of the individual and the age at which every factor of age is 1.

CHILDREN module-attribute

CHILDREN = 'children_human'

The table of the reference children in the database.

AGE module-attribute

AGE = 'age_human'

The table of the maturation and the aging in the database.

ONTOGENY module-attribute

ONTOGENY = 'ontogeny'

The table of the ontogeny of the proteins in the database.

LIVER_GROUP module-attribute

LIVER_GROUP = (Organ.LIVER, *sorted(PORTAL_ORGANS))

The organs whose flows follow the hepatic blood flow: the hepatic artery and the portal organs.

AgeCurve dataclass

AgeCurve(curve, sources, notes)

A quantity over age with its provenance.

Attributes:

Name Type Description
curve Curve

the value over age, in the unit of the quantity or dimensionless for a factor.

sources tuple[str, ...]

the keys of the sources.

notes str

where the values come from.

FlowFactors dataclass

FlowFactors(brain, liver, kidney, sources, notes)

The factors of the age on the fractions of the cardiac output of a sex.

The flow fractions of the adults of ICRP 89 (fQ<o>) are multiplied by a factor of the age, so that they sum to 1 at every age:

  • the brain by brain, its flow per mass of the age (Chiron 1992) times its mass over the cardiac output, both relative to 35 years (the children's brain takes up to half of the cardiac output);
  • every other organ shares the rest in the proportions of the adults, rest = (1 - fQbr*brain)/(1 - fQbr);
  • of these, the liver and the portal organs by liver (the hepatic flow of the elderly follows the liver volume) and the kidney by kidney (the renal plasma flow over the cardiac output of the elderly);
  • the remaining organs by other, which closes the sum: (1 - fQbr - sum fQ_s*h_s)/(1 - fQbr - sum fQ_s) over the liver group and the kidney.

Attributes:

Name Type Description
brain Curve

the factor of the brain.

liver Curve

the factor of the liver group (before rest).

kidney Curve

the factor of the kidney (before rest).

sources tuple[str, ...]

the keys of the sources.

notes str

where the factors come from.

age_factor

age_factor(pid)

The id of the factor of the age on a quantity, fage_GFR, fage_li_cyp3a4.

entry_curve

entry_curve(entry)

The curve of an entry of age_human.toml, ontogeny.toml or sex_human.toml.

Parameters:

Name Type Description Default
entry Mapping[str, Any]

the entry with its form (points, hill, log or constant) and the numbers of the form.

required

Returns:

Type Description
Curve

The curve over age.

Raises:

Type Description
ValueError

for an unknown form or variable.

provenance

provenance(*entries)

The sources and the notes of entries of the database.

Parameters:

Name Type Description Default
entries Mapping[str, Any]

entries with a source, optional further sources and notes.

()

Returns:

Type Description
tuple[str, ...]

The keys of the sources, each once in their order, and the notes

str

joined.

reference_curves cached

reference_curves(sex)

The reference values over age of a sex, by the id of their parameter.

The reference body weight and height (BW_ref, HEIGHT_ref), the tissue masses of the lean organs (M<o>_ref), the blood volume (Vblood_ref) and the cardiac output (CO_ref).

Parameters:

Name Type Description Default
sex Sex

the sex.

required

Returns:

Type Description
dict[str, AgeCurve]

The curves in the units of the model (kg, cm, l, l/min).

factor_curves cached

factor_curves(sex)

The factors of the age on the functions of a sex, by the id they multiply.

GFR (the GFR at renal function 1 at a fixed body surface area), HCT (the hematocrit), FFM (the fat-free mass at a fixed body weight and height), albumin and agp (the binding proteins); every factor is 1 at AGE_REFERENCE.

Parameters:

Name Type Description Default
sex Sex

the sex.

required

Returns:

Type Description
dict[str, AgeCurve]

The dimensionless curves.

flow_factors cached

flow_factors(sex)

The factors of the age on the flow fractions of a sex.

Parameters:

Name Type Description Default
sex Sex

the sex.

required

Returns:

Type Description
FlowFactors

The curves of the brain, the liver group and the kidney.

rest_denominator

rest_denominator(brain, fractions)

1 - fQbr - sum fQ_s, subtracted in order as the formula of the model does.

flow_fraction_curves

flow_fraction_curves(sex, fractions)

The flow fractions over age of the organs in parallel.

Parameters:

Name Type Description Default
sex Sex

the sex.

required
fractions Mapping[Organ, float]

the fractions of the adults, fQ<o> without the lung, summing to 1.

required

Returns:

Type Description
dict[Organ, Curve]

The fraction of every organ over age, the brain of the female build

dict[Organ, Curve]

with its factor of the sex (pkpdsim.pbpk.sex_differences); they sum

dict[Organ, Curve]

to 1 at every age.

protein_factor

protein_factor(organ, protein)

The ontogeny of a protein in an organ relative to 35 years.

Parameters:

Name Type Description Default
organ Organ

the organ.

required
protein str

the protein.

required

Returns:

Type Description
AgeCurve | None

The curve, None for a protein without ontogeny in the organ.

protein_factors

protein_factors()

The organs and proteins with a factor of age (their ontogeny).

sex differences

The physiology of the women relative to the men of the same age and size.

The sex is a choice of the build. The female build has the reference anatomy of the women of ICRP 89 (organ masses, blood volume, flow fractions, hematocrit; pkpdsim.pbpk.physiology), the fat-free mass of the women (Janmahasatian 2005) and the curves of the women over age where they differ (pkpdsim.pbpk.age). What differs beyond these between a woman and a man of the same age, body weight and height are the factors of this module, each a function of the age (database/tables/sex_human.toml, the forms of pkpdsim.pbpk.curves), an initial assignment fsex_<key> of the female build; the male build has none, its physiology is the reference of the parameters of a substance:

  • the cardiac output (fsex_CO): the same cardiac index of both sexes at the same size, which the scaling with the lean tissue misses;
  • the brain fraction of the cardiac output (fsex_Qbr): the higher cerebral perfusion of the women from puberty to about 65 years;
  • the plasma albumin of the binding (fsex_albumin): lower in the women from puberty to about 55 years;
  • the transit time of the stomach in the fed state (fsex_t_stomach_fed): the slower emptying of a meal of the women from puberty to the menopause;
  • the transit times of the large intestine (fsex_t_colon);
  • the activity of a protein per amount of tissue (fsex_<o>_<protein>).

The differences arise at puberty: every factor is 1 in the children.

SEX module-attribute

SEX = 'sex_human'

The table of the differences of the sexes in the database.

CARDIAC_OUTPUT module-attribute

CARDIAC_OUTPUT = ids.CO

The key of the factor on the cardiac output, fsex_CO.

BRAIN_FLOW module-attribute

BRAIN_FLOW = ids.organ_flow(Organ.BRAIN)

The key of the factor on the brain fraction of the cardiac output, fsex_Qbr.

ALBUMIN module-attribute

ALBUMIN = 'albumin'

The key of the factor on the plasma albumin, fsex_albumin.

GASTRIC_EMPTYING_FED module-attribute

GASTRIC_EMPTYING_FED = 't_stomach_fed'

The key of the factor on the transit time of the stomach in the fed state, fsex_t_stomach_fed.

COLON_TRANSIT module-attribute

COLON_TRANSIT = 't_colon'

The key of the factor on the transit times of the large intestine, fsex_t_colon.

sex_factor

sex_factor(pid)

The id of the factor of the sex on a quantity, fsex_CO, fsex_li_cyp3a4.

same_cardiac_index

same_cardiac_index(age)

The factor on the female cardiac output which makes it that of a man of the same size.

The ratio of the cardiac output of the scaling of the male build to that of the female build (pkpdsim.pbpk.physiology.scaled_cardiac_output) at the body weight and height between the reference individuals of the sexes at the age.

Parameters:

Name Type Description Default
age float

the age (years).

required

Returns:

Type Description
float

The factor (dimensionless).

sex_curves cached

sex_curves(sex)

The factors of the sex on the physiology of a build, by the key of their id.

Parameters:

Name Type Description Default
sex Sex

the sex of the build.

required

Returns:

Type Description
dict[str, AgeCurve]

The dimensionless curves over age of the female build relative to

dict[str, AgeCurve]

the male of the same age and size (CARDIAC_OUTPUT, BRAIN_FLOW,

dict[str, AgeCurve]

ALBUMIN, GASTRIC_EMPTYING_FED, COLON_TRANSIT); none for the male

dict[str, AgeCurve]

build.

protein_sex_factor

protein_sex_factor(sex, organ, protein)

The factor of the sex on the activity of a protein per amount of tissue.

Parameters:

Name Type Description Default
sex Sex

the sex of the build.

required
organ Organ

the organ.

required
protein str

the protein.

required

Returns:

Type Description
AgeCurve | None

The curve over age of the women relative to the men; None for the

AgeCurve | None

male build and for a protein which the sex does not change.

protein_sex_factors

protein_sex_factors()

The organs and proteins with a factor of the sex.

curves

Curves of the age: functions of the age as numbers and as SBML formulas.

The physiology over age (pkpdsim.pbpk.age) is a set of curves of the covariate AGE, each of which is written once and evaluated twice: as a number by Curve.value (the reference individuals of an age, the tables of the documentation, the sampler of virtual individuals) and as the SBML formula of an initial assignment by Curve.formula (the model). The tests compare the two for every curve of the library, so the numbers of the documentation are those of the model.

A curve is dimensionless: the value of a quantity of the physiology is its reference value times a curve, or a curve of values in the unit of the quantity whose formula carries the unit (Curve.formula(..., unit=)). The age enters the formulas as the dimensionless number of years (AGE / 1 yr), and the postmenstrual age of the maturation functions as weeks after the conception, PMA = 40 + AGE * 365.25 / 7 for a birth at term (40 weeks).

PMA_AT_BIRTH module-attribute

PMA_AT_BIRTH = 40.0

The postmenstrual age at a birth at term (weeks).

DAYS_PER_YEAR module-attribute

DAYS_PER_YEAR = 365.25

The days of a year.

WEEKS_PER_YEAR module-attribute

WEEKS_PER_YEAR = DAYS_PER_YEAR / 7.0

The weeks of a year.

Curve

Bases: ABC

A dimensionless function of the age.

value abstractmethod

value(age)

The value at an age.

Parameters:

Name Type Description Default
age float

the postnatal age (years).

required

math abstractmethod

math(age)

The dimensionless formula of the curve.

Parameters:

Name Type Description Default
age str

the dimensionless formula of the age in years, (AGE / 1 yr).

required

formula

formula(age, unit='dimensionless')

The formula of the curve in a unit.

Parameters:

Name Type Description Default
age str

the id of the age (yr), AGE.

required
unit str

the id of the unit of the values of the curve.

'dimensionless'

Returns:

Type Description
str

The formula, (<math>) * 1 <unit>; a dimensionless curve without

str

the factor.

Constant dataclass

Constant(c)

Bases: Curve

A constant.

Attributes:

Name Type Description
c float

the value.

value

value(age)

The constant.

math

math(age)

The constant as a number.

Interpolation dataclass

Interpolation(ages, values)

Bases: Curve

The piecewise linear interpolation of values at ages, constant beyond them.

Attributes:

Name Type Description
ages tuple[float, ...]

the ages (years), increasing.

values tuple[float, ...]

the values at the ages.

value

value(age)

The interpolated value.

math

math(age)

The piecewise formula.

Linear dataclass

Linear(coefficients)

Bases: Curve

A polynomial of the age, c0 + c1*age + c2*age^2 + ....

Attributes:

Name Type Description
coefficients tuple[float, ...]

the coefficients from the constant on.

value

value(age)

The polynomial at the age.

math

math(age)

The polynomial.

Hill dataclass

Hill(x50, n, base=0.0, top=1.0, variable='age', x_min=0.0)

Bases: Curve

A sigmoid maturation, base + (top - base) * x^n / (x50^n + x^n).

Attributes:

Name Type Description
x50 float

the variable at half of the maturation (years of age, or weeks of postmenstrual age).

n float

the Hill coefficient.

base float

the value at the variable 0.

top float

the value of the mature organ.

variable Literal['age', 'pma']

age (postnatal years) or pma (postmenstrual weeks, a birth at term).

x_min float

the smallest variable, below which the curve is constant (a function of the days which starts at the first day).

value

value(age)

The maturation at the age.

math

math(age)

The sigmoid.

Logarithmic dataclass

Logarithmic(a, b)

Bases: Curve

A logarithm of the postnatal age in days, a + b*ln(max(days, 1)).

Attributes:

Name Type Description
a float

the value at the first day.

b float

the slope per e-fold of the days.

value

value(age)

The value at the age.

math

math(age)

The logarithm of the days, at least one.

Affine dataclass

Affine(c, terms)

Bases: Curve

A constant plus multiples of curves, c + sum(k_i * curve_i).

Attributes:

Name Type Description
c float

the constant.

terms tuple[tuple[float, Curve], ...]

the factors and their curves.

value

value(age)

The sum at the age.

math

math(age)

The sum.

Quotient dataclass

Quotient(numerator, denominator)

Bases: Curve

The quotient of two curves.

Attributes:

Name Type Description
numerator Curve

the numerator.

denominator Curve

the denominator.

value

value(age)

The quotient at the age.

math

math(age)

The quotient.

Product dataclass

Product(curves)

Bases: Curve

The product of curves.

Attributes:

Name Type Description
curves tuple[Curve, ...]

the factors.

value

value(age)

The product of the values.

math

math(age)

The product of the formulas.

Relative dataclass

Relative(curve, at)

Bases: Curve

A curve relative to its value at an age, 1 at that age.

Attributes:

Name Type Description
curve Curve

the curve.

at float

the age (years) of the value 1.

value

value(age)

The value relative to the value at at.

math

math(age)

The formula over the formula at at, so the curve is exactly 1 at at.

Spliced dataclass

Spliced(ages, curves)

Bases: Curve

Curves of consecutive age ranges, continuous at the splices.

The first curve holds below the first age of ages, the second from it to the second, and so on; the values are not adjusted, so the curves must meet at the splices (checked).

Attributes:

Name Type Description
ages tuple[float, ...]

the ages of the splices (years), increasing.

curves tuple[Curve, ...]

one more curve than splices.

value

value(age)

The value of the curve of the age.

math

math(age)

The piecewise formula of the curves.

pma

pma(age)

The postmenstrual age (weeks) of a postnatal age (years), born at term.

check_curve

check_curve(curve, ages)

Check that a curve is finite and positive at ages.

Parameters:

Name Type Description Default
curve Curve

the curve.

required
ages Sequence[float]

the ages (years).

required

Returns:

Type Description
list[str]

The problems.

populations

The populations: the reference individual and the covariates over age.

A population is a set of data of the library (database/tables/populations/<key>.toml): the reference covariates of each sex (body weight, height and, where the data give it, the age), which become the default individual of a model, and the distribution of the body weight and the height of each sex over age (Anthropometry), from which pkpdsim.pbpk.virtual draws virtual individuals. The reference anatomy stays ICRP 89 (database/tables/physiology_human.toml, with its children and the changes of the adults over age of pkpdsim.pbpk.age): the organ volumes and flows of an individual follow from the covariate scaling of pkpdsim.pbpk.physiology (Huisinga 2012) at its body weight, height and age. The population is chosen when the model is built (PBPKDefinition.population), the European reference individuals of ICRP 89 are the default.

The distributions are data of the library and never SBML distrib uncertainties: run_simulation --uncertainty draws every parameter with a distrib uncertainty and must only draw the uncertainty of a fit.

The populations:

  • european_icrp: the ICRP 89 reference individuals (the default); ICRP 89 gives reference values, not distributions, so the population has none;
  • white_american_nhanes, black_american_nhanes, mexican_american_nhanes: the NHANES examinations 2013-2018 (scripts/database/nhanes_populations.py from the public files of the survey): the reference individual the survey-weighted mean of the adults of 20 to 49 years, the distributions of every age from birth to 80 years and over, survey-weighted kernel moments;
  • east_asian_tanaka: the Asian Reference Man of Tanaka 1996 with the distributions of the Japanese of the same tables.

PK-Sim also offers a Japanese population (based on Japanese national statistics of 2015). Its primary data were not read, so the library has no japanese population; the Japanese data of Tanaka 1996 (1976 to 1988) are the distributions of east_asian_tanaka.

DEFAULT_POPULATION module-attribute

DEFAULT_POPULATION = 'european_icrp'

The population of a model which does not choose one (pkpdsim.pbpk.populations).

COVARIATES module-attribute

COVARIATES = (ids.BW, ids.HEIGHT, ids.AGE)

The covariates a population gives reference values for.

POPULATIONS module-attribute

POPULATIONS = _populations()

The populations by key.

CovariateDistribution dataclass

CovariateDistribution(
    height_mean, height_sd, ln_bw_mean, ln_bw_sd, rho
)

The distribution of height and body weight of the individuals of one age and sex.

The height (cm) and the logarithm of the body weight (kg) are bivariate normal: the body weight is lognormal and correlated with the height.

Attributes:

Name Type Description
height_mean float

the mean height (cm).

height_sd float

the standard deviation of the height (cm).

ln_bw_mean float

the mean of the logarithm of the body weight (ln kg).

ln_bw_sd float

the standard deviation of the logarithm of the body weight.

rho float | None

the correlation of height and logarithm of the body weight; None where the data give none, the two are drawn independently.

bw_mean property

bw_mean

The mean body weight (kg) of the lognormal distribution.

Anthropometry dataclass

Anthropometry(
    ages,
    height_mean,
    height_sd,
    ln_bw_mean,
    ln_bw_sd,
    rho,
    age_range,
    source,
    notes=None,
)

The distribution of height and body weight of one sex of a population over age.

The rows are the distributions at ages (CovariateDistribution); between two ages every moment is interpolated linearly, below the first and above the last age of the rows the nearest row holds, within age_range, the ages the data describe.

Attributes:

Name Type Description
ages tuple[float, ...]

the ages of the rows (years), increasing.

height_mean tuple[float, ...]

the mean height of each row (cm).

height_sd tuple[float, ...]

the standard deviation of the height of each row (cm).

ln_bw_mean tuple[float, ...]

the mean logarithm of the body weight of each row (ln kg).

ln_bw_sd tuple[float, ...]

the standard deviation of the logarithm of the body weight.

rho tuple[float, ...] | None

the correlation of height and log body weight of each row, or None: the data give no correlation, the two are independent.

age_range tuple[float, float]

the ages (years) the distributions describe.

source str

the key of the source in database/sources.toml.

notes str | None

where the numbers come from.

at

at(age)

The distribution of an age.

Parameters:

Name Type Description Default
age float

the age (years).

required

Returns:

Type Description
CovariateDistribution

The moments interpolated linearly in age.

Raises:

Type Description
ValueError

for an age outside of age_range.

sample

sample(ages, rng, truncation=3.0)

Draw the height and body weight of individuals of given ages.

Every individual is drawn from the bivariate normal distribution of height and log body weight of its age, truncated at truncation standard deviations of each (the draws beyond are drawn again).

Parameters:

Name Type Description Default
ages ndarray

the ages of the individuals (years).

required
rng Generator

the random generator.

required
truncation float

the truncation of both marginals in standard deviations.

3.0

Returns:

Type Description
tuple[ndarray, ndarray]

The heights (cm) and the body weights (kg).

Raises:

Type Description
ValueError

for an age outside of age_range or a truncation which is not positive.

Population dataclass

Population(key, name, source, reference, anthropometry)

A population: the reference individual and the covariates over age per sex.

Attributes:

Name Type Description
key str

the key of the population, PBPKDefinition.population.

name str

the name.

source str

the key of the source of the population in database/sources.toml.

reference Mapping[Sex, Mapping[str, Value]]

the reference covariates (BW, HEIGHT, AGE) of each sex, the default individual of a model.

anthropometry Mapping[Sex, Anthropometry]

the distribution of height and body weight over age of each sex; a sex without data has none.

population

population(key)

Get a population.

Parameters:

Name Type Description Default
key str

the key of the population.

required

Returns:

Type Description
Population

The population.

Raises:

Type Description
ValueError

if there is no population of the key.

virtual populations

Virtual populations: individuals drawn from the factors of a population.

A virtual individual is a combination of factors, each of which the library knows: the population (the distribution of body weight and height over age of pkpdsim.pbpk.populations), the sex (the build of the model), the age (the physiology over age of pkpdsim.pbpk.age) and the impaired organ function (the severities of pkpdsim.pbpk.impairment). virtual_population draws them: the sex by its share, the age uniformly within a range or an age class (pkpdsim.impairment.AGE_CLASSES), the height and the body weight from the bivariate distribution of the age and sex of the population, and a severity as a fixed value or uniformly within a range. The changes of an individual (AGE, BW, HEIGHT and the severities) are initial values of the model: set before the initialization, the physiology of the build of the sex follows (VirtualPopulation.values, PBPKSimulationExperiment.population_dimension).

The draws are reproducible by the seed; the covariates are library data and never SBML distrib uncertainties.

MAX_AGE module-attribute

MAX_AGE = 100.0

The oldest age (years) of an age class without an upper limit.

SEVERITIES module-attribute

SEVERITIES = MappingProxyType(
    {
        ids.CP_SEVERITY: (0.0, 3.0),
        ids.HF_SEVERITY: (0.0, 4.0),
        ids.F_RENAL_FUNCTION: (0.0, 1.5),
    }
)

The conditions a virtual individual may have, with the range of their value.

VirtualIndividual dataclass

VirtualIndividual(
    index, sex, age, bw, height, conditions=dict()
)

An individual of a virtual population.

Attributes:

Name Type Description
index int

the number of the individual in its population.

sex Sex

the sex, whose build simulates it.

age float

the age (years).

bw float

the body weight (kg).

height float

the height (cm).

conditions Mapping[str, float]

the severities of the impairments by parameter id (CP_severity, f_renal_function, HF_severity).

bmi property

bmi

The body mass index (kg/m2).

changes

changes()

The initial values of the individual by parameter id, in the units of the model.

VirtualPopulation dataclass

VirtualPopulation(population, individuals, seed)

A virtual population: the individuals and how they were drawn.

Attributes:

Name Type Description
population str

the key of the population of the covariates.

individuals tuple[VirtualIndividual, ...]

the individuals.

seed int

the seed of the draws.

of_sex

of_sex(sex)

The individuals of a sex, simulated with the build of the sex.

values

values(sex)

The initial values of the individuals of a sex, an array per parameter id.

The arrays are the values of a dimension of a scan (AGE in years, BW in kg, HEIGHT in cm, the severities dimensionless); a condition which only some individuals have is the value of the healthy organ function for the others (f_renal_function 1, the severities 0).

Raises:

Type Description
ValueError

if the population has no individual of the sex.

virtual_population

virtual_population(
    population,
    n,
    *,
    ages=(20.0, 50.0),
    female=0.5,
    conditions=None,
    seed=1234,
    truncation=3.0,
)

Draw a virtual population.

Parameters:

Name Type Description Default
population str

the key of the population of the covariates (pkpdsim.pbpk.populations), which must have distributions of both sexes drawn (european_icrp has none).

required
n int

the number of individuals.

required
ages tuple[float, float] | str

the range of the ages (years), drawn uniformly, or the key of an age class of pkpdsim.impairment.AGE_CLASSES (child, old_old, ...); the population must describe the ages.

(20.0, 50.0)
female float

the share of women, 0 (men only) to 1 (women only).

0.5
conditions Mapping[str, float | tuple[float, float]] | None

the severities of the impairments by parameter id, a fixed value or a range drawn uniformly ({"CP_severity": (1, 3)}).

None
seed int

the seed of the random generator.

1234
truncation float

the truncation of height and log body weight in standard deviations of the age.

3.0

Returns:

Type Description
VirtualPopulation

The population.

Raises:

Type Description
ValueError

for no individual, a share outside of 0 to 1, a population without the distributions of a drawn sex, ages it does not describe, or an unknown condition.

impairment

The impaired organ function: parameter vectors on the physiology.

Impairment is never a structurally different model: three severities of the top model set factors on the quantities of the healthy physiology, the liver and the binding to plasma proteins (the table impairment of the parameter database pkpdsim.database, every number with its source; a value which no publication read gives is a model choice):

  • CP_severity: liver cirrhosis, 0 healthy, 1, 2, 3 the Child-Pugh classes A, B, C; a severity between the classes interpolates every factor linearly (scans and fits use intermediate values). It sets the functional fraction f_functional and the portosystemic shunt f_shunt of the liver, the hepatic arterial and the renal blood flow, the cardiac output (cardiac index; the organs without a factor of their own close the cardiac output to it), the GFR, albumin and alpha-1-acid glycoprotein (and so fu) and the activity of the enzymes and transporters of the liver: the consensus of the studies of the database on the abundance of the protein per amount of liver tissue in each class over the controls (pkpdsim.database.integration, the mRNA expression only for a protein without an abundance), every class with its interval and studies in the notes of its factor.
  • f_renal_function: chronic kidney disease by the GFR relative to healthy (the factor of the physiology); its GFR per 1.73 m2 (eGFR) gives the stage (normal, mild, moderate, severe, end stage), which sets the binding capacity of the plasma proteins (and so fu). The factors are piecewise linear in the eGFR through anchor points at the stage midpoints ([ckd] stage_anchor of the data, a model choice: continuous covariate for scans and fits; stage midpoints): 1 from 90 ml/min/1.73 m2, the mild value at 75, the moderate value at 45, the severe value at 22.5 and the end stage value at 7.5 and below, linear in between (from 90 to 75 from 1 to the mild value), so a scan or fit of f_renal_function sees no step. The binding to albumin and alpha-1-acid glycoprotein follows the CKD profile of its protein ([ckd.binding] of the data): albumin falls in concentration and in the binding function of its molecule, AAG rises in concentration; the binding to an unknown protein follows the binding capacity of the plasma proteins (plasma_protein). The switch CKD_hepatic (0 off, 1 on) adds the reduced activity of hepatic CYP2D6 and OATP1B. The tubular capacity of the kidney (every metabolism and transport of the kidney) follows f_renal_function continuously, 1 - f_tubular + f_tubular*f_renal_function with the share f_tubular 1 of the intact nephron hypothesis ([ckd] tubular_capacity of the data, a model choice; the kidney owns the factor, pkpdsim.pbpk.organ).
  • HF_severity: heart failure, 0 healthy, 1 to 4 the NYHA classes I to IV, interpolated: the blood flows of liver and portal organs, kidney and skin, adipose and muscle are reduced, the cardiac output is the sum of the flows, the GFR follows the renal blood flow (which is not monotonic in the class, NYHA IV above NYHA III, as measured by Leithe 1984).

The hematocrit (anaemia of cirrhosis and CKD, combined multiplicatively on the hematocrit of the sex of the build), the kidney volume and blood flow and the gastric emptying and small intestinal transit of CKD have their factors, which are 1 until a publication with the healthy reference is read (the data say why).

Each condition has its factors fcp_<key>, fckd_<key>, fhf_<key>; the factor of all conditions on a quantity is fimp_<id> (fimp_GFR, fimp_Qki, fimp_HCT), their product. Blood flows: every organ flow is its fraction of the cardiac output without impairment (CO_base) times fimp_Q<o>, and the cardiac output is CO_base times fimp_CO = sum fQ<o>*fimp_Q<o>, so the flows sum to it. Plasma binding (McNamara 2002): fu = 1/(1 + f*(1 - fu_ref)/fu_ref) with the binding factor f, the factor of the binding protein in cirrhosis (fimp_albumin, fimp_agp, 1 for an unknown protein) times the CKD factor of the binding: the CKD profile of the protein (fimp_albumin_ckd, fimp_agp_ckd, the product of its rows of [ckd.binding]), for an unknown protein one over the factor of the binding capacity fimp_plasma_protein (fu of a strongly bound substance rises by it). fu stays below 1. A binding with ckd=False (measured unchanged in renal impairment) leaves out the CKD factor, so f is the factor of the binding protein alone. The parameters of the CKD profile of a protein are created only when a substance binds to it with the CKD factor. Enzymes and transporters: a rate of a protein in the liver runs with f_<protein>*fimp_<protein>, the organ-local base activity (genotype, interactions of an experiment, LI__f_cyp3a4) times the input fimp_<protein> of the impairment (fimp_li_<protein> of the body), so both act multiplicatively.

All are initial assignments (pkpdsim.pbpk.physiology): set the severities before the simulation, as a covariate; a severity which changes during a simulation is named in PBPKDefinition.dynamic. f_shunt and f_functional stay parameters an experiment may set directly. All severities 0 give the healthy model: every factor is 1.

DATA module-attribute

DATA = 'impairment'

The table of the impairment in the database.

GASTRIC_EMPTYING module-attribute

GASTRIC_EMPTYING = ids.impairment_factor('t_stomach')

The factor on the transit time of the stomach, an input of the intestine.

SI_TRANSIT module-attribute

SI_TRANSIT = ids.impairment_factor('t_si')

The factor on the transit times of the small intestine, an input of the intestine.

MELD_HEALTHY module-attribute

MELD_HEALTHY = 6.43

The MELD score of CP_severity 0: the smallest score of the formula (3.78 ln(bilirubin) + 11.2 ln(INR) + 9.57 ln(creatinine) + 6.43, every laboratory value bounded below by 1 mg/dL or 1), which subjects with a normal bilirubin, INR and creatinine have (Yang 2020: 6.43 in every quartile of the patients with a normal liver function).

ImpairmentFactors dataclass

ImpairmentFactors(values, sources, notes, choice)

The factors of the classes of an impairment with their provenance.

Attributes:

Name Type Description
values tuple[float, ...]

the values of the classes in order.

source tuple[float, ...]

the source of the values.

notes str

the notes of the values.

choice tuple[str, ...]

the classes whose value is a choice of the library, not a value of the source.

provenance

provenance(classes)

The text on the values and the sources of a parameter.

Parameters:

Name Type Description Default
classes Sequence[str]

the labels of the classes of the values.

required

Returns:

Type Description
str

The values by class with the classes which are model choices, and

tuple[str, ...]

the sources (ModelChoice besides the source for those classes).

Raises:

Type Description
ValueError

if the vector does not have a value per class or a choice names no class.

MeldAnchor dataclass

MeldAnchor(severity, meld, level)

The MELD score of a severity of cirrhosis.

Attributes:

Name Type Description
severity float

the severity CP_severity, 0 healthy, 1, 2, 3 the classes.

meld float

the MELD score of the severity.

level Level | None

the consensus of the studies on the MELD of the class, None for the healthy severity (MELD_HEALTHY).

organ_activity

organ_activity(organ, protein)

Get the local input of the individual on a protein in an organ.

Parameters:

Name Type Description Default
organ Organ

the organ.

required
protein str

the protein of a process of the organ.

required

Returns:

Type Description
str | None

fimp_<protein>, replaced by fimp_<organ>_<protein> of the body,

str | None

for a protein with data of impairment in the liver or with a factor

str | None

of the age or the sex in the organ (pkpdsim.pbpk.age,

str | None

pkpdsim.pbpk.sex_differences); None otherwise.

physiology_factors

physiology_factors()

Get the factors of the impairment on the quantities of the physiology.

Returns:

Type Description
dict[str, str]

The factor (formula) by the id of the quantity it multiplies, for

dict[str, str]

pkpdsim.pbpk.physiology.physiology_objects: the cardiac output (the

dict[str, str]

sum of the impaired flows), the flows, the GFR (at renal function 1,

dict[str, str]

GFR_base), the hematocrit and the

dict[str, str]

kidney mass.

unbound_fraction_notes

unbound_fraction_notes(s)

Get the notes of the fraction unbound in plasma of a substance.

The notes say what unbound_fraction gives: the reference fraction scaled with the binding protein under impairment, scaled with the binding capacity of chronic kidney disease alone (an unknown protein with the CKD factor), the reference fraction itself where no factor applies (an unknown protein without the CKD factor), or no binding.

Parameters:

Name Type Description Default
s Substance

the substance.

required

Returns:

Type Description
str

The notes of fu_<s>.

unbound_fraction

unbound_fraction(s)

Get the formula of the fraction unbound in plasma of a substance under impairment.

Parameters:

Name Type Description Default
s Substance

the substance.

required

Returns:

Type Description
str

fu_ref_<s> for a substance without binding, else the McNamara 2002

str

scaling 1/(1 + f*(1 - fu_ref)/fu_ref) with the binding factor f:

str

the factor of the binding protein in cirrhosis times the CKD profile

str

of the protein (fimp_albumin_ckd, fimp_agp_ckd); an unknown

str

protein has no factor of cirrhosis and its CKD factor is one over the

str

factor of the binding capacity fimp_plasma_protein, which raises fu

str

of a strongly bound substance by itself

str

(fu ~ fimp_plasma_protein*fu_ref), fu stays below 1; fu of a weakly

str

bound substance rises less (fu_ref 0.5 at a factor 2.5: 0.71, not

str

1.25). A binding with ckd=False has the factor of the binding

str

protein alone; with an unknown protein as well no factor applies and

str

the result is fu_ref_<s> itself.

ckd_unbound_fractions

ckd_unbound_fractions(s)

Get the fraction unbound of a substance at the CKD stages.

The fu of unbound_fraction without cirrhosis at the values of the stages mild, moderate, severe and end stage of the CKD factor of its binding (the profile of its protein, [ckd.binding], or one over the factor of the binding capacity plasma_protein of an unknown protein): the factors are linear in the eGFR between the anchors of the stages and constant below the end stage, so the fu of every renal function lies between these values (and the reference fu of renal function 1).

Parameters:

Name Type Description Default
s Substance

the substance.

required

Returns:

Type Description
dict[str, float]

The fu by stage; empty for a substance whose fu CKD does not change

dict[str, float]

(no binding, ckd=False) or whose fu is a Formula.

child_pugh_proteins cached

child_pugh_proteins()

The proteins with a consensus of cirrhosis of a Child-Pugh class (pkpdsim.database).

child_pugh_protein

child_pugh_protein(protein)

The factors of a protein of the Child-Pugh classes from the consensus of the database.

A class without a consensus is the linear interpolation between its neighbours (healthy 1 at severity 0) and the last class with a consensus beyond it, a model choice.

Parameters:

Name Type Description Default
protein str

the gene symbol of the protein.

required

Returns:

Type Description
ImpairmentFactors

The factors of the classes A, B, C with the studies of every class.

Raises:

Type Description
ValueError

if no class of the protein has a consensus.

class_factors

class_factors(section, key)

The factors of the classes of a condition on a quantity.

An entry of the table impairment states its values (value), or names the quantity of the studies of the database whose consensus they are (consensus, a key of pkpdsim.database.studies.QUANTITIES): the ratio of the class to the controls of each study, pooled over the studies, a class without a study interpolated as for the proteins (child_pugh_protein). The classes are the Child-Pugh classes A, B, C (child_pugh), the CKD stages mild, moderate, severe and end stage (ckd, ckd.binding) and the NYHA classes I to IV (heart_failure).

Parameters:

Name Type Description Default
section str

the section of the table, e.g. child_pugh or ckd.binding.

required
key str

the key of the factor, e.g. albumin.

required

Returns:

Type Description
ImpairmentFactors

The factors of the classes with their provenance.

Raises:

Type Description
KeyError

for a section or a key which is no factor of the table.

meld_anchors cached

meld_anchors()

The MELD scores of the severities of cirrhosis, the anchors of the mapping.

Severity 0 is MELD_HEALTHY; the classes A, B, C (severity 1, 2, 3) have the consensus of the studies of the database on the MELD of the patients of the class (pkpdsim.database.integration.level, the mean or median of each study pooled by a random-effects meta-analysis), to four significant digits.

Returns:

Type Description
tuple[MeldAnchor, ...]

The anchors in the order of the severities, the MELD increasing.

Raises:

Type Description
ValueError

if a class has no MELD in the database or the MELD of the anchors does not increase with the severity.

cp_severity_of_meld

cp_severity_of_meld(meld)

Get the severity of cirrhosis CP_severity of a MELD score.

The severity is piecewise linear in the MELD through the anchors of meld_anchors (a model choice: the MELD of a class is the consensus of the patients of the class, between the classes the factors and the MELD are both linear in the severity). A MELD at or below MELD_HEALTHY is healthy (0), one at or above the MELD of class C is class C (3), since the library has no factors beyond the class.

Parameters:

Name Type Description Default
meld float

the MELD score.

required

Returns:

Type Description
float

The severity, from 0 to 3.

Raises:

Type Description
ValueError

for a MELD which is not finite.

meld_of_cp_severity

meld_of_cp_severity(severity)

Get the MELD score of a severity of cirrhosis, the inverse of cp_severity_of_meld.

Parameters:

Name Type Description Default
severity float

the severity CP_severity, from 0 to 3.

required

Returns:

Type Description
float

The MELD, piecewise linear in the severity through meld_anchors.

Raises:

Type Description
ValueError

for a severity outside of 0 to 3.

impairment_objects

impairment_objects(definition)

Get the parameters of the impaired organ function of the top model.

Parameters:

Name Type Description Default
definition PBPKDefinition

the definition (the proteins of the liver).

required

Returns:

Type Description
list[Sbase]

The severities, the factors of every condition and of all conditions

list[Sbase]

(initial assignments) and the initial assignments of f_shunt and

list[Sbase]

f_functional; the physiology reads the factors through

list[Sbase]

physiology_factors.

observers

The observers of a PBPK model: assignment rules of the top model, no states.

An observer reads the pool species and the outflow concentrations of the organs and changes nothing, so it conserves mass. Per substance <s>:

  • C<pool>_free_<s> = fu*C<pool>_<s>, the unbound plasma concentration of a pool (ar, ve, po);
  • C<pool>_blood_<s>, the blood concentration of a pool, (1-HCT)*C + HCT*C_bc: BP*C unless the blood cells are kinetic;
  • Chv_<s>, the hepatic vein: the outflow of the liver mixed with the portosystemic shunt by their flows, ((1-f_shunt)*Qh*Cout_li + f_shunt*(Qha*Car + Qpo*Cpo))/Qh, with Chv_free_<s> and Chv_blood_<s>;
  • Carm_<s> = sum w*C, the arm vein (peripheral venous) sampling site: the venous plasma outflows of organs and the arterial plasma mixed with the weights w_arm_<site> of a preset of database/tables/arm_vein.toml (PBPKDefinition.arm_vein, by default the mix of skin and muscle of the PK-Sim documentation); Carm_free_<s> and Carm_blood_<s> as for the pools.

The tissue concentrations are the species of the organs themselves, their unbound concentrations Cu_<part>_<s> observers of the organs, the amounts in urine and feces the sink species, the urinary excretion rate Rurine_<s> an output of the kidney.

A definition adds observers of its own (Observer, PBPKDefinition.observers, e.g. the sum of two metabolites): parameters of the top model over the ids of the top model, appended after the observers of the library. An observer names a species or an unbound concentration of an organ by its flat id (MU__Cti_<s>, LI__Cu_ic_<s>, an amount MU__A<x>), which the organ exposes as a PD input is exposed (pkpdsim.pbpk.builder). An observer which reads a state, directly or through other observers (a species, an observer of the library, an output of an organ or a PD component, a dynamic parameter, time), is an assignment rule; an observer of constants only is a constant with an initial assignment, evaluated after the changes before the simulation (an assignment rule of constants would slow the compile of the model).

The intestine adds readouts on request (PBPKDefinition.readouts, intestine_readouts): the dissolved amount in its lumen Alumen_<s> and the summed fluxes of the absorption Rabs_<s>, the efflux into the lumen Reff_<s> and the loss to the feces Rfeces_<s>, outputs of the intestine as Rurine_<s> is one of the kidney.

TIME module-attribute

TIME = 'time'

The symbol of the simulation time in the symbols of a formula.

Observer dataclass

Observer(sid, formula, unit, name, notes=None)

An observer of a definition: a parameter of the top model with its formula.

Attributes:

Name Type Description
sid str

the id of the observer, an id of the top model.

formula str

the formula (SBML L3 infix) over the ids of the top model: the pools, the sinks, the observers of the library and of the definition, the covariates, the outputs of the organs, the readouts; and a species or an unbound concentration of an organ by its flat id (MU__Cti_<s>), which the organ exposes.

unit UnitDefinition

the unit of the formula; a unit which is no unit of U (the unit per body surface area ML_PER_MIN_1P73M2) is a unit definition of the model.

name str

the name of the observer.

notes str | None

the notes of the observer.

OrganOutput dataclass

OrganOutput(unit, name, kind, text, constant=False)

An output of an organ which replaces the parameter of the top model of its id.

The parameter is created by the composition (pkpdsim.pbpk.builder): an element of an organ which a PD component or an observer reads, a readout of the intestine.

Attributes:

Name Type Description
unit UnitType

the unit of the parameter.

name str

the name of the parameter.

kind str

the kind of its annotation (pkpdsim.pbpk.annotation.KINDS).

text str

the start of its notes, followed by organ <organ>, replaced by the output of the organ.

constant bool

the output is a constant of the organ (a constant of the generated steady state), not an assignment rule.

formula_symbols

formula_symbols(formula)

Get the ids a formula reads, with libsbml's parser of SBML L3 infix.

Parameters:

Name Type Description Default
formula str

the formula; the units of its numbers (1 dimensionless) and the names of its functions are no ids.

required

Returns:

Type Description
set[str]

The ids of the formula, time for the simulation time.

Raises:

Type Description
ValueError

if the formula cannot be parsed, with the message of libsbml.

formula_functions

formula_functions(formula)

Get the functions a formula calls which are no functions of SBML L3 infix.

Such a call (foo(x)) reads a function definition of the model; the models of the library define none.

Parameters:

Name Type Description Default
formula str

the formula.

required

Returns:

Type Description
set[str]

The names of the called functions which are no built-in functions

set[str]

(exp, piecewise, ...).

Raises:

Type Description
ValueError

if the formula cannot be parsed, with the message of libsbml.

definition_observer_objects

definition_observer_objects(observers, constant=())

Get the parameters and the rules of the observers of a definition.

The ids, the symbols of the formulas and whether an observer reads a state are checked when the model is composed (pkpdsim.pbpk.builder).

Parameters:

Name Type Description Default
observers Iterable[Observer]

the observers of the definition, their formulas over the ids of the top model.

required
constant Collection[str]

the ids of the observers which read constants only: a constant with an initial assignment, every other observer an assignment rule.

()

Returns:

Type Description
list[Sbase]

The parameters with their assignment rules or initial assignments,

list[Sbase]

annotated as observers.

readout_ids

readout_ids(substances)

Get the ids of the readouts of the intestine of substances.

Parameters:

Name Type Description Default
substances Iterable[str]

the substance ids.

required

Returns:

Type Description
dict[str, tuple[str, str]]

By readout id (Alumen_<s>, Rabs_<s>, Reff_<s>, Rfeces_<s>,

dict[str, tuple[str, str]]

Aabs_<s>, Fa_<s>), what it sums (lumen, absorption, efflux,

dict[str, tuple[str, str]]

feces, absorbed, fraction) and its substance.

intestine_readouts

intestine_readouts(md, readouts, substances)

Add the readouts of a definition to the model definition of its intestine.

Every readout is a parameter of the intestine with its assignment rule and an output port, which replaces the parameter of its id in the top model, as the urinary excretion rate of the kidney does. The sums are taken over the species and the reactions of the intestine, so that they hold for every intestine with a lumen (segmented, single lumen):

  • Alumen_<s>: the dissolved amount in the lumen, sum V*C of the lumen species Clumen_<seg>_<s> (mmole);
  • Rabs_<s>: the fluxes from a lumen species into the wall of the substance (the mucosa Cmu_<seg>_<s>, else a species of the wall), the absorption and an apical influx (mmole/min);
  • Reff_<s>: the fluxes from the wall into the lumen, the apical efflux (mmole/min);
  • Rfeces_<s>: the net flux of the intestine into the feces Afeces_<s> (mmole/min); with an intestine with a lumen every flux into the feces is one of the intestine, so it integrates to Afeces_<s>;
  • Aabs_<s>: the amount absorbed since the start, the integral of the fluxes of Rabs_<s>, a state of the intestine (mmole);
  • Fa_<s>: the gross absorbed fraction of the oral dose, Aabs_<s> over the oral dose given until then (the dose states PODOSE_<s> and SOLDOSE_<s> over Mr_<s> plus what the intestine applied of them, the state Aapp_<s>), 0 before a dose: before the first pass of the wall and the liver, so above the bioavailability; the absorption of a substance which reaches the lumen otherwise (the bile, an efflux) counts as well, so it can exceed 1.

Aabs_<s> and Aapp_<s> are states which nothing drains (accumulating states, which the equilibration sets back as it sets back the sinks).

Parameters:

Name Type Description Default
md ModelDefinition

the model definition of the intestine, changed in place.

required
readouts Sequence[str]

the readouts of the definition (PBPKDefinition.readouts).

required
substances Iterable[str]

the substance ids of the definition.

required

Returns:

Type Description
dict[str, OrganOutput]

The outputs by id.

Raises:

Type Description
ValueError

naming a readout of a substance without lumen species, or whose sum has no flux.

arm_vein_weights

arm_vein_weights(preset)

Get the weights of a preset of the arm vein.

Parameters:

Name Type Description Default
preset str

the name of the preset, e.g. pksim_default.

required

Returns:

Type Description
dict[Organ | Pool, Value]

The weight of every organ outflow or pool of the mix with its source.

Raises:

Type Description
ValueError

if the preset is unknown or names neither an organ nor a pool.

observer_objects

observer_objects(definition)

Get the observers of a definition.

Parameters:

Name Type Description Default
definition PBPKDefinition

the definition.

required

Returns:

Type Description
list[Sbase]

The weights of the arm vein and the parameters with their assignment

list[Sbase]

rules of every substance.

sinks

The sinks of the body: urine, feces and bile.

Every substance has the amounts in urine Aurine_<s> and feces Afeces_<s> (compartments of amounts, Vurine and Vfeces) and the bile Cbile_<s> in Vbile, which drains with first order k_bile into the duodenum of the intestine (pkpdsim.pbpk.variants.intestine, which owns the lumen and that transit); with the standard organs as intestine, which have no lumen, the bile drains into the feces.

sink_objects

sink_objects(definition, lumen=True)

Get the sinks of a definition.

Parameters:

Name Type Description Default
definition PBPKDefinition

the definition.

required
lumen bool

the intestine has a lumen, which takes the bile; without one the bile drains into the feces here.

True

Returns:

Type Description
list[Sbase]

The compartments, parameters and species of the top model, and the

list[Sbase]

transit of the bile into the feces without lumen.