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 psn#
usage: pharmpy psn [-h] ACTION ...
- -h, --help#
show this help message and exit
pharmpy psn bootstrap#
Generate results from a PsN bootstrap run
usage: pharmpy psn bootstrap [-h] PsN directory
- psn directory#
Path to PsN bootstrap run directory
- -h, --help#
show this help message and exit
pharmpy psn cdd#
Generate results from a PsN cdd run
usage: pharmpy psn cdd [-h] PsN directory
- psn directory#
Path to PsN cdd run directory
- -h, --help#
show this help message and exit
pharmpy psn frem#
Generate results from a PsN frem run
usage: pharmpy psn 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 psn linearize#
Generate results from a PsN linearize run
usage: pharmpy psn linearize [-h] PsN directory
- psn directory#
Path to PsN linearize run directory
- -h, --help#
show this help message and exit
pharmpy psn print#
Print results from PsN run to stdout
usage: pharmpy psn 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 psn qa#
Generate results from a PsN qa run
usage: pharmpy psn qa [-h] PsN directory
- psn directory#
Path to PsN qa run directory
- -h, --help#
show this help message and exit
pharmpy psn report#
Generate results report for PsN run (currently only frem)
usage: pharmpy psn report [-h] PsN directory
- psn directory#
Path to PsN run directory
- -h, --help#
show this help message and exit
pharmpy psn ruvsearch#
Generate results from a PsN ruvsearch run
usage: pharmpy psn ruvsearch [-h] PsN directory
- psn directory#
Path to PsN ruvsearch run directory
- -h, --help#
show this help message and exit
pharmpy psn scm#
Generate results from a PsN scm run
usage: pharmpy psn scm [-h] PsN directory
- psn directory#
Path to PsN scm run directory
- -h, --help#
show this help message and exit
pharmpy psn simeval#
Generate results from a PsN simeval run
usage: pharmpy psn simeval [-h] PsN directory
- psn directory#
Path to PsN simeval run directory
- -h, --help#
show this help message and exit
pharmpy results#
usage: pharmpy results [-h] ACTION ...
- -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 variable to use for allometric scaling
- --reference_value <reference_value>#
Reference value for the allometric variable
- --parameters <parameters>#
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] [--results RESULTS] [--modeltype MODELTYPE]
[--administration ADMINISTRATION] [--strategy STRATEGY]
[--cl_init CL_INIT] [--vc_init VC_INIT]
[--mat_init MAT_INIT] [--b_init B_INIT]
[--emax_init EMAX_INIT] [--ec50_init EC50_INIT]
[--met_init MET_INIT] [--search_space SEARCH_SPACE]
[--lloq_method LLOQ_METHOD] [--lloq_limit LLOQ_LIMIT]
[--allometric_variable ALLOMETRIC_VARIABLE]
[--occasion OCCASION] [--strictness STRICTNESS]
[--dv_types COLNAME=VALUE [COLNAME=VALUE ...]]
[--mechanistic_covariates MECHANISTIC_COVARIATES]
[--retries_strategy RETRIES_STRATEGY] [--seed SEED]
[--parameter_uncertainty_method PARAMETER_UNCERTAINTY_METHOD]
[--ignore_datainfo_fallback IGNORE_DATAINFO_FALLBACK]
[--resume RESUME] [--path PATH]
FILE
- file#
input model or dataset file
- -h, --help#
show this help message and exit
- --results <results>#
Reults of input if input is a model
- --modeltype <modeltype>#
Type of model to build. Valid strings are “basic_pk”, “pkpd”, “drug_metabolite” and “tmdd”
- --administration <administration>#
Route of administration. Either “iv”, “oral” or “ivoral”
- --strategy <strategy>#
Run algorithm for AMD procedure. Valid options are “default”, “reevaluation”
- --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)
- --b_init <b_init>#
Initial estimate for the baseline (PKPD model)
- --emax_init <emax_init>#
Initial estimate for E_max (PKPD model)
- --ec50_init <ec50_init>#
Initial estimate for EC_50 (PKPD model)
- --met_init <met_init>#
Initial estimate for mean equilibration time (PKPD model)
- --search_space <search_space>#
MFL for search space for structural and covariate model
- --lloq_method <lloq_method>#
Method for how to remove LOQ data
- --lloq_limit <lloq_limit>#
Lower limit of quantification. If None LLOQ column from dataset will be used
- --allometric_variable <allometric_variable>#
Variable to use for allometry
- --occasion <occasion>#
Name of occasion column
- --strictness <strictness>#
Strictness criteria
- --dv_types <colname=value>#
- --mechanistic_covariates <mechanistic_covariates>#
List of covariates or tuple of covariate and parameter combination to run in a separate proioritized covsearch run
- --retries_strategy <retries_strategy>#
Whether or not to run retries tool
- --seed <seed>#
Seed to be used
- --parameter_uncertainty_method <parameter_uncertainty_method>#
Parameter uncertainty method
- --ignore_datainfo_fallback <ignore_datainfo_fallback>#
Ignore using datainfo to get information not given by the user
- --resume <resume>#
Whether to allow resuming previous run
- --path <path>#
Path to run AMD in
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] [--search_space SEARCH_SPACE]
[--p_forward P_FORWARD] [--p_backward P_BACKWARD]
[--max_steps MAX_STEPS] [--algorithm ALGORITHM]
[--max_eval MAX_EVAL]
[--adaptive_scope_reduction ADAPTIVE_SCOPE_REDUCTION]
[--strictness STRICTNESS]
[--naming_index_offset NAMING_INDEX_OFFSET]
[--path PATH]
FILE
- file#
input model file
- -h, --help#
show this help message and exit
- --search_space <search_space>#
MFL of covariate effects to try
- --p_forward <p_forward>#
The p-value to use in the likelihood ratio test for forward steps
- --p_backward <p_backward>#
The p-value to use in the likelihood ratio test for backward steps
- --max_steps <max_steps>#
The maximum number of search steps to make
- --algorithm <algorithm>#
The search algorithm to use
- --max_eval <max_eval>#
Limit the number of function evaluations to 3.1 times that of the base model
- --adaptive_scope_reduction <adaptive_scope_reduction>#
Stash all non-significant parameter-covariate effects to be tested after all significant effects have been tested. Once all these have been tested, try adding the stashed effects once more with a regular forward approach
- --strictness <strictness>#
Strictness criteria
- --naming_index_offset <naming_index_offset>#
Index offset for naming of runs
- --path <path>#
Path to output directory
pharmpy run estmethod#
usage: pharmpy run estmethod [-h] [--methods METHODS] [--solvers SOLVERS]
[--parameter_uncertainty_methods PARAMETER_UNCERTAINTY_METHODS]
[--path PATH]
FILE algorithm compare_ofv
- file#
input model file
- algorithm#
Algorithm to use
- compare_ofv#
Whether to compare the OFV between candidates
- -h, --help#
show this help message and exit
- --methods <methods>#
List of estimation methods to test. Can be specified as “all”, a list of estimation methods, or not specify (to not test any estimation method)
- --solvers <solvers>#
List of solvers to test. Can be specified as “all”, a list of solvers, or not specify (to not test any solver)
- --parameter_uncertainty_methods <parameter_uncertainty_methods>#
List of parameter uncertainty methods to test. Can be specified as “all”, a list of uncertainty methods, or not specify (to not test any uncertainty method)
- --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] [--algorithm ALGORITHM]
[--iiv_strategy IIV_STRATEGY]
[--rank_type RANK_TYPE] [--cutoff CUTOFF]
[--linearize] [--keep KEEP]
[--strictness STRICTNESS]
[--correlation_algorithm CORRELATION_ALGORITHM]
[--e_p E_P] [--e_q E_Q] [--path PATH]
FILE
- file#
input model file
- -h, --help#
show this help message and exit
- --algorithm <algorithm>#
Which algorithm to run when determining number of IIVs
- --iiv_strategy <iiv_strategy>#
If/how IIV should be added to start model
- --rank_type <rank_type>#
Which ranking type should be used
- --cutoff <cutoff>#
Cutoff for which value of the ranking function that is considered significant
- --linearize#
Whether or not use linearization when running the tool
- --keep <keep>#
List of IIVs to keep
- --strictness <strictness>#
Strictness criteria
- --correlation_algorithm <correlation_algorithm>#
Which algorithm to run for the determining block structure of added IIVs
- --e_p <e_p>#
Expected number of predictors for diagonal elements (used for mBIC)
- --e_q <e_q>#
Expected number of predictors for off-diagonal elements (used for mBIC)
- --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]
[--strictness STRICTNESS] [--e E] [--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 (if not specified, allparameters with IIV will be tested)
- --rank_type <rank_type>#
Which ranking type should be used
- --cutoff <cutoff>#
Cutoff for which value of the ranking function that is considered significant
- --distribution <distribution>#
Which distribution added IOVs should have (default is same-as-iiv)
- --strictness <strictness>#
Strictness criteria
- --e <e>#
Expected number of predictors (used for mBIC)
- --path <path>#
Path to output directory
pharmpy run linearize#
usage: pharmpy run linearize [-h] [--path PATH] FILE
- file#
input model file
- -h, --help#
show this help message and exit
- --path <path>#
Path to output directory
pharmpy run modelsearch#
usage: pharmpy run modelsearch [-h] [--iiv_strategy IIV_STRATEGY]
[--rank_type RANK_TYPE] [--cutoff CUTOFF]
[--strictness STRICTNESS] [--e E] [--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
- --iiv_strategy <iiv_strategy>#
If/how IIV should be added to candidate models
- --rank_type <rank_type>#
Which ranking type should be used
- --cutoff <cutoff>#
Cutoff for which value of the ranking function that is considered significant
- --strictness <strictness>#
Strictness criteria
- --e <e>#
Expected number of predictors (used for mBIC)
- --path <path>#
Path to output directory
pharmpy run ruvsearch#
usage: pharmpy run ruvsearch [-h] [--groups GROUPS] [--p_value P_VALUE]
[--skip SKIP] [--max_iter MAX_ITER] [--dv DV]
[--strictness STRICTNESS] [--path PATH]
FILE
- file#
input model file
- -h, --help#
show this help message and exit
- --groups <groups>#
The number of bins to use for the time varying models
- --p_value <p_value>#
The p-value to use for the likelihood ratio test
- --skip <skip>#
List of models to not test
- --max_iter <max_iter>#
Number of iterations to run (1, 2, or 3)
- --dv <dv>#
Which DV to assess the error model for
- --strictness <strictness>#
Strictness criteria
- --path <path>#
Path to output directory