Skip to content

data

The study data of a model, collected from the study folders of PK-DB.

The studies of PK-DB are curated in a checkout of pkdb_data: the folder studies holds a folder per substance and in it a folder per study, with the digitized data as hidden .tsv files next to the figures and tables they were read from. A model keeps the subset of the studies it uses in its own data/ folder, so its simulations run without the checkout; collect_tsv_files copies them there from the folder studies_dir() finds.

PKDB_DATA module-attribute

PKDB_DATA = 'PKDB_DATA'

The environment variable with the path of a checkout of pkdb_data.

studies_dir

studies_dir()

Get the folder of the PK-DB studies, studies of a checkout of pkdb_data.

The checkout is the path of the environment variable PKDB_DATA; without the variable it is ../pkdb_data relative to the working directory, i.e. a checkout next to the repository a script runs in.

Returns:

Type Description
Path

The absolute path of the folder studies of the checkout.

Raises:

Type Description
FileNotFoundError

if the folder does not exist; the message names the environment variable and the default location.

collect_tsv_files

collect_tsv_files(
    source_dir, target_dir, filter_study=None
)

Copy the data of the studies of a substance into the data folder of a model.

The data files of a study folder of pkdb_data are its hidden .tsv files (.Boulton1996a_Fig1.tsv); the figures, the tables and the publication are left behind. Every study folder of source_dir which passes filter_study and has data files becomes a folder of the same name in target_dir with copies of them, and every copy is reported on the console.

Parameters:

Name Type Description Default
source_dir Path

the folder of the studies of a substance, e.g. studies_dir() / "albuterol".

required
target_dir Path

the data folder of the model, created if it does not exist (its parent has to).

required
filter_study Callable[[str], bool] | None

decides by the name of a study folder whether the study is collected; all studies by default.

None