Skip to content

database

The parameter database: its tables, its studies and their integration into a consensus, see Parameter database.

The parameter database of pkpdsim.

The numbers the PBPK library and the models are built from, apart from the code which uses them. The database has three parts.

  • sources.toml: the publications every number is taken from, by key, and ModelChoice for a number the library chooses where the literature gives none (pkpdsim.database.tables.sources, cite).
  • tables/: the tables of the library, one TOML file per topic (the physiology of the reference individuals, the populations, the distribution, the intestine, the kidney, the routes, the proteins, the impairment). A number is { value = 1.8, unit = "kg", source = "ICRP89" } and may state its uncertainty (sd, se, cv, n, ci), read by pkpdsim.database.tables.entry.
  • studies/: the data of the studies as reported, one folder per source (study.toml with the groups and the measurements, one TSV file of records per measurement), read by pkpdsim.database.studies. A quantity which several studies report is integrated into a consensus with its uncertainty by pkpdsim.database.integration: the ratio of a group to the control group of its study on the log scale, pooled by a random-effects meta-analysis.

The database depends on no other module of pkpdsim; the library reads it and holds no numbers of its own.

tables

The tables and the sources of the database.

A table is a TOML file in pkpdsim/database/tables (a subfolder, e.g. populations, is a group of tables). A number is a TOML table { value = 1.8, unit = "kg", source = "ICRP89", notes = "..." } whose source is a key of sources.toml, so every number states where it comes from. A number may state its uncertainty as its source reports it: sd (the standard deviation of the individuals), se (the standard error of the value), cv (the coefficient of variation, a fraction), n (the number of individuals) and ci ([lower, upper], the 95 % confidence interval of the value); entry reads it into Uncertainty.

Source dataclass

Source(key, citation, doi=None)

A publication a number is taken from.

Attributes:

Name Type Description
key str

the key of the source, e.g. ICRP89.

citation str

the citation.

doi str | None

the DOI of the publication.

Uncertainty dataclass

Uncertainty(sd=None, se=None, cv=None, n=None, ci=None)

The uncertainty of a number as its source states it.

Attributes:

Name Type Description
sd float | None

the standard deviation of the individuals, in the unit of the number.

se float | None

the standard error of the number.

cv float | None

the coefficient of variation of the individuals, a fraction.

n int | None

the number of individuals.

ci tuple[float, float] | None

the 95 % confidence interval of the number, (lower, upper).

Entry dataclass

Entry(value, unit, source, notes=None, uncertainty=None)

A number of a table with its unit, provenance and uncertainty.

Attributes:

Name Type Description
value float | tuple[float, ...]

the number (or the numbers of a vector).

unit str

the unit as the table writes it, e.g. 1/hr.

source str

the key of the source.

notes str | None

a remark on the number.

uncertainty Uncertainty | None

the uncertainty the source states, None without.

load

load(name)

Load a table.

Parameters:

Name Type Description Default
name str

the name of the table without extension, e.g. routes.

required

Returns:

Type Description
dict[str, Any]

The content of tables/<name>.toml, a copy which the caller may change.

load_folder

load_folder(name)

Load the tables of a folder of the tables, by name in order.

Parameters:

Name Type Description Default
name str

the folder of tables, e.g. populations.

required

Yields:

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

The name of every table of the folder without extension and its content.

entry

entry(name, section, key)

Get a number of a table with its unit, source, notes and uncertainty.

Parameters:

Name Type Description Default
name str

the name of the table without extension, e.g. routes.

required
section str

the table of the number, dotted for a nested table.

required
key str

the key of the number in the table.

required

Returns:

Type Description
Entry

The number.

Raises:

Type Description
KeyError

if the table has no such number.

ValueError

for a malformed uncertainty or a source which sources.toml does not have.

sources cached

sources()

Get the sources by their key.

cite

cite(key)

Get the citation of a source with its DOI.

Parameters:

Name Type Description Default
key str

the key of the source.

required

Returns:

Type Description
str

The citation, followed by the DOI if the source has one.

Raises:

Type Description
KeyError

if no source has the key.

studies

The data of the studies of the database, as their sources report them.

A study is a folder of pkpdsim/database/studies named by the key of its source in sources.toml: study.toml describes the study (the tissue, the control group, the groups and the measurements) and every measurement is a TSV file of records, one row per entity (a gene symbol of HGNC, e.g. CYP3A4, SLCO1B1) and group with the statistics the source reports. The records are the numbers of the source, never derived ones: a statistic the source does not report is empty, a number which disagrees with the others of its row (a mean outside its range, a CV which is not the SD over the mean) is kept as printed and has a note. check finds such a row without a note.

study.toml:

source = "Drozdzik2021"           # the key of sources.toml, the folder name
tissue = "liver"
control = "controls"             # the control group of every ratio
notes = "..."

[groups.controls]
condition = "control"
description = "histologically normal liver ..."

[groups.cirrhosis_C]
condition = "cirrhosis"
child_pugh = "C"
etiology = "mixed"
description = "..."

[measurements.protein]
file = "protein.tsv"
kind = "protein"                 # protein abundance, or `mrna` expression
unit = "fmol/mg tissue"
method = "..."
location = "Table S3"

The columns of a TSV file are entity and group (required), name (the name in the source), n, n_detected (the samples above the limit of quantification), mean, sd, se, cv_percent, median, q1, q3 (the quartiles), min, max, unit (of a record whose unit is not that of its measurement), ci_low, ci_high (the 95 % confidence interval of the median) and notes. The entity of a protein or an mRNA is its HGNC symbol, that of the kind physiology a key of QUANTITIES (e.g. albumin, meld) in the unit of the quantity (a measurement of the kind has no unit). A study without a control group (control left out) gives levels and no ratios; a study whose numbers are read from a review states the review as via. Numbers digitized from a figure say so in their notes, with the resolution of a pixel.

KINDS module-attribute

KINDS = {
    "protein": "protein abundance per amount of tissue",
    "mrna": "mRNA expression",
    "physiology": "a physiological or clinical quantity of the subjects",
}

The kinds of measurement.

QUANTITIES module-attribute

QUANTITIES = {
    "albumin": Quantity(
        "plasma (serum) albumin concentration", "g/L"
    ),
    "hematocrit": Quantity("hematocrit", "%"),
    "bilirubin": Quantity("serum total bilirubin", "mg/dL"),
    "creatinine": Quantity("serum creatinine", "mg/dL"),
    "inr": Quantity(
        "international normalized ratio of the prothrombin time",
        "1",
    ),
    "meld": Quantity(
        "MELD score (model for end-stage liver disease)",
        "1",
    ),
    "cardiac_index": Quantity(
        "cardiac output per body surface area", "L/min/m2"
    ),
    "portal_vein_flow": Quantity(
        "blood flow of the portal vein", "mL/min"
    ),
    "portal_perfusion": Quantity(
        "portal perfusion of the liver per volume of liver",
        "mL/min/dL",
    ),
    "splenic_vein_flow": Quantity(
        "blood flow of the splenic vein", "mL/min"
    ),
    "hepatic_artery_flow": Quantity(
        "blood flow of the hepatic artery", "mL/min"
    ),
    "hepatic_arterial_perfusion": Quantity(
        "arterial perfusion of the liver per volume of liver",
        "mL/min/dL",
    ),
    "liver_volume_per_bw": Quantity(
        "liver volume per body weight", "cm3/kg"
    ),
    "liver_volume_per_height": Quantity(
        "liver volume per body height", "cm3/m"
    ),
    "hepatocyte_volume_per_bw": Quantity(
        "hepatocyte volume per body weight", "cm3/kg"
    ),
    "functional_liver_volume_per_bw": Quantity(
        "functional liver volume per body weight (99mTc-GSA scintigraphy)",
        "cm3/kg",
    ),
    "hepatic_ecv": Quantity(
        "extracellular volume fraction of the liver (MRI or CT)",
        "%",
    ),
    "hemoglobin": Quantity(
        "blood hemoglobin concentration", "g/L"
    ),
    "agp": Quantity(
        "plasma alpha-1-acid glycoprotein (orosomucoid)",
        "g/L",
    ),
    "renal_cortical_perfusion": Quantity(
        "perfusion of the renal cortex per tissue mass (arterial spin labelling)",
        "mL/min/100 g",
    ),
    "renal_medullary_perfusion": Quantity(
        "perfusion of the renal medulla per tissue mass (arterial spin labelling)",
        "mL/min/100 g",
    ),
    "renal_artery_flow": Quantity(
        "blood flow of the renal arteries of both kidneys (phase-contrast MRI)",
        "mL/min",
    ),
    "renal_artery_flow_one_kidney": Quantity(
        "blood flow of the renal artery of one kidney (phase-contrast MRI)",
        "mL/min",
    ),
    "effective_renal_plasma_flow": Quantity(
        "effective renal plasma flow per body surface area (hippuran clearance)",
        "mL/min/1.73m2",
    ),
    "kidney_volume": Quantity(
        "total volume of both kidneys (MRI)", "mL"
    ),
    "kidney_volume_per_bsa": Quantity(
        "total volume of both kidneys per body surface area",
        "mL/m2",
    ),
    "renal_parenchymal_volume": Quantity(
        "volume of the renal parenchyma of both kidneys (MRI or CT)",
        "mL",
    ),
    "kidney_length": Quantity(
        "length of a kidney (ultrasound or MRI)", "mm"
    ),
    "gastric_emptying_half_time": Quantity(
        "half time of gastric emptying (breath test or scintigraphy)",
        "min",
    ),
    "cardiac_output": Quantity("cardiac output", "L/min"),
    "hepatic_blood_flow_per_bsa": Quantity(
        "hepatic blood flow per body surface area (bromsulphalein or ICG)",
        "mL/min/m2",
    ),
    "superior_mesenteric_artery_flow": Quantity(
        "blood flow of the superior mesenteric artery (Doppler)",
        "mL/min",
    ),
    "renal_blood_flow_per_bsa": Quantity(
        "renal blood flow per body surface area (PAH clearance and hematocrit)",
        "mL/min/1.73m2",
    ),
    "gfr_measured": Quantity(
        "GFR measured by an exogenous marker per body surface area (inulin, iohexol, mannitol)",
        "mL/min/1.73m2",
    ),
    "forearm_blood_flow": Quantity(
        "forearm blood flow per tissue volume (venous occlusion plethysmography)",
        "mL/min/100 mL",
    ),
    "calf_blood_flow": Quantity(
        "calf blood flow per tissue volume (venous occlusion plethysmography)",
        "mL/min/100 mL",
    ),
    "leg_blood_flow_per_bsa": Quantity(
        "blood flow of one leg per body surface area (femoral vein thermodilution)",
        "L/min/m2",
    ),
}

The quantities of the kind physiology, the entities of its records, in the unit of each (1 dimensionless).

CONDITIONS module-attribute

CONDITIONS = {
    "control": "the control group of a study, the healthy reference of its ratios",
    "cirrhosis": "liver cirrhosis or chronic liver disease",
    "ckd": "chronic kidney disease",
    "heart_failure": "chronic heart failure",
}

The conditions of the groups.

CHILD_PUGH module-attribute

CHILD_PUGH = ('A', 'B', 'C')

The Child-Pugh classes of cirrhosis.

CKD_STAGES module-attribute

CKD_STAGES = {
    "mild": "eGFR 60-89 ml/min/1.73 m2 (KDIGO G2)",
    "moderate": "eGFR 30-59 ml/min/1.73 m2 (G3a and G3b)",
    "severe": "eGFR 15-29 ml/min/1.73 m2 (G4)",
    "end stage": "eGFR < 15 ml/min/1.73 m2, not on dialysis (G5)",
    "dialysis": "end stage on dialysis (G5D)",
}

The stages of chronic kidney disease, those of the library and dialysis.

NYHA module-attribute

NYHA = ('I', 'II', 'III', 'IV')

The NYHA classes of heart failure.

ETIOLOGIES module-attribute

ETIOLOGIES = {
    "mixed": "the groups of several etiologies together",
    "alcoholic liver disease": "alcoholic liver disease (ALD), alcoholic cirrhosis",
    "hepatitis C": "chronic hepatitis C, HCV cirrhosis",
    "primary biliary cholangitis": "primary biliary cholangitis (PBC)",
    "primary sclerosing cholangitis": "primary sclerosing cholangitis (PSC)",
    "autoimmune hepatitis": "autoimmune hepatitis (AIH)",
}

The etiologies of the liver diseases.

Quantity dataclass

Quantity(description, unit)

A quantity of the kind physiology.

Attributes:

Name Type Description
description str

what the quantity is.

unit str

the unit of every record of the quantity; a source which reports another unit is converted when its numbers are entered, the note of the record gives the printed numbers.

Group dataclass

Group(
    id,
    condition,
    child_pugh=None,
    etiology=None,
    ckd_stage=None,
    nyha=None,
    description="",
    assumption=None,
)

A group of subjects or samples of a study.

Attributes:

Name Type Description
id str

the key of the group in its study.

condition str

the condition, a key of CONDITIONS.

child_pugh str | None

the Child-Pugh class of a cirrhosis group, None without (also for a group of several classes).

ckd_stage str | None

the stage of a CKD group, a key of CKD_STAGES.

nyha str | None

the NYHA class of a heart failure group.

etiology str | None

the etiology of a liver disease, a key of ETIOLOGIES.

description str

the description of the group.

assumption str | None

the assumption on the group which its source does not state (e.g. the Child-Pugh class of end-stage livers), None without.

fields

fields()

The fields which describe the subjects: condition, class and etiology.

Summary dataclass

Summary(
    n=None,
    n_detected=None,
    mean=None,
    sd=None,
    se=None,
    cv=None,
    median=None,
    q1=None,
    q3=None,
    min=None,
    max=None,
    ci=None,
)

The statistics of a group as its source reports them.

Attributes:

Name Type Description
n int | None

the number of samples.

n_detected int | None

the samples above the limit of quantification.

mean float | None

the arithmetic mean.

sd float | None

the standard deviation.

se float | None

the standard error of the mean.

cv float | None

the coefficient of variation, a fraction.

median float | None

the median.

q1 float | None

the first quartile.

q3 float | None

the third quartile.

min float | None

the smallest value.

max float | None

the largest value.

ci tuple[float, float] | None

the 95 % confidence interval of the median.

inconsistencies

inconsistencies()

The statistics which disagree with each other.

Returns:

Type Description
list[str]

A text per disagreement: a negative statistic, a CV which is not

list[str]

the SD over the mean (within the rounding of the source, 2

list[str]

percentage points and 5 %), a median or mean outside the range, a

list[str]

standard deviation of 0 with several samples, more samples

list[str]

detected than measured.

Record dataclass

Record(
    study,
    measurement,
    kind,
    tissue,
    unit,
    entity,
    name,
    group,
    summary,
    notes="",
)

A record of a study: the statistics of an entity in a group.

Attributes:

Name Type Description
study str

the key of the study, the key of its source.

measurement str

the key of the measurement in its study.

kind str

the kind of the measurement, a key of KINDS.

tissue str

the tissue.

unit str

the unit of the values.

entity str

the gene symbol of the entity.

name str

the name of the entity in the source.

group Group

the group.

summary Summary

the statistics.

notes str

a remark on the record, e.g. why a statistic disagrees.

Measurement dataclass

Measurement(
    key, kind, unit, method, location, notes, records
)

A measurement of a study: a kind of quantity in a tissue, one TSV file.

Attributes:

Name Type Description
key str

the key of the measurement in its study.

kind str

the kind, a key of KINDS.

unit str

the unit of the values (a record may state its own); empty for the kind physiology, whose records are in the unit of their quantity.

method str

the method of the measurement.

location str

where the values are in the source, e.g. Table S3.

notes str

a remark on the measurement.

records tuple[Record, ...]

the records.

Study dataclass

Study(
    key,
    tissue,
    control,
    groups,
    measurements,
    notes,
    via=None,
)

A study: its groups and measurements.

Attributes:

Name Type Description
key str

the key of the study, the key of its source in sources.toml.

tissue str

the tissue of the measurements, body for the quantities of the subjects.

control str | None

the control group, the reference of every ratio, None for a study without (its records give levels, no ratios).

groups dict[str, Group]

the groups by key.

measurements dict[str, Measurement]

the measurements by key.

notes str

a remark on the study.

via str | None

the key of the source the numbers are read from when it is not the study itself (a table of a review), None for the study.

studies cached

studies()

Get the studies of the database by key, read once per process.

records

records(kind=None, entity=None, tissue=None)

Get the records of the studies.

Parameters:

Name Type Description Default
kind str | None

only the records of this kind of measurement.

None
entity str | None

only the records of this entity.

None
tissue str | None

only the records of this tissue.

None

Returns:

Type Description
list[Record]

The records in the order of the studies and their files.

check

check()

Check the records of the studies.

Returns:

Type Description
list[str]

A problem per record whose statistics disagree and which has no note

list[str]

that says why, empty if every record is consistent or explained.

integration

The integration of the studies of the database into a consensus with its uncertainty.

The consensus of a quantity of an entity (e.g. the protein abundance of CYP3A4 in the liver) in a condition (e.g. cirrhosis of Child-Pugh class C) is the ratio of the condition to the control, integrated over the studies which report both.

  1. The location of a group on the log scale, the log of its median (equal to the geometric mean for log-normal data, so means and medians of different studies estimate the same ratio), with its standard error, from the statistics its source reports, in this order:
  2. the median with its 95 % confidence interval: ln(median), the standard error (ln(upper) - ln(lower))/(2*1.96);
  3. the median with its quartiles (a box plot): the SD of the log of the interquartile range of a normal distribution of the log, sigma = (ln(q3) - ln(q1))/1.349, the standard error of the log of a median sqrt(pi/2)*sigma/sqrt(n);
  4. the median with the mean and SD: the log-normal SD of the log sigma = sqrt(ln(1 + CV^2)) (CV = SD/mean), the standard error of the log of a median sqrt(pi/2)*sigma/sqrt(n);
  5. the mean and SD alone: the geometric mean of the log-normal mean and SD, ln(mean) - sigma^2/2, its standard error sigma/sqrt(n). A group without its spread (SD, CV or interval) takes the sigma of its study and kind of measurement (the median over its other records), or of all studies of the kind, and is marked as imputed. A group whose location is not positive (a median or mean of 0, below the limit of quantification in most samples) has no log and is excluded with the reason.

A group with many samples below the limit of quantification (counted as 0) is no log-normal group: its median and quartiles sit on the limit and their ratio says nothing. Where a group of a comparison is such a group (a first quartile or a median of 0, or fewer than ¾ of its samples detected), both groups of the comparison take their arithmetic means, ln(mean) with the standard error CV/sqrt(n) (the delta method, the CV of the SD over the mean, imputed as above without), the ratio of the means. A group with at most a quarter of its samples detected (a third quartile of 0) says nothing of a ratio: its comparison is excluded. 2. The estimate of a study: the groups of the study which match the condition (every field of the condition equal), the group without an etiology (or mixed) if the study has one, else every matching group, strata of disjoint subjects pooled by their inverse variance; minus the control group of the study. Its variance is the sum of both. 3. The consensus of the estimates of the studies: the random-effects meta-analysis of DerSimonian and Laird, the between-study variance tau^2 from Cochran's Q, so heterogeneity between the studies (populations, etiologies, methods) widens the consensus. A single study has no tau^2.

The consensus is a log-normal factor: value = exp(mu), the 95 % confidence interval of the mean ratio exp(mu +- 1.96*se) and the uncertainty of the ratio of a new population sqrt(se^2 + tau^2) (the prediction).

Z module-attribute

Z = 1.959963984540054

The 97.5 % quantile of the standard normal distribution.

LogLocation dataclass

LogLocation(y, se, statistic, imputed=False)

The location of a group on the log scale.

Attributes:

Name Type Description
y float

the log of the median (or of the geometric mean).

se float

the standard error of y.

statistic str

the statistics y and se are taken from.

imputed bool

the spread is the spread of the other records of its study or kind, the group reports none.

Exclusion dataclass

Exclusion(study, group, reason)

A record which no estimate uses, with the reason.

Attributes:

Name Type Description
study str

the key of the study.

group str

the key of the group.

reason str

why it is excluded.

Estimate dataclass

Estimate(
    study,
    kind,
    groups,
    control,
    log_ratio,
    se,
    statistic,
    imputed,
    n,
    n_control,
    assumptions=(),
)

The estimate of the log ratio of a condition to the control of a study.

Attributes:

Name Type Description
study str

the key of the study.

kind str

the kind of measurement.

groups tuple[str, ...]

the keys of the groups of the condition.

control str

the key of the control group.

log_ratio float

the log of the ratio to the control.

se float

its standard error.

statistic str

the statistics of the locations.

imputed bool

a spread is imputed.

n int | None

the samples of the groups of the condition.

n_control int | None

the samples of the control group.

assumptions tuple[str, ...]

the assumptions on the groups, e.g. their class.

ratio property

ratio

The ratio to the control.

Consensus dataclass

Consensus(
    kind,
    entity,
    tissue,
    condition,
    estimates,
    excluded,
    mu,
    se,
    tau2,
    q,
    i2,
)

The consensus of the studies on the ratio of a condition to the control.

Attributes:

Name Type Description
kind str

the kind of measurement.

entity str

the gene symbol of the entity.

tissue str

the tissue.

condition tuple[tuple[str, str], ...]

the condition, (field, value) pairs.

estimates tuple[Estimate, ...]

the estimates of the studies.

excluded tuple[Exclusion, ...]

the records which no estimate uses.

mu float

the log of the consensus ratio.

se float

the standard error of mu.

tau2 float

the between-study variance, 0 for a single study.

q float | None

Cochran's Q, None for a single study.

i2 float | None

the share of the variance between the studies, None for a single study.

value property

value

The consensus ratio.

ci property

ci

The 95 % confidence interval of the consensus ratio.

prediction_se property

prediction_se

The standard error of the log ratio of a new population, sqrt(se^2 + tau^2).

sources property

sources

The keys of the studies of the estimates.

text

text()

A short statement of the consensus with its interval and studies.

LevelEstimate dataclass

LevelEstimate(study, groups, value, se, statistic, n, unit)

The level of a quantity in the groups of a condition of a study.

Attributes:

Name Type Description
study str

the key of the study.

groups tuple[str, ...]

the keys of the groups.

value float

the level, the mean (or the median) of the groups.

se float

its standard error.

statistic str

the statistics of the level.

n int | None

the samples of the groups.

unit str

the unit of the level.

Level dataclass

Level(
    kind,
    entity,
    tissue,
    condition,
    unit,
    estimates,
    value,
    se,
    tau2,
)

The consensus of the studies on the level of a quantity in a condition.

Attributes:

Name Type Description
kind str

the kind of measurement.

entity str

the entity, a gene symbol or a quantity.

tissue str

the tissue.

condition tuple[tuple[str, str], ...]

the condition, (field, value) pairs.

unit str

the unit of the levels.

estimates tuple[LevelEstimate, ...]

the levels of the studies.

value float

the pooled level.

se float

its standard error.

tau2 float

the between-study variance, 0 for a single study.

ci property

ci

The 95 % confidence interval of the pooled level.

sources property

sources

The keys of the studies of the estimates.

text

text()

A short statement of the level with its interval and studies.

sigma_log

sigma_log(summary)

The SD of the log of a log-normal group of its mean and SD (or CV), or its quartiles.

Parameters:

Name Type Description Default
summary Summary

the statistics of the group.

required

Returns:

Type Description
float | None

sqrt(ln(1 + CV^2)) of the mean and SD (the SD of the standard error

float | None

of the mean times the root of n, se*sqrt(n), for a group which

float | None

reports the SE alone) or the CV, else (ln(q3) - ln(q1))/1.349 of

float | None

positive quartiles; None without a positive spread.

log_location

log_location(record)

Get the location of a record on the log scale with its standard error.

Parameters:

Name Type Description Default
record Record

the record of a group.

required

Returns:

Type Description
LogLocation | str

The location, or the reason why the record has none.

mostly_undetected

mostly_undetected(summary)

Whether at most a quarter of the samples of a group are detected.

Parameters:

Name Type Description Default
summary Summary

the statistics of the group.

required

Returns:

Type Description
bool

A third quartile of 0, or fewer than a quarter of the samples detected.

zero_inflated

zero_inflated(summary)

Whether a group has many samples below the limit of quantification.

Parameters:

Name Type Description Default
summary Summary

the statistics of the group.

required

Returns:

Type Description
bool

A first quartile or a median of 0, or fewer than ¾ of the samples

bool

detected.

mean_location

mean_location(record)

Get the log of the arithmetic mean of a record with its standard error.

Parameters:

Name Type Description Default
record Record

the record of a group.

required

Returns:

Type Description
LogLocation | str

ln(mean) with the standard error CV/sqrt(n) (the CV imputed from

LogLocation | str

its measurement or kind without an SD), or the reason why the record

LogLocation | str

has none.

study_estimate

study_estimate(study, kind, entity, condition)

Get the estimate of a study of the log ratio of a condition to its control.

Parameters:

Name Type Description Default
study Study

the study.

required
kind str

the kind of measurement.

required
entity str

the gene symbol.

required
condition Mapping[str, str]

the fields the groups must have, e.g. {"condition": "cirrhosis", "child_pugh": "C"}.

required

Returns:

Type Description
Estimate | None

The estimate, None if the study has no usable group of the

list[Exclusion]

condition or no usable control, and the records it excludes.

random_effects

random_effects(estimates)

Pool estimates by the random-effects meta-analysis of DerSimonian and Laird.

Parameters:

Name Type Description Default
estimates Sequence[Estimate]

the estimates of the studies, at least one.

required

Returns:

Type Description
float

(mu, se, tau2, q, i2): the pooled log ratio, its standard error, the

float

between-study variance, Cochran's Q and I^2 (None for one study).

Raises:

Type Description
ValueError

without an estimate.

consensus

consensus(
    entity, condition, *, kind="protein", tissue="liver"
)

Get the consensus of the studies on the ratio of a condition to the control.

Parameters:

Name Type Description Default
entity str

the gene symbol, e.g. CYP3A4.

required
condition Mapping[str, str]

the fields of the groups, e.g. {"condition": "cirrhosis", "child_pugh": "C"}.

required
kind str

the kind of measurement, a key of KINDS.

'protein'
tissue str

the tissue.

'liver'

Returns:

Type Description
Consensus | None

The consensus, None if no study reports the condition and its control.

Raises:

Type Description
ValueError

for an unknown kind.

factor

factor(
    entity,
    condition,
    *,
    tissue="liver",
    kinds=("protein", "mrna"),
)

Get the consensus factor of a condition, the protein first.

Parameters:

Name Type Description Default
entity str

the gene symbol.

required
condition Mapping[str, str]

the fields of the groups.

required
tissue str

the tissue.

'liver'
kinds Sequence[str]

the kinds in their order of preference: the mRNA expression is used only without a protein abundance of the condition.

('protein', 'mrna')

Returns:

Type Description
Consensus | None

The consensus of the first kind with an estimate, None without.

entities

entities(
    kind="protein", tissue="liver", condition="cirrhosis"
)

Get the entities with records of a condition.

Parameters:

Name Type Description Default
kind str

the kind of measurement.

'protein'
tissue str

the tissue.

'liver'
condition str

the condition of the groups.

'cirrhosis'

Returns:

Type Description
list[str]

The gene symbols, sorted.

level

level(
    entity, condition, *, kind="physiology", tissue="body"
)

Get the consensus of the studies on the level of a quantity in a condition.

The level of a study is the mean (or the median) of its group of the condition, its strata pooled by their inverse variance; the levels of the studies are pooled by the random-effects meta-analysis of DerSimonian and Laird on the linear scale, e.g. the MELD score of the Child-Pugh classes.

Parameters:

Name Type Description Default
entity str

the entity, a quantity of the kind physiology (e.g. meld).

required
condition Mapping[str, str]

the fields of the groups, e.g. {"condition": "control"}.

required
kind str

the kind of measurement.

'physiology'
tissue str

the tissue, body for the quantities of the subjects.

'body'

Returns:

Type Description
Level | None

The level, None if no study reports the quantity in the condition.

Raises:

Type Description
ValueError

for an unknown kind, or levels of several units.