Title: | Create Pharmacometric Models |
---|---|
Description: | Provides a user interface to create or modify pharmacometric models for various modeling and simulation software platforms. |
Authors: | Sebastien Bihorel [cre, aut] |
Maintainer: | Sebastien Bihorel <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.4 |
Built: | 2024-11-20 06:23:21 UTC |
Source: | CRAN |
Auto indent mrgsolve code
align_annotations(code)
align_annotations(code)
code |
Code lines containing comments to align across |
Auto indent NONMEM code tags
align_tags(code)
align_tags(code)
code |
Code lines containing comments to align across |
See shiny::isTruthy
for details.
areTruthy(...)
areTruthy(...)
... |
Any object |
TRUE if all objects are "truthy", FALSE if at least one is not.
Check covariate definition table
check_covariate_table(table = NULL, check_step = FALSE)
check_covariate_table(table = NULL, check_step = FALSE)
table |
a data.frame with expected columns |
check_step |
a logical indicator to check content of Step column or not |
Check if covariate definition table contains rows with incomplete data
check_incomplete_covariate_table(table)
check_incomplete_covariate_table(table)
table |
a data.frame with expected columns |
Convert reference code for univariate model creation
convert_reference_code(code)
convert_reference_code(code)
code |
A character string containing NONMEM code |
Generate univariate model code
create_univariate_models( code, referenceName, nThetas, table, style, prefix, startNumber, path )
create_univariate_models( code, referenceName, nThetas, table, style, prefix, startNumber, path )
code |
A character string containing the code of the reference NONMEM model |
referenceName |
The name of the reference model file |
nThetas |
The number of THETA parameters in the reference NONMEM model |
table |
The table of covariate relationship definition |
style |
Either PsN or standard |
prefix |
If standard style, the prefix to start the name of the univariable model file with |
startNumber |
If PsN style, the number to start univariate model run files |
path |
The directory in which the univariate models will be saved and run |
Determines if a file path exists
file_exists(file)
file_exists(file)
file |
a path to a file |
Creation of model code
get_code( input = NULL, template = NULL, vars, advan, trans, isPRED, isODE, isLINMAT, isPREDPP, varianceTable, covarianceBlock, rvTable, parm_lib, model_lib, rv_lib, scaling, replacement = TRUE )
get_code( input = NULL, template = NULL, vars, advan, trans, isPRED, isODE, isLINMAT, isPREDPP, varianceTable, covarianceBlock, rvTable, parm_lib, model_lib, rv_lib, scaling, replacement = TRUE )
input |
Internal parameter for |
template |
Text template |
vars |
Reactive object - List of variables in data file |
advan |
Reactive object - NONMEM ADVAN value |
trans |
Reactive object - NONMEM TRANS value |
isPRED |
Reactive object - is model coded with $PRED? |
isODE |
Reactive object - is model coded with ODEs? |
isLINMAT |
Reactive object - is model coded as linear matrix? |
isPREDPP |
Reactive object - is mode coded with $PK? |
varianceTable |
Variance- table |
covarianceBlock |
Variance-covariance matrix |
rvTable |
Reactive object - residual variability matrix |
parm_lib |
Library of parameters |
model_lib |
Library for $MODEL replacement |
rv_lib |
Library for residual variability replacement |
scaling |
Library for scaling |
replacement |
Logical value indicating with replacement is required |
Convert of covariance matrix into a 0/1 correlation map table
get_correlation_table(x, na_zero = FALSE)
get_correlation_table(x, na_zero = FALSE)
x |
A covariance matrix |
na_zero |
Logical indicating whether NA should be replaced by 0's |
A matrix of 0 and 1
Get lines of code for derived parameters
get_derived_parms_code( input, advan, trans, isPRED, isODE, isLINMAT, parms, parm_lib )
get_derived_parms_code( input, advan, trans, isPRED, isODE, isLINMAT, parms, parm_lib )
input |
Internal parameter for |
advan |
Reactive object - NONMEM ADVAN value |
trans |
Reactive object - NONMEM TRANS value |
isPRED |
Reactive object - is model coded with $PRED? |
isODE |
Reactive object - is model coded with ODEs? |
isLINMAT |
Reactive object - is model coded as linear matrix? |
parms |
Parameter selection |
parm_lib |
Library of parameters |
Get line of code for individual parameter value
get_individual_parm_code(parms, varianceTable, iparm, ieta, mu)
get_individual_parm_code(parms, varianceTable, iparm, ieta, mu)
parms |
Parameter selection |
varianceTable |
Variability selection |
iparm |
Index of parameter in parms data frame |
ieta |
Index of ETA associated with parameter |
mu |
A logical indicator for mu transformation |
Get compartment intialization block
get_init_code(input, advan, trans, nPKcmts, nPDcmts, parm_lib)
get_init_code(input, advan, trans, nPKcmts, nPDcmts, parm_lib)
input |
Internal parameter for |
advan |
Reactive object - NONMEM ADVAN value |
trans |
Reactive object - NONMEM TRANS value |
nPKcmts , nPDcmts
|
Number of compartments for PK and PD model components |
parm_lib |
Library of parameters |
Get line of code for individual parameter value
get_mrg_individual_parm_code(parms, iparm, eparm)
get_mrg_individual_parm_code(parms, iparm, eparm)
parms |
Parameter selection |
iparm |
Index of parameter in parms data frame |
eparm |
Parameter associated with IIV in ordered categorical models |
Get mrgsolve model parameter code lines as list
get_mrg_parms_code(input, parms, mu)
get_mrg_parms_code(input, parms, mu)
input |
Internal parameter for |
parms |
Parameter selection |
mu |
A logical indicator for mu transformation |
Creation of mrgsolve code
get_mrgsolve_code( input = NULL, template = NULL, advan, trans, isPRED, isODE, isLINMAT, isPREDPP, varianceTable, covarianceBlock, rvTable, parm_lib, model_lib, rv_lib, scaling, replacement = TRUE )
get_mrgsolve_code( input = NULL, template = NULL, advan, trans, isPRED, isODE, isLINMAT, isPREDPP, varianceTable, covarianceBlock, rvTable, parm_lib, model_lib, rv_lib, scaling, replacement = TRUE )
input |
Internal parameter for |
template |
Text template |
advan |
Reactive object - NONMEM ADVAN value |
trans |
Reactive object - NONMEM TRANS value |
isPRED |
Reactive object - is model coded with $PRED? |
isODE |
Reactive object - is model coded with ODEs? |
isLINMAT |
Reactive object - is model coded as linear matrix? |
isPREDPP |
Reactive object - is mode coded with $PK? |
varianceTable |
Variance- table |
covarianceBlock |
Variance-covariance matrix |
rvTable |
Reactive object - residual variability matrix |
parm_lib |
Library of parameters |
model_lib |
Library for $MODEL replacement |
rv_lib |
Library for residual variability replacement |
scaling |
Library for scaling |
replacement |
Logical value indicating with replacement is required |
Get the number of PK and PD compartments
get_ncmts(input, new, model_lib, isPRED, isPREDPP)
get_ncmts(input, new, model_lib, isPRED, isPREDPP)
input |
Internal parameter for |
new |
Text template |
model_lib |
Library for $MODEL replacement |
isPRED |
Reactive object - is model coded with $PRED? |
isPREDPP |
Reactive object - is mode coded with $PK? |
Process a character string containing NONMEM model code and returns a character vector in which each element contain a particular $ block
get_nonmem_blocks(code)
get_nonmem_blocks(code)
code |
A character string containing the control stream |
Creation of NONMEM code
get_nonmem_code( input = NULL, template = NULL, vars, advan, trans, isPRED, isODE, isLINMAT, isPREDPP, varianceTable, covarianceBlock, rvTable, parm_lib, model_lib, rv_lib, scaling, replacement = TRUE )
get_nonmem_code( input = NULL, template = NULL, vars, advan, trans, isPRED, isODE, isLINMAT, isPREDPP, varianceTable, covarianceBlock, rvTable, parm_lib, model_lib, rv_lib, scaling, replacement = TRUE )
input |
Internal parameter for |
template |
Text template |
vars |
Reactive object - List of variables in data file |
advan |
Reactive object - NONMEM ADVAN value |
trans |
Reactive object - NONMEM TRANS value |
isPRED |
Reactive object - is model coded with $PRED? |
isODE |
Reactive object - is model coded with ODEs? |
isLINMAT |
Reactive object - is model coded as linear matrix? |
isPREDPP |
Reactive object - is mode coded with $PK? |
varianceTable |
Variance- table |
covarianceBlock |
Variance-covariance matrix |
rvTable |
Reactive object - residual variability matrix |
parm_lib |
Library of parameters |
model_lib |
Library for $MODEL replacement |
rv_lib |
Library for residual variability replacement |
scaling |
Library for scaling |
replacement |
Logical value indicating with replacement is required |
Get NONMEM model parameter code lines as list
get_parms_code(input, parms, varianceTable, mu)
get_parms_code(input, parms, varianceTable, mu)
input |
Internal parameter for |
parms |
Parameter selection |
varianceTable |
Variability selection |
mu |
A logical indicator for mu transformation |
Get lines of preamble code for transit compartment absorption model and delayed dosing records
get_preamble_code(input, parms, vars)
get_preamble_code(input, parms, vars)
input |
Internal parameter for |
parms |
Parameter selection |
vars |
Character vector of variable names |
Get code lines for scaling and bioavailability
get_scaling_code(input, advan, trans, parm_lib, scaling)
get_scaling_code(input, advan, trans, parm_lib, scaling)
input |
Internal parameter for |
advan |
Reactive object - NONMEM ADVAN value |
trans |
Reactive object - NONMEM TRANS value |
parm_lib |
Library of parameters |
scaling |
Library for scaling |
Get number of THETA parameters
get_theta_number(code)
get_theta_number(code)
code |
A character string containing the control stream |
Convert covariate handsontable data to R data.frame without factor
hot_to_r_raw(...)
hot_to_r_raw(...)
... |
passed to rhandsontable::hot_to_r |
Determine if a square matrix is of type block, band or error
is_EDB(x)
is_EDB(x)
x |
A square matrix |
Either "error", "band", or "block"
New model module
new_model_server(session, input, output, resources)
new_model_server(session, input, output, resources)
input , output , session
|
Internal parameters for |
resources |
A list of internal resources |
Opposite of areTruthy
notTruthy(...)
notTruthy(...)
... |
Any object |
TRUE if at least one object is not "truthy", FALSE if all are.
Replacement of @ABBREVIATED tag
replace_abbreviated(input, new, vars)
replace_abbreviated(input, new, vars)
input |
Internal parameter for |
new |
Text template |
vars |
Character vector of variable names |
Replacement of @DATA tag
replace_data(input, new)
replace_data(input, new)
input |
Internal parameter for |
new |
Text template |
Replace @DES tag
replace_des(input, new, advan, trans, isODE, vars, nPKcmts, nPDcmts, parm_lib)
replace_des(input, new, advan, trans, isODE, vars, nPKcmts, nPDcmts, parm_lib)
input |
Internal parameter for |
new |
Text template |
advan |
Reactive object - NONMEM ADVAN value |
trans |
Reactive object - NONMEM TRANS value |
isODE |
Reactive object - is model coded with ODEs? |
vars |
Reactive object - List of variables in data file |
nPKcmts |
Number of PK compartments in the model |
nPDcmts |
Number of PD compartments in the model |
parm_lib |
Library of parameters |
Replace @ERROR tag
replace_error( input, new, advan, trans, isPRED, nPKcmts, nPDcmts, parm_lib, rv_lib )
replace_error( input, new, advan, trans, isPRED, nPKcmts, nPDcmts, parm_lib, rv_lib )
input |
Internal parameter for |
new |
Text template |
advan |
Reactive object - NONMEM ADVAN value |
trans |
Reactive object - NONMEM TRANS value |
isPRED |
Reactive object - is model coded with $PRED? |
nPKcmts |
Number of PK compartments in the model |
nPDcmts |
Number of PD compartments in the model |
parm_lib |
Library of parameters |
rv_lib |
Library for residual variability replacement |
Replacement of @INPUT tag
replace_input(input, new, vars)
replace_input(input, new, vars)
input |
Internal parameter for |
new |
Text template |
vars |
Character vector of variable names |
Replace @MODEL tag
replace_model(input, new, model_lib, isPRED, isPREDPP)
replace_model(input, new, model_lib, isPRED, isPREDPP)
input |
Internal parameter for |
new |
Text template |
model_lib |
Library for $MODEL replacement |
isPRED |
Reactive object - is model coded with $PRED? |
isPREDPP |
Reactive object - is mode coded with $PK? |
Replacement of @CAPTURE tag
replace_mrg_capture(input, new, parms)
replace_mrg_capture(input, new, parms)
input |
Internal parameter for |
new |
Text template |
parms |
Parameter selection |
Replacement of @CMT tag
replace_mrg_cmt(input, new, model_lib, isPRED)
replace_mrg_cmt(input, new, model_lib, isPRED)
input |
Internal parameter for |
new |
Text template |
model_lib |
Library for $MODEL replacement |
isPRED |
Reactive object - is model coded with $PRED? |
Replacement of @GLOBAL tag
replace_mrg_global(input, new, advan, trans, nPKcmts, parm_lib)
replace_mrg_global(input, new, advan, trans, nPKcmts, parm_lib)
input |
Internal parameter for |
new |
Text template |
advan |
Reactive object - NONMEM ADVAN value |
trans |
Reactive object - NONMEM TRANS value |
nPKcmts |
Number of compartments for PK |
parm_lib |
Library of parameters |
Replace @MAIN or @PRED tags
replace_mrg_main_pred( input, new, preamble_code, parms_code, derived_parms_code, scaling_code, init_code, isPRED, parms, parm_lib, rv_lib )
replace_mrg_main_pred( input, new, preamble_code, parms_code, derived_parms_code, scaling_code, init_code, isPRED, parms, parm_lib, rv_lib )
input |
Internal parameter for |
new |
Text template |
preamble_code |
Preamble code |
parms_code |
Typical and individual parameter code |
derived_parms_code |
Derived parameter code |
scaling_code |
Dose scaling and bioavailability code |
init_code |
Compartment initialization code |
isPRED |
Reactive object - is model coded with $PRED? |
parms |
Parameter selection |
parm_lib |
Library of parameters |
rv_lib |
Library for residual variability replacement |
Replacement of @ODE tag
replace_mrg_ode(input, new, advan, trans, isODE, nPKcmts, nPDcmts, parm_lib)
replace_mrg_ode(input, new, advan, trans, isODE, nPKcmts, nPDcmts, parm_lib)
input |
Internal parameter for |
new |
Text template |
advan |
Reactive object - NONMEM ADVAN value |
trans |
Reactive object - NONMEM TRANS value |
isODE |
Reactive object - is model coded with ODEs? |
nPKcmts |
Number of PK compartments in the model |
nPDcmts |
Number of PD compartments in the model |
parm_lib |
Library of parameters |
Replacement of @OMEGA tag
replace_mrg_omega(input, new, parms, blocks, nmextImport)
replace_mrg_omega(input, new, parms, blocks, nmextImport)
input |
Internal parameter for |
new |
Text template |
parms |
Parameter selection |
blocks |
Variance - covariance matrix |
nmextImport |
A logical indicating whether NONMEM ext file content should be imported |
Replacement of @PARAM tag
replace_mrg_param(input, new, parms, nmextImport)
replace_mrg_param(input, new, parms, nmextImport)
input |
Internal parameter for |
new |
Text template |
parms |
Parameter selection |
nmextImport |
A logical indicating whether NONMEM ext file content should be imported |
Replacement of @PLUGIN tag
replace_mrg_plugin(input, new)
replace_mrg_plugin(input, new)
input |
Internal parameter for |
new |
Text template |
Replacement of @SIGMA tag
replace_mrg_sigma(input, new, rvTable, nmextImport)
replace_mrg_sigma(input, new, rvTable, nmextImport)
input |
Internal parameter for |
new |
Text template |
rvTable |
Residual variability selection |
nmextImport |
A logical indicating whether NONMEM ext file content should be imported |
Replacement of @TABLE tag
replace_mrg_table( input, new, advan, trans, isPRED, nPKcmts, nPDcmts, parm_lib, rv_lib )
replace_mrg_table( input, new, advan, trans, isPRED, nPKcmts, nPDcmts, parm_lib, rv_lib )
input |
Internal parameter for |
new |
Text template |
advan |
Reactive object - NONMEM ADVAN value |
trans |
Reactive object - NONMEM TRANS value |
isPRED |
Reactive object - is model coded with $PRED? |
nPKcmts |
Number of PK compartments in the model |
nPDcmts |
Number of PD compartments in the model |
parm_lib |
Library of parameters |
rv_lib |
Library for residual variability replacement |
Replacement of @NMEXT tag
replace_nmext(input, new, nmextImport = FALSE)
replace_nmext(input, new, nmextImport = FALSE)
input |
Internal parameter for |
new |
Text template |
nmextImport |
A logical indicating whether NONMEM ext file content should be imported |
Replacement of @OMEGA tag
replace_omega(new, parms, varianceTable, blocks)
replace_omega(new, parms, varianceTable, blocks)
new |
Text template |
parms |
Parameter selection |
varianceTable |
Variability selection |
blocks |
Variance - covariance matrix |
Replacement of @PATH tag
replace_path(input, new)
replace_path(input, new)
input |
Internal parameter for |
new |
Text template |
Replace @PK and @PRED tags
replace_pk_pred( input, new, preamble_code, parms_code, derived_parms_code, scaling_code, init_code, isPRED, parms, varianceTable, parm_lib, rv_lib, mu )
replace_pk_pred( input, new, preamble_code, parms_code, derived_parms_code, scaling_code, init_code, isPRED, parms, varianceTable, parm_lib, rv_lib, mu )
input |
Internal parameter for |
new |
Text template |
preamble_code |
Preamble code |
parms_code |
Typical and individual parameter code |
derived_parms_code |
Derived parameter code |
scaling_code |
Dose scaling and bioavailability code |
init_code |
Compartment initialization code |
isPRED |
Reactive object - is model coded with $PRED? |
parms |
Parameter selection |
varianceTable |
Variability selection |
parm_lib |
Library of parameters |
rv_lib |
Library for residual variability replacement |
mu |
A logical indicator for mu transformation |
Replacement of @PRIOR tag
replace_prior(input, new, parms, varianceTable, estimations)
replace_prior(input, new, parms, varianceTable, estimations)
input |
Internal parameter for |
new |
Text template |
parms |
Parameter selection |
varianceTable |
Variability selection |
estimations |
Table of estimation tasks |
Replacement of @PROB1 and @PROB2 tags
replace_problem(input, new)
replace_problem(input, new)
input |
Internal parameter for |
new |
Text template |
Replacement of @PURPOSE tag
replace_purpose(input, new, varianceTable)
replace_purpose(input, new, varianceTable)
input |
Internal parameter for |
new |
Text template |
varianceTable |
Variance- table |
Replacement of @SIGMA tag
replace_sigma(new, input, rvTable)
replace_sigma(new, input, rvTable)
new |
Text template |
input |
Internal parameter for |
rvTable |
Residual variability selection |
Replacement of @SUBROUTINE tag
replace_subroutine(input, new, advan, trans, isPRED, isODE, isLINMAT)
replace_subroutine(input, new, advan, trans, isPRED, isODE, isLINMAT)
input |
Internal parameter for |
new |
Text template |
advan |
Reactive object - NONMEM ADVAN value |
trans |
Reactive object - NONMEM TRANS value |
isPRED |
Reactive object - is model coded with $PRED? |
isODE |
Reactive object - is model coded with ODEs? |
isLINMAT |
Reactive object - is model coded as linear matrix? |
Replace @TABLE tag
replace_table(input, new, vars)
replace_table(input, new, vars)
input |
Internal parameter for |
new |
Text template |
vars |
Reactive object - List of variables in data file |
Replace $TAGs tag
replace_tags(input, new)
replace_tags(input, new)
input |
Internal parameter for |
new |
Text template |
Replace @TASK tag
replace_task(input, new, estimations, isODE)
replace_task(input, new, estimations, isODE)
input |
Internal parameter for |
new |
Text template |
estimations |
Table of estimation tasks |
isODE |
Reactive object - is model coded with ODEs? |
Replacement of @THETA tag
replace_theta(new, parms)
replace_theta(new, parms)
new |
Text template |
parms |
Parameter selection |
Run the Shiny Application
run_app( onStart = NULL, options = list(launch.browser = TRUE), enableBookmarking = NULL, uiPattern = "/", ... )
run_app( onStart = NULL, options = list(launch.browser = TRUE), enableBookmarking = NULL, uiPattern = "/", ... )
onStart |
A function that will be called before the app is actually run.
This is only needed for |
options |
Named options that should be passed to the |
enableBookmarking |
Can be one of |
uiPattern |
A regular expression that will be applied to each |
... |
arguments to pass to golem_opts. See '?golem::get_golem_options' for more details. |
Starts the PMXcode Shiny application
## Not run: if( interactive() ){ pmxcode::run_app() } ## End(Not run)
## Not run: if( interactive() ){ pmxcode::run_app() } ## End(Not run)
Format variables by lines of 10.
tenvars(x)
tenvars(x)
x |
Character vectors of variables |