Command line interface#
Pharmpy has a command line interface for some of its functionality. The command line tool is an integrated part of the Pharmpy python package.
The main command is `pharmpy`
and the functionality is divided into subcommands with two levels. The first and top level most often represents a type of object to perform on operation on. For example `model`
or `data`
. (The built in help system will give an overview of available subcommands with `pharmpy -h`
. The second level is most often an operation or verb to perform. After the main command and the two subcommands follows the input and options of the particular command.
pharmpy#
Welcome to the command line interface of Pharmpy!
- Functionality is split into various subcommands
try –help after a COMMAND
all keyword arguments can be abbreviated if unique
usage: pharmpy [-h] [--version] COMMAND ...
- -h, --help#
show this help message and exit
- --version#
show program’s version number and exit
- Examples:
# Create 100 bootstrap datasets pharmpy data resample pheno_real.mod –resamples=100 –replace
# prettyprint model pharmpy model print pheno_real.mod
# version/install information pharmpy info
pharmpy data#
usage: pharmpy data [-h] ACTION ...
- -h, --help#
show this help message and exit
pharmpy data append#
Append a column to dataset given an assignment expression.The expression can contain already present columns of the dataset.
usage: pharmpy data append [-h] [-f] [-o file] FILE expression
- file#
input model or dataset file
- expression#
- -h, --help#
show this help message and exit
- -f, --force#
remove existing destination files (all)
- -o <file>, --output_file <file>#
output file
pharmpy data deidentify#
Deidentify dataset by renumbering the id column and changing dates.
usage: pharmpy data deidentify [-h] [-f] [-o file] [--idcol COLUMN]
[--datecols COLUMNS]
FILE
- file#
A csv file dataset
- -h, --help#
show this help message and exit
- -f, --force#
remove existing destination files (all)
- -o <file>, --output_file <file>#
output file
- --idcol <column>#
id column name (default ID)
- --datecols <columns>#
Comma separated list of date column names
pharmpy data filter#
Filter rows of dataset via expressions. All rows matching all expressions will be kept.abs A new model with the filtered dataset connected is created.
usage: pharmpy data filter [-h] [-f] [-o file] FILE ...
- file#
input model or dataset file
- expressions#
- -h, --help#
show this help message and exit
- -f, --force#
remove existing destination files (all)
- -o <file>, --output_file <file>#
output file
pharmpy data print#
Print whole dataset or selected columns from model or csv file via a pager to stdout. For NM-TRAN models the dataset will be filtered first.
usage: pharmpy data print [-h] [--columns COLUMNS] FILE
- file#
input model or dataset file
- -h, --help#
show this help message and exit
- --columns <columns>#
Select specific columns (default is all)
pharmpy data reference#
Set values in specific columns to provided reference values
usage: pharmpy data reference [-h] [-f] [-o file]
FILE COLNAME=VALUE [COLNAME=VALUE ...]
- file#
input model file
- colname=value#
List of pairs of column names and reference values
- -h, --help#
show this help message and exit
- -f, --force#
remove existing destination files (all)
- -o <file>, --output_file <file>#
output file
pharmpy data resample#
Bootstrap resample datasetsMultiple new models and datasets will be created
usage: pharmpy data resample [-h] [--seed INTEGER] [--group COLUMN]
[--resamples NUMBER] [--stratify COLUMN]
[--replace] [--sample_size NUMBER]
FILE
- file#
input model or dataset file
- -h, --help#
show this help message and exit
- --seed <integer>#
Provide a random seed. The seed must be an integer between 0 and 2^32 - 1
- --group <column>#
Column to use for grouping (default is ID)
- --resamples <number>#
Number of resampled datasets (default 1)
- --stratify <column>#
Column to use for stratification
- --replace#
Sample with replacement (default is without)
- --sample_size <number>#
Number of groups to sample for each resample
pharmpy data write#
Write a dataset from model as the model sees it. For NM-TRAN models this means to filter all IGNORE and ACCEPT statements in $DATA and to convert the dataset to csv format.
usage: pharmpy data write [-h] [-f] [-o file] FILE
- file#
input model file
- -h, --help#
show this help message and exit
- -f, --force#
remove existing destination files (all)
- -o <file>, --output_file <file>#
output file
pharmpy info#
usage: pharmpy info [-h]
- -h, --help#
show this help message and exit
pharmpy model#
usage: pharmpy model [-h] ACTION ...
- -h, --help#
show this help message and exit
pharmpy model print#
Print an overview of a model.
usage: pharmpy model print [-h] [--explicit-odes] FILE [FILE ...]
- file#
input model files
- -h, --help#
show this help message and exit
- --explicit-odes#
Print the ODE system explicitly instead of as a compartmental graph
pharmpy model sample#
Sample parameter initial estimates using uncertainty givenby covariance matrix.
usage: pharmpy model sample [-h] [--seed INTEGER] [--samples NUMBER] FILE
- file#
input model file
- -h, --help#
show this help message and exit
- --seed <integer>#
Provide a random seed. The seed must be an integer between 0 and 2^32 - 1
- --samples <number>#
Number of sampled models
pharmpy model update_inits#
Update inits using modelfit results.
usage: pharmpy model update_inits [-h] [-f] [-o file] FILE
- file#
input model file
- -h, --help#
show this help message and exit
- -f, --force#
remove existing destination files (all)
- -o <file>, --output_file <file>#
output file
pharmpy results#
usage: pharmpy results [-h] ACTION ...
- -h, --help#
show this help message and exit
pharmpy results bootstrap#
Generate results from a PsN bootstrap run
usage: pharmpy results bootstrap [-h] PsN directory
- psn directory#
Path to PsN bootstrap run directory
- -h, --help#
show this help message and exit
pharmpy results cdd#
Generate results from a PsN cdd run
usage: pharmpy results cdd [-h] PsN directory
- psn directory#
Path to PsN cdd run directory
- -h, --help#
show this help message and exit
pharmpy results frem#
Generate results from a PsN frem run
usage: pharmpy results frem [-h] [--method {cov_sampling,bipp}]
[--force_posdef_covmatrix]
[--force_posdef_samples FORCE_POSDEF_SAMPLES]
PsN directory
- psn directory#
Path to PsN frem run directory
- -h, --help#
show this help message and exit
- --method {cov_sampling,bipp}#
Method to use for uncertainty of covariate effects
- --force_posdef_covmatrix#
Should covariance matrix be forced to become positive definite
- --force_posdef_samples <force_posdef_samples>#
Number of sampling tries to do before starting to force posdef
pharmpy results linearize#
Generate results from a PsN linearize run
usage: pharmpy results linearize [-h] PsN directory
- psn directory#
Path to PsN linearize run directory
- -h, --help#
show this help message and exit
pharmpy results ofv#
Extract OFVs from one or more model runs
usage: pharmpy results ofv [-h] FILE [FILE ...]
- file#
input model files
- -h, --help#
show this help message and exit
pharmpy results print#
Print results from PsN run to stdout
usage: pharmpy results print [-h] file or directory
- file or directory#
Path to directory containing results.json or directly to json results file
- -h, --help#
show this help message and exit
pharmpy results qa#
Generate results from a PsN qa run
usage: pharmpy results qa [-h] PsN directory
- psn directory#
Path to PsN qa run directory
- -h, --help#
show this help message and exit
pharmpy results report#
Generate results report for PsN run (currently only frem)
usage: pharmpy results report [-h] PsN directory
- psn directory#
Path to PsN run directory
- -h, --help#
show this help message and exit
pharmpy results ruvsearch#
Generate results from a PsN ruvsearch run
usage: pharmpy results ruvsearch [-h] PsN directory
- psn directory#
Path to PsN ruvsearch run directory
- -h, --help#
show this help message and exit
pharmpy results scm#
Generate results from a PsN scm run
usage: pharmpy results scm [-h] PsN directory
- psn directory#
Path to PsN scm run directory
- -h, --help#
show this help message and exit
pharmpy results simeval#
Generate results from a PsN simeval run
usage: pharmpy results simeval [-h] PsN directory
- psn directory#
Path to PsN simeval run directory
- -h, --help#
show this help message and exit
pharmpy results summary#
Print a summary of a model estimates to stdout.
usage: pharmpy results summary [-h] FILE [FILE ...]
- file#
input model files
- -h, --help#
show this help message and exit
pharmpy run#
usage: pharmpy run [-h] TOOL ...
- -h, --help#
show this help message and exit
pharmpy run allometry#
usage: pharmpy run allometry [-h] [--allometric_variable ALLOMETRIC_VARIABLE]
[--reference_value REFERENCE_VALUE]
[--parameters PARAMETERS] [--initials INITIALS]
[--lower_bounds LOWER_BOUNDS]
[--upper_bounds UPPER_BOUNDS] [--non_fixed]
[--path PATH]
FILE
- file#
input model file
- -h, --help#
show this help message and exit
- --allometric_variable <allometric_variable>#
Name of the allometric variable
- --reference_value <reference_value>#
Reference value for the allometric variable
- --parameters <parameters>#
List of parameters to apply scaling to
- --initials <initials>#
Initial estimates for the exponents
- --lower_bounds <lower_bounds>#
Lower bounds for the exponents
- --upper_bounds <upper_bounds>#
Upper bounds for the exponents
- --non_fixed#
Should the exponents not be fixed
- --path <path>#
Path to output directory
pharmpy run amd#
usage: pharmpy run amd [-h] [--modeltype MODELTYPE]
[--administration ADMINISTRATION] [--cl_init CL_INIT]
[--vc_init VC_INIT] [--mat_init MAT_INIT]
[--search_space SEARCH_SPACE]
[--lloq_method LLOQ_METHOD] [--lloq_limit LLOQ_LIMIT]
[--order ORDER]
[--allometric_variable ALLOMETRIC_VARIABLE]
[--occasion OCCASION] [--path PATH] [--resume RESUME]
input_path
- input_path#
Path to output directory
- -h, --help#
show this help message and exit
- --modeltype <modeltype>#
Type of model to build. Currently only “basic_pk”
- --administration <administration>#
Type of model to build. One of “iv”, “oral” or “ivoral”
- --cl_init <cl_init>#
Initial estimate for the population clearance
- --vc_init <vc_init>#
Initial estimate for the central compartment population volume
- --mat_init <mat_init>#
Initial estimate for the mean absorption time (not for iv models)
- --search_space <search_space>#
MFL for search space for structural model
- --lloq_method <lloq_method>#
Method for how to remove LOQ data. See transform_blq for list of available methods
- --lloq_limit <lloq_limit>#
Lower limit of quantification. If None LLOQ column from dataset will be used
- --order <order>#
Runorder of components
- --allometric_variable <allometric_variable>#
Variable to use for allometry
- --occasion <occasion>#
Name of occasion column
- --path <path>#
Path to run AMD in
- --resume <resume>#
Whether to allow resuming previous run
pharmpy run bootstrap#
usage: pharmpy run bootstrap [-h] [--samples SAMPLES] FILE
- file#
input model file
- -h, --help#
show this help message and exit
- --samples <samples>#
Number of bootstrap datasets
pharmpy run covsearch#
usage: pharmpy run covsearch [-h] [--effects EFFECTS] [--p_forward P_FORWARD]
[--p_backward P_BACKWARD] [--max_steps MAX_STEPS]
[--algorithm ALGORITHM] [--path PATH]
FILE
- file#
input model file
- -h, --help#
show this help message and exit
- --effects <effects>#
The candidate effects to search through (required)
- --p_forward <p_forward>#
The p-value threshold for forward steps (default is 0.05)
- --p_backward <p_backward>#
The p-value threshold for backward steps (default is 0.01)
- --max_steps <max_steps>#
The maximum number of search algorithm steps to perform, or -1 for no maximum (default).
- --algorithm <algorithm>#
The search algorithm to use (default is ‘scm-forward-then-backward’)
- --path <path>#
Path to output directory
pharmpy run estmethod#
usage: pharmpy run estmethod [-h] [--methods METHODS] [--solvers SOLVERS]
[--path PATH]
FILE algorithm
- file#
input model file
- algorithm#
Algorithm to use
- -h, --help#
show this help message and exit
- --methods <methods>#
List of methods to try, mark group of methods in single quote separated by spaces. Supported are: FOCE, FO, IMP, IMPMAP, ITS, SAEM, LAPLACE, BAYES, or ‘all’. Default is None.
- --solvers <solvers>#
List of solvers to try, mark group of methods in single quote separated by spaces. Supported are: CVODES (ADVAN14), DGEAR (ADVAN8), DVERK (ADVAN6), IDA (ADVAN15), LSODA (ADVAN13) and LSODI (ADVAN9), or ‘all’. Default is None.
- --path <path>#
Path to output directory
pharmpy run execute#
usage: pharmpy run execute [-h] FILE [FILE ...]
- file#
input model files
- -h, --help#
show this help message and exit
pharmpy run iivsearch#
usage: pharmpy run iivsearch [-h] [--iiv_strategy IIV_STRATEGY]
[--rank_type RANK_TYPE] [--cutoff CUTOFF]
[--path PATH]
FILE algorithm
- file#
input model file
- algorithm#
Algorithm to use
- -h, --help#
show this help message and exit
- --iiv_strategy <iiv_strategy>#
If/how IIV should be added to start model
- --rank_type <rank_type>#
Name of function to use for ranking candidates (default is bic).
- --cutoff <cutoff>#
Which selection criteria to rank models on
- --path <path>#
Path to output directory
pharmpy run iovsearch#
usage: pharmpy run iovsearch [-h] [--column COLUMN]
[--list_of_parameters LIST_OF_PARAMETERS]
[--rank_type RANK_TYPE] [--cutoff CUTOFF]
[--distribution DISTRIBUTION] [--path PATH]
FILE
- file#
input model file
- -h, --help#
show this help message and exit
- --column <column>#
Name of column in dataset to use as occasion column (default is “OCC”)
- --list_of_parameters <list_of_parameters>#
List of parameters to test IOV on
- --rank_type <rank_type>#
Name of function to use for ranking candidates (default is bic).
- --cutoff <cutoff>#
Which selection criteria to rank models on
- --distribution <distribution>#
Which distribution added IOVs should have (default is same-as-iiv)
- --path <path>#
Path to output directory
pharmpy run modelsearch#
usage: pharmpy run modelsearch [-h] [--rank_type RANK_TYPE] [--cutoff CUTOFF]
[--iiv_strategy IIV_STRATEGY] [--path PATH]
FILE mfl algorithm
- file#
input model file
- mfl#
Search space to test
- algorithm#
Algorithm to use
- -h, --help#
show this help message and exit
- --rank_type <rank_type>#
Name of function to use for ranking candidates (default is bic).
- --cutoff <cutoff>#
Which selection criteria to rank models on
- --iiv_strategy <iiv_strategy>#
If/how IIV should be added to candidate models
- --path <path>#
Path to output directory
pharmpy run ruvsearch#
usage: pharmpy run ruvsearch [-h] [--groups GROUPS] [--p_value P_VALUE]
[--skip SKIP] [--path PATH]
FILE
- file#
input model file
- -h, --help#
show this help message and exit
- --groups <groups>#
Number of groups for the time varying models
- --p_value <p_value>#
p_value to use for the likelihood ratio test
- --skip <skip>#
List of models to not test
- --path <path>#
Path to output directory