Title: | Generic Implementation of a PK/PD Model |
---|---|
Description: | A generic, easy-to-use and expandable implementation of a pharmacokinetic (PK) / pharmacodynamic (PD) model based on the S4 class system. This package allows the user to read/write a pharmacometric model from/to files and adapt it further on the fly in the R environment. For this purpose, this package provides an intuitive API to add, modify or delete equations, ordinary differential equations (ODE's), model parameters or compartment properties (like infusion duration or rate, bioavailability and initial values). Finally, this package also provides a useful export of the model for use with simulation packages 'rxode2' and 'mrgsolve'. This package is designed and intended to be used with package 'campsis', a PK/PD simulation platform built on top of 'rxode2' and 'mrgsolve'. |
Authors: | Nicolas Luyckx [aut, cre] |
Maintainer: | Nicolas Luyckx <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.1.2 |
Built: | 2024-11-26 11:44:25 UTC |
Source: | CRAN |
Add element to list.
add(object, x, ...) ## S4 method for signature 'pmx_list,pmx_element' add(object, x, pos = NULL) ## S4 method for signature 'pmx_list,pmx_list' add(object, x) ## S4 method for signature 'pmx_list,list' add(object, x) ## S4 method for signature 'compartments,compartment_property' add(object, x) ## S4 method for signature 'compartments,compartments' add(object, x) ## S4 method for signature 'parameters,single_array_parameter' add(object, x) ## S4 method for signature 'parameters,double_array_parameter' add(object, x) ## S4 method for signature 'parameters,parameters' add(object, x) ## S4 method for signature 'code_record,model_statement' add(object, x, pos = NULL) ## S4 method for signature 'code_record,code_record' add(object, x) ## S4 method for signature 'code_records,code_records' add(object, x) ## S4 method for signature 'code_records,model_statement' add(object, x, pos = NULL) ## S4 method for signature 'campsis_model,compartment_property' add(object, x) ## S4 method for signature 'campsis_model,parameter' add(object, x) ## S4 method for signature 'campsis_model,code_record' add(object, x) ## S4 method for signature 'campsis_model,model_statement' add(object, x, pos = NULL) ## S4 method for signature 'campsis_model,campsis_model' add(object, x)
add(object, x, ...) ## S4 method for signature 'pmx_list,pmx_element' add(object, x, pos = NULL) ## S4 method for signature 'pmx_list,pmx_list' add(object, x) ## S4 method for signature 'pmx_list,list' add(object, x) ## S4 method for signature 'compartments,compartment_property' add(object, x) ## S4 method for signature 'compartments,compartments' add(object, x) ## S4 method for signature 'parameters,single_array_parameter' add(object, x) ## S4 method for signature 'parameters,double_array_parameter' add(object, x) ## S4 method for signature 'parameters,parameters' add(object, x) ## S4 method for signature 'code_record,model_statement' add(object, x, pos = NULL) ## S4 method for signature 'code_record,code_record' add(object, x) ## S4 method for signature 'code_records,code_records' add(object, x) ## S4 method for signature 'code_records,model_statement' add(object, x, pos = NULL) ## S4 method for signature 'campsis_model,compartment_property' add(object, x) ## S4 method for signature 'campsis_model,parameter' add(object, x) ## S4 method for signature 'campsis_model,code_record' add(object, x) ## S4 method for signature 'campsis_model,model_statement' add(object, x, pos = NULL) ## S4 method for signature 'campsis_model,campsis_model' add(object, x)
object |
list object |
x |
element to add |
... |
extra arguments, unused by this generic list |
pos |
position where x needs to be added in list |
modified list object
Generic function to add a suffix to various objects like parameters, code records, compartment names or a model (all previous objects at the same time). This makes it an extremely powerful function to combine 2 models or more (using function 'add'), that have similar equation, parameter or compartment names.
addSuffix(object, suffix, separator = NULL, ...) ## S4 method for signature 'parameters,character,character' addSuffix(object, suffix, separator = NULL, ...) ## S4 method for signature 'code_records,character,character' addSuffix(object, suffix, separator = NULL, ...) ## S4 method for signature 'code_record,character,character' addSuffix(object, suffix, separator = NULL, ...) ## S4 method for signature 'compartments,character,character' addSuffix(object, suffix, separator = NULL, ...) ## S4 method for signature 'campsis_model,character,character' addSuffix(object, suffix, separator = NULL, ...)
addSuffix(object, suffix, separator = NULL, ...) ## S4 method for signature 'parameters,character,character' addSuffix(object, suffix, separator = NULL, ...) ## S4 method for signature 'code_records,character,character' addSuffix(object, suffix, separator = NULL, ...) ## S4 method for signature 'code_record,character,character' addSuffix(object, suffix, separator = NULL, ...) ## S4 method for signature 'compartments,character,character' addSuffix(object, suffix, separator = NULL, ...) ## S4 method for signature 'campsis_model,character,character' addSuffix(object, suffix, separator = NULL, ...)
object |
generic object |
suffix |
suffix to be appended, single character value |
separator |
separator to use before the suffix, default is the underscore |
... |
extra arguments like 'model' if the changes need to be reflected in the model |
updated object of the same class as the provided object, unless 'model' was specified, in that case the model is returned
As data frame method.
as.data.frame(x, row.names = NULL, optional = FALSE, ...) ## S4 method for signature 'theta,character,logical' as.data.frame(x, row.names = NULL, optional = FALSE, ...) ## S4 method for signature 'omega,character,logical' as.data.frame(x, row.names = NULL, optional = FALSE, ...) ## S4 method for signature 'sigma,character,logical' as.data.frame(x, row.names = NULL, optional = FALSE, ...)
as.data.frame(x, row.names = NULL, optional = FALSE, ...) ## S4 method for signature 'theta,character,logical' as.data.frame(x, row.names = NULL, optional = FALSE, ...) ## S4 method for signature 'omega,character,logical' as.data.frame(x, row.names = NULL, optional = FALSE, ...) ## S4 method for signature 'sigma,character,logical' as.data.frame(x, row.names = NULL, optional = FALSE, ...)
x |
generic object |
row.names |
row names |
optional |
optional |
... |
extra arguments |
data frame
Assert the given character vector is a single character string.
assertSingleCharacterString(x)
assertSingleCharacterString(x)
x |
single character string |
no return value
Auto-detect special variables from NONMEM as compartment properties. Bioavailabilities, infusion durations/rates and lag times will be automatically detected.
autoDetectNONMEM(object, ...) ## S4 method for signature 'campsis_model' autoDetectNONMEM(object, ...)
autoDetectNONMEM(object, ...) ## S4 method for signature 'campsis_model' autoDetectNONMEM(object, ...)
object |
object that has NONMEM special variables to be identified |
... |
extra arguments, unused |
updated object
Create a bioavailability for the specified compartment.
Bioavailability(compartment, rhs = "")
Bioavailability(compartment, rhs = "")
compartment |
compartment index |
rhs |
right-hand side part of the equation |
a bioavailability property
CAMPSIS model class.
model
a list of code records
parameters
model parameters
compartments
model compartments
Create a new CAMPSIS model.
CampsisModel()
CampsisModel()
a CAMPSIS model, empty
Code record class. See this code record as an abstract class. 2 implementations are possible: - properties record (lag, duration, rate & bioavailability properties) - statements record (main, ode & error records)
comment
a comment, single character value
statements
model statements
Create a list of code records.
CodeRecords()
CodeRecords()
an empty list of code records
Create a new comment.
Comment(x)
Comment(x)
x |
comment, single character string |
a comment
Create a compartment.
Compartment(index, name = NA)
Compartment(index, name = NA)
index |
compartment index |
name |
compartment name (without prefix) |
an empty list of compartments
Compartment property class.
compartment
related compartment index
rhs
right-hand side formula
comment
comment if any, single character string
Compartment class.
name
compartment name (without prefix)
index
compartment index
Create a list of compartments
Compartments()
Compartments()
an empty list of compartments
Compartments class.
properties
compartment properties of the compartments defined in this class
Get default element from list.
default(object, ...)
default(object, ...)
object |
list object |
... |
additional arguments |
the default element from list
Delete an element from this list.
delete(object, x) ## S4 method for signature 'pmx_list,pmx_element' delete(object, x) ## S4 method for signature 'pmx_list,integer' delete(object, x) ## S4 method for signature 'compartments,compartment_property' delete(object, x) ## S4 method for signature 'parameters,single_array_parameter' delete(object, x) ## S4 method for signature 'parameters,double_array_parameter' delete(object, x) ## S4 method for signature 'statements_record,model_statement' delete(object, x) ## S4 method for signature 'statements_record,integer' delete(object, x) ## S4 method for signature 'code_records,model_statement' delete(object, x) ## S4 method for signature 'campsis_model,compartment_property' delete(object, x) ## S4 method for signature 'campsis_model,parameter' delete(object, x) ## S4 method for signature 'campsis_model,code_record' delete(object, x) ## S4 method for signature 'campsis_model,model_statement' delete(object, x)
delete(object, x) ## S4 method for signature 'pmx_list,pmx_element' delete(object, x) ## S4 method for signature 'pmx_list,integer' delete(object, x) ## S4 method for signature 'compartments,compartment_property' delete(object, x) ## S4 method for signature 'parameters,single_array_parameter' delete(object, x) ## S4 method for signature 'parameters,double_array_parameter' delete(object, x) ## S4 method for signature 'statements_record,model_statement' delete(object, x) ## S4 method for signature 'statements_record,integer' delete(object, x) ## S4 method for signature 'code_records,model_statement' delete(object, x) ## S4 method for signature 'campsis_model,compartment_property' delete(object, x) ## S4 method for signature 'campsis_model,parameter' delete(object, x) ## S4 method for signature 'campsis_model,code_record' delete(object, x) ## S4 method for signature 'campsis_model,model_statement' delete(object, x)
object |
list object |
x |
element to delete or element index |
the updated list
Disable.
disable(object, x, ...) ## S4 method for signature 'parameters,character' disable(object, x, ...) ## S4 method for signature 'campsis_model,character' disable(object, x, ...)
disable(object, x, ...) ## S4 method for signature 'parameters,character' disable(object, x, ...) ## S4 method for signature 'campsis_model,character' disable(object, x, ...)
object |
generic object |
x |
what needs to be disabled |
... |
extra arguments needed for disabling |
object with some disabled features
Double-array parameter class. This parameter has 2 indexes. It can thus be used to define correlations between parameters.
Create a new equation.
Equation(lhs, rhs = "", comment = as.character(NA))
Equation(lhs, rhs = "", comment = as.character(NA))
lhs |
left-hand side variable corresponding to the assigned variable name |
rhs |
right-hand side expression corresponding to a formula |
comment |
comment if any, single character string |
an equation
Equation class. Any statement in the form A = B.
lhs
left-hand side expression
rhs
right-hand side expression
Create ERROR code record.
ErrorRecord(code = character())
ErrorRecord(code = character())
code |
code record |
an ERROR code record
Export function.
export(object, dest, ...) ## S4 method for signature 'campsis_model,character' export(object, dest, ...) ## S4 method for signature 'campsis_model,rxode_type' export(object, dest, ...) ## S4 method for signature 'campsis_model,mrgsolve_type' export(object, dest, outvars = NULL, extra_params = character(0))
export(object, dest, ...) ## S4 method for signature 'campsis_model,character' export(object, dest, ...) ## S4 method for signature 'campsis_model,rxode_type' export(object, dest, ...) ## S4 method for signature 'campsis_model,mrgsolve_type' export(object, dest, outvars = NULL, extra_params = character(0))
object |
generic object |
dest |
destination |
... |
optional arguments |
outvars |
additional variables to capture |
extra_params |
extra parameter names to be added. By default, they will be assigned a zero value. |
specific object depending on given destination
Extract left-hand-side expression.
extractLhs(x, split = "=")
extractLhs(x, split = "=")
x |
character value |
split |
character where to split |
left-hand-side expression, not trimmed
Extract right-hand-side expression.
extractRhs(x, split = "=")
extractRhs(x, split = "=")
x |
character value |
split |
character where to split |
right-hand side expression
Extract text between brackets.
extractTextBetweenBrackets(x)
extractTextBetweenBrackets(x)
x |
character value |
text between brackets (trimmed)
Find an element in list.
find(object, x) ## S4 method for signature 'pmx_list,pmx_element' find(object, x) ## S4 method for signature 'compartments,compartment_property' find(object, x) ## S4 method for signature 'statements_record,model_statement' find(object, x) ## S4 method for signature 'code_records,model_statement' find(object, x) ## S4 method for signature 'campsis_model,compartment' find(object, x) ## S4 method for signature 'campsis_model,compartment_property' find(object, x) ## S4 method for signature 'campsis_model,parameter' find(object, x) ## S4 method for signature 'campsis_model,code_record' find(object, x) ## S4 method for signature 'campsis_model,model_statement' find(object, x)
find(object, x) ## S4 method for signature 'pmx_list,pmx_element' find(object, x) ## S4 method for signature 'compartments,compartment_property' find(object, x) ## S4 method for signature 'statements_record,model_statement' find(object, x) ## S4 method for signature 'code_records,model_statement' find(object, x) ## S4 method for signature 'campsis_model,compartment' find(object, x) ## S4 method for signature 'campsis_model,compartment_property' find(object, x) ## S4 method for signature 'campsis_model,parameter' find(object, x) ## S4 method for signature 'campsis_model,code_record' find(object, x) ## S4 method for signature 'campsis_model,model_statement' find(object, x)
object |
list object |
x |
element to find, only key slots need to be filled in |
the element from the list that has same name as x, or NULL if no element was found
Fix omega matrix for SAME OMEGA parameters that have NA values due to imperfections in Pharmpy import.
fixOmega(object) ## S4 method for signature 'parameters' fixOmega(object)
fixOmega(object) ## S4 method for signature 'parameters' fixOmega(object)
object |
generic object |
the parameter that matches
Get element by index.
getByIndex(object, x) ## S4 method for signature 'pmx_list,integer' getByIndex(object, x) ## S4 method for signature 'pmx_list,numeric' getByIndex(object, x) ## S4 method for signature 'compartment_properties,compartment_property' getByIndex(object, x) ## S4 method for signature 'parameters,parameter' getByIndex(object, x)
getByIndex(object, x) ## S4 method for signature 'pmx_list,integer' getByIndex(object, x) ## S4 method for signature 'pmx_list,numeric' getByIndex(object, x) ## S4 method for signature 'compartment_properties,compartment_property' getByIndex(object, x) ## S4 method for signature 'parameters,parameter' getByIndex(object, x)
object |
list object |
x |
element index |
element from the list whose index matches with provided index
Get an element from a list by name. Never return more than 1 element.
getByName(object, name) ## S4 method for signature 'pmx_list,character' getByName(object, name)
getByName(object, name) ## S4 method for signature 'pmx_list,character' getByName(object, name)
object |
list object |
name |
element name to search for |
the element that was found or NULL if no element was found with the same name
Get the compartment index for the specified compartment name.
getCompartmentIndex(object, name) ## S4 method for signature 'compartments,character' getCompartmentIndex(object, name) ## S4 method for signature 'campsis_model,character' getCompartmentIndex(object, name)
getCompartmentIndex(object, name) ## S4 method for signature 'compartments,character' getCompartmentIndex(object, name) ## S4 method for signature 'campsis_model,character' getCompartmentIndex(object, name)
object |
generic object that contains compartments information |
name |
compartment name |
the corresponding compartment index
Get element name.
getName(x) ## S4 method for signature 'unknown_statement' getName(x) ## S4 method for signature 'comment' getName(x) ## S4 method for signature 'line_break' getName(x) ## S4 method for signature 'equation' getName(x) ## S4 method for signature 'ode' getName(x) ## S4 method for signature 'if_statement' getName(x) ## S4 method for signature 'compartment' getName(x) ## S4 method for signature 'compartment_bioavailability' getName(x) ## S4 method for signature 'compartment_lag_time' getName(x) ## S4 method for signature 'compartment_infusion_duration' getName(x) ## S4 method for signature 'compartment_infusion_rate' getName(x) ## S4 method for signature 'compartment_initial_condition' getName(x) ## S4 method for signature 'theta' getName(x) ## S4 method for signature 'omega' getName(x) ## S4 method for signature 'sigma' getName(x) ## S4 method for signature 'main_record' getName(x) ## S4 method for signature 'ode_record' getName(x) ## S4 method for signature 'f_record' getName(x) ## S4 method for signature 'lag_record' getName(x) ## S4 method for signature 'duration_record' getName(x) ## S4 method for signature 'rate_record' getName(x) ## S4 method for signature 'init_record' getName(x) ## S4 method for signature 'error_record' getName(x)
getName(x) ## S4 method for signature 'unknown_statement' getName(x) ## S4 method for signature 'comment' getName(x) ## S4 method for signature 'line_break' getName(x) ## S4 method for signature 'equation' getName(x) ## S4 method for signature 'ode' getName(x) ## S4 method for signature 'if_statement' getName(x) ## S4 method for signature 'compartment' getName(x) ## S4 method for signature 'compartment_bioavailability' getName(x) ## S4 method for signature 'compartment_lag_time' getName(x) ## S4 method for signature 'compartment_infusion_duration' getName(x) ## S4 method for signature 'compartment_infusion_rate' getName(x) ## S4 method for signature 'compartment_initial_condition' getName(x) ## S4 method for signature 'theta' getName(x) ## S4 method for signature 'omega' getName(x) ## S4 method for signature 'sigma' getName(x) ## S4 method for signature 'main_record' getName(x) ## S4 method for signature 'ode_record' getName(x) ## S4 method for signature 'f_record' getName(x) ## S4 method for signature 'lag_record' getName(x) ## S4 method for signature 'duration_record' getName(x) ## S4 method for signature 'rate_record' getName(x) ## S4 method for signature 'init_record' getName(x) ## S4 method for signature 'error_record' getName(x)
x |
element to know the name |
the name of this element
Get the name of the given parameter in the CAMPSIS model.
getNameInModel(x) ## S4 method for signature 'theta' getNameInModel(x) ## S4 method for signature 'omega' getNameInModel(x) ## S4 method for signature 'sigma' getNameInModel(x)
getNameInModel(x) ## S4 method for signature 'theta' getNameInModel(x) ## S4 method for signature 'omega' getNameInModel(x) ## S4 method for signature 'sigma' getNameInModel(x)
x |
element to know the name |
the name of this parameter
Get element names from list.
getNames(object) ## S4 method for signature 'pmx_list' getNames(object)
getNames(object) ## S4 method for signature 'pmx_list' getNames(object)
object |
list object |
character vector with all the element names of this list
Get NONMEM name.
getNONMEMName(object) ## S4 method for signature 'theta' getNONMEMName(object) ## S4 method for signature 'omega' getNONMEMName(object) ## S4 method for signature 'sigma' getNONMEMName(object)
getNONMEMName(object) ## S4 method for signature 'theta' getNONMEMName(object) ## S4 method for signature 'omega' getNONMEMName(object) ## S4 method for signature 'sigma' getNONMEMName(object)
object |
generic object |
the NONMEM name associated with this object
Get prefix.
getPrefix(object, ...) ## S4 method for signature 'compartment_bioavailability' getPrefix(object, ...) ## S4 method for signature 'compartment_lag_time' getPrefix(object, ...) ## S4 method for signature 'compartment_infusion_duration' getPrefix(object, ...) ## S4 method for signature 'compartment_infusion_rate' getPrefix(object, ...) ## S4 method for signature 'compartment_initial_condition' getPrefix(object, ...)
getPrefix(object, ...) ## S4 method for signature 'compartment_bioavailability' getPrefix(object, ...) ## S4 method for signature 'compartment_lag_time' getPrefix(object, ...) ## S4 method for signature 'compartment_infusion_duration' getPrefix(object, ...) ## S4 method for signature 'compartment_infusion_rate' getPrefix(object, ...) ## S4 method for signature 'compartment_initial_condition' getPrefix(object, ...)
object |
generic object |
... |
e.g. dest='mrgsolve' |
the prefix of this object
Get record delimiter.
getRecordDelimiter(line)
getRecordDelimiter(line)
line |
any line, single character value |
the record delimiter between brackets
Get record name.
getRecordName(object) ## S4 method for signature 'compartment_bioavailability' getRecordName(object) ## S4 method for signature 'compartment_lag_time' getRecordName(object) ## S4 method for signature 'compartment_infusion_duration' getRecordName(object) ## S4 method for signature 'compartment_infusion_rate' getRecordName(object) ## S4 method for signature 'compartment_initial_condition' getRecordName(object)
getRecordName(object) ## S4 method for signature 'compartment_bioavailability' getRecordName(object) ## S4 method for signature 'compartment_lag_time' getRecordName(object) ## S4 method for signature 'compartment_infusion_duration' getRecordName(object) ## S4 method for signature 'compartment_infusion_rate' getRecordName(object) ## S4 method for signature 'compartment_initial_condition' getRecordName(object)
object |
generic object |
the name of the record
Get uncertainty on the parameters.
getUncertainty(object, ...) ## S4 method for signature 'parameter' getUncertainty(object, varcov, ...) ## S4 method for signature 'parameters' getUncertainty(object, ...) ## S4 method for signature 'campsis_model' getUncertainty(object, ...)
getUncertainty(object, ...) ## S4 method for signature 'parameter' getUncertainty(object, varcov, ...) ## S4 method for signature 'parameters' getUncertainty(object, ...) ## S4 method for signature 'campsis_model' getUncertainty(object, ...)
object |
generic object |
... |
extra arguments |
varcov |
variance covariance matrix |
data frame with standard error (se) and relative standard error (rse
Get variance-covariance matrix.
getVarCov(object) ## S4 method for signature 'parameters' getVarCov(object) ## S4 method for signature 'campsis_model' getVarCov(object)
getVarCov(object) ## S4 method for signature 'parameters' getVarCov(object) ## S4 method for signature 'campsis_model' getVarCov(object)
object |
generic object |
a variance-covariance matrix (data frame) or NULL if no matrix present
Check if string contains CAMPSIS-style comments.
hasComment(x)
hasComment(x)
x |
character vector |
logical value
If-statement class. Any statement in the form if (condition) A = B.
condition
IF statement condition
equation
any equation or ODE
Create a new IF-statement.
IfStatement(condition, equation, comment = as.character(NA))
IfStatement(condition, equation, comment = as.character(NA))
condition |
condition, single character string |
equation |
equation if condition is met |
comment |
comment if any, single character string |
an IF-statement
Get the index of an element in list.
indexOf(object, x) ## S4 method for signature 'pmx_list,pmx_element' indexOf(object, x)
indexOf(object, x) ## S4 method for signature 'pmx_list,pmx_element' indexOf(object, x)
object |
list object |
x |
element to know the index |
index of this element
Create an infusion duration.
InfusionDuration(compartment, rhs = "")
InfusionDuration(compartment, rhs = "")
compartment |
compartment index |
rhs |
right-hand side part of the equation |
an infusion duration property
Create an infusion rate.
InfusionRate(compartment, rhs = "")
InfusionRate(compartment, rhs = "")
compartment |
compartment index |
rhs |
right-hand side part of the equation |
an infusion rate property
Create an initial condition.
InitialCondition(compartment, rhs = "")
InitialCondition(compartment, rhs = "")
compartment |
compartment index |
rhs |
right-hand side part of the equation |
an initial condition property
Check if string is a CAMPSIS comment (i.e. not an equation).
isComment(x)
isComment(x)
x |
character vector |
logical value
Is diagonal.
isDiag(object) ## S4 method for signature 'double_array_parameter' isDiag(object)
isDiag(object) ## S4 method for signature 'double_array_parameter' isDiag(object)
object |
generic object |
logical value
Check if string is an empty line.
isEmptyLine(x)
isEmptyLine(x)
x |
character vector |
logical value
Say if line in record is an equation not.
isEquation(x)
isEquation(x)
x |
character value |
logical value
Say if line in record is an IF-statement.
isIfStatement(x)
isIfStatement(x)
x |
character value |
logical value
Say if line(s) in record is/are ODE or not.
isODE(x)
isODE(x)
x |
character vector |
logical vector
Is record delimiter. A record delimiter is any line starting with [...].
isRecordDelimiter(line)
isRecordDelimiter(line)
line |
any line, single character value |
a logical value
Is strict record delimiter. A strict record delimiter is any line starting with [...] and followed by nothing but spaces or a possible comment.
isStrictRecordDelimiter(line)
isStrictRecordDelimiter(line)
line |
any line, single character value |
a logical value
Create a lag time for the specified compartment.
LagTime(compartment, rhs = "")
LagTime(compartment, rhs = "")
compartment |
compartment index |
rhs |
right-hand side part of the equation |
a lag time property
Create a new line break.
LineBreak()
LineBreak()
a line break
Create MAIN code record.
MainRecord(code = character())
MainRecord(code = character())
code |
code record |
Max index.
maxIndex(object) ## S4 method for signature 'parameters' maxIndex(object)
maxIndex(object) ## S4 method for signature 'parameters' maxIndex(object)
object |
generic object |
max index
Min index.
minIndex(object) ## S4 method for signature 'parameters' minIndex(object)
minIndex(object) ## S4 method for signature 'parameters' minIndex(object)
object |
generic object |
min index
Model statement class. Any statement in a code record.
comment
a comment associated to this model statement
Model statements class. A list of statements.
A library of models of all kinds, ready to be simulated in Campsis. These model templates are sorted into the following categories: pharmacokinetic (PK), pharmacodynamic (PD), target-mediated drug disposition (TMDD), NONMEM, literature and other (custom models).
model_suite
model_suite
A list with all the models:
extensive list of pharmacokinetic (PK) model templates
list of pharmacodynamic (PD) model templates, to be plugged into any pharmacokinetic (PK) model
extensive list of target-mediated drug disposition (TMDD) model templates
list of model templates translated from standard NONMEM control streams
a couple of models coming from the literature
a couple of custom models
https://calvagone.github.io/campsis.doc/
https://www.iconplc.com/solutions/technologies/nonmem/
Create an empty list of model statements.
ModelStatements()
ModelStatements()
a model statements object
Convert code record for mrgsolve.
mrgsolveBlock(record, init = NULL, capture = FALSE)
mrgsolveBlock(record, init = NULL, capture = FALSE)
record |
code record |
init |
name of mrgsolve block |
capture |
'capture' instead of 'double' |
translated record for mrgsolve
Get the CAPTURE block for mrgsolve.
mrgsolveCapture(outvars, model)
mrgsolveCapture(outvars, model)
outvars |
outvars in method simulate |
model |
CAMPSIS model |
CAPTURE block or character(0) if no variable in outvars
Get the compartment block for mrgsolve.
mrgsolveCompartment(model)
mrgsolveCompartment(model)
model |
CAMPSIS model |
character vector, each value is a line
Get the MAIN block for mrgsolve.
mrgsolveMain(model)
mrgsolveMain(model)
model |
CAMPSIS model |
MAIN block
Get the OMEGA/SIGMA matrix for mrgsolve.
mrgsolveMatrix(model, type = "omega")
mrgsolveMatrix(model, type = "omega")
model |
CAMPSIS model |
type |
either omega or sigma |
named matrix or character(0) if matrix is empty
Get the ODE block for mrgsolve.
mrgsolveOde(model)
mrgsolveOde(model)
model |
CAMPSIS model |
ODE block
Get the parameters block for mrgsolve.
mrgsolveParam(model, extra_params = character(0))
mrgsolveParam(model, extra_params = character(0))
model |
CAMPSIS model |
extra_params |
extra parameter names to be added. By default, they will be assigned a zero value. |
character vector, 1 parameter per line. First one is header [PARAM].
Get the TABLE block for mrgsolve.
mrgsolveTable(model)
mrgsolveTable(model)
model |
CAMPSIS model |
TABLE block if at least one line in error record, character(0) otherwise
Create a new ordinary differential equation (ODE).
Ode(lhs, rhs = "", comment = as.character(NA))
Ode(lhs, rhs = "", comment = as.character(NA))
lhs |
left-hand side variable corresponding to derivative name, must start with 'A_' |
rhs |
right-hand side expression corresponding to derivative value |
comment |
comment if any, single character string |
an ODE
ODE class. Any statement in the form d/dt(A_CMT) = B.
Create ODE code record.
OdeRecord(code = character())
OdeRecord(code = character())
code |
code record |
an ODE code record
Create an OMEGA parameter.
Omega( name = NA, index = NA, index2 = NA, value = NA, fix = FALSE, type = NULL, same = NA, label = NA, comment = NA )
Omega( name = NA, index = NA, index2 = NA, value = NA, fix = FALSE, type = NULL, same = NA, label = NA, comment = NA )
name |
parameter name, e.g. CL (prefix OMEGA will be added automatically) |
index |
parameter index |
index2 |
second parameter index |
value |
parameter value |
fix |
parameter was fixed in estimation, logical value |
type |
variance type: 'var', 'sd', 'covar', 'cor', 'cv' or 'cv%' |
same |
NA by default, FALSE for first OMEGA followed by 'SAME' OMEGA's, TRUE for 'SAME' OMEGA's |
label |
parameter label, optional |
comment |
any comment, optional |
an OMEGA parameter
Omega parameter class.
same
logical value, tell if this omega is the same as the previous one
Parameter class. Any parameter in a pharmacometric model.
name
parameter name, optional (although recommended)
index
parameter index, integer
value
parameter value (e.g. the estimated value from a modelling tool)
fix
logical value, say if parameter was fixed in the modelling phase
label
parameter label, any string
comment
any comment on this parameter, any string
Create a list of parameters.
Parameters()
Parameters()
an empty list of parameters
Parse IF-statement. Assumption: isIfStatement method already called and returned TRUE.
parseIfStatement(line, comment = as.character(NA))
parseIfStatement(line, comment = as.character(NA))
line |
IF-statement as single character string value, comment omitted |
comment |
any comment, NA by default |
an IF statement object
Parse statements code and return CAMPSIS statements.
parseStatements(code)
parseStatements(code)
code |
character vector containing all statements (text form) |
a list of CAMPSIS statements
Create a pattern.
Pattern(x)
Pattern(x)
x |
regular expression |
a pattern
Element position in list.
Position(x, after = TRUE)
Position(x, after = TRUE)
x |
either an integer position (useful to add an element in a code record at a specified position) or an model element (element can be a model statement or a code record) |
after |
element to be added will be added after x (if after is TRUE) or before x (if after is FALSE) |
a position object
Process extra arguments.
processExtraArg(args, name, default = NULL, mandatory = FALSE)
processExtraArg(args, name, default = NULL, mandatory = FALSE)
args |
arguments list |
name |
argument name to retrieve |
default |
default value if argument is not present |
mandatory |
mandatory argument, logical value |
requested argument value
Generic read method to read data from a file or a folder.
read(file, ...)
read(file, ...)
file |
path to the file or folder to be read |
... |
extra arguments |
the object representation of the data contained in the file
Read all parameters files at once.
read.allparameters(folder)
read.allparameters(folder)
folder |
path to folder or path to zipped project |
parameters object
Read a CAMPSIS model.
read.campsis(file)
read.campsis(file)
file |
path to folder |
a CAMPSIS model
Read model file.
read.model(file = NULL, text = NULL)
read.model(file = NULL, text = NULL)
file |
path to file 'model.campsis' |
text |
model file as text, character (single or multiple lines) |
records object
Read parameters file.
read.parameters(file, type)
read.parameters(file, type)
file |
path to CSV file |
type |
parameter type: 'theta', 'omega' or 'sigma' |
parameters sub list
Read variance-covariance file.
read.varcov(file)
read.varcov(file)
file |
path to CSV file |
variance-covariance matrix
Replace element by another in list.
replace(object, x) ## S4 method for signature 'pmx_list,pmx_element' replace(object, x) ## S4 method for signature 'pmx_list,pmx_list' replace(object, x) ## S4 method for signature 'pmx_list,list' replace(object, x) ## S4 method for signature 'compartments,compartment_property' replace(object, x) ## S4 method for signature 'parameters,single_array_parameter' replace(object, x) ## S4 method for signature 'parameters,double_array_parameter' replace(object, x) ## S4 method for signature 'statements_record,model_statement' replace(object, x) ## S4 method for signature 'code_records,model_statement' replace(object, x) ## S4 method for signature 'campsis_model,compartment' replace(object, x) ## S4 method for signature 'campsis_model,compartment_property' replace(object, x) ## S4 method for signature 'campsis_model,parameter' replace(object, x) ## S4 method for signature 'campsis_model,code_record' replace(object, x) ## S4 method for signature 'campsis_model,model_statement' replace(object, x)
replace(object, x) ## S4 method for signature 'pmx_list,pmx_element' replace(object, x) ## S4 method for signature 'pmx_list,pmx_list' replace(object, x) ## S4 method for signature 'pmx_list,list' replace(object, x) ## S4 method for signature 'compartments,compartment_property' replace(object, x) ## S4 method for signature 'parameters,single_array_parameter' replace(object, x) ## S4 method for signature 'parameters,double_array_parameter' replace(object, x) ## S4 method for signature 'statements_record,model_statement' replace(object, x) ## S4 method for signature 'code_records,model_statement' replace(object, x) ## S4 method for signature 'campsis_model,compartment' replace(object, x) ## S4 method for signature 'campsis_model,compartment_property' replace(object, x) ## S4 method for signature 'campsis_model,parameter' replace(object, x) ## S4 method for signature 'campsis_model,code_record' replace(object, x) ## S4 method for signature 'campsis_model,model_statement' replace(object, x)
object |
list object |
x |
element to replace |
list object or an error if the element does not exist in the list
Replace all occurrences in object.
replaceAll(object, pattern, replacement, ...) ## S4 method for signature 'character,variable_pattern,character' replaceAll(object, pattern, replacement, ...) ## S4 method for signature 'character,pattern,character' replaceAll(object, pattern, replacement, ...) ## S4 method for signature 'model_statement,pattern,character' replaceAll(object, pattern, replacement, ...) ## S4 method for signature 'equation,pattern,character' replaceAll(object, pattern, replacement, ...) ## S4 method for signature 'if_statement,pattern,character' replaceAll(object, pattern, replacement, ...) ## S4 method for signature 'compartment_property,pattern,character' replaceAll(object, pattern, replacement, ...) ## S4 method for signature 'code_record,pattern,character' replaceAll(object, pattern, replacement, ...) ## S4 method for signature 'code_records,pattern,character' replaceAll(object, pattern, replacement, ...) ## S4 method for signature 'campsis_model,pattern,character' replaceAll(object, pattern, replacement, ...) ## S4 method for signature 'campsis_model,character,character' replaceAll(object, pattern, replacement, ...)
replaceAll(object, pattern, replacement, ...) ## S4 method for signature 'character,variable_pattern,character' replaceAll(object, pattern, replacement, ...) ## S4 method for signature 'character,pattern,character' replaceAll(object, pattern, replacement, ...) ## S4 method for signature 'model_statement,pattern,character' replaceAll(object, pattern, replacement, ...) ## S4 method for signature 'equation,pattern,character' replaceAll(object, pattern, replacement, ...) ## S4 method for signature 'if_statement,pattern,character' replaceAll(object, pattern, replacement, ...) ## S4 method for signature 'compartment_property,pattern,character' replaceAll(object, pattern, replacement, ...) ## S4 method for signature 'code_record,pattern,character' replaceAll(object, pattern, replacement, ...) ## S4 method for signature 'code_records,pattern,character' replaceAll(object, pattern, replacement, ...) ## S4 method for signature 'campsis_model,pattern,character' replaceAll(object, pattern, replacement, ...) ## S4 method for signature 'campsis_model,character,character' replaceAll(object, pattern, replacement, ...)
object |
generic object (e.g. model, code_record(s), etc.) |
pattern |
pattern to be replaced |
replacement |
replacement string |
... |
extra arguments |
the same object with all occurrences replaced
Get code for rxode2
rxodeCode(model)
rxodeCode(model)
model |
CAMPSIS model |
corresponding model code for rxode2
Get the OMEGA/SIGMA matrix for rxode2.
rxodeMatrix(model, type = "omega")
rxodeMatrix(model, type = "omega")
model |
CAMPSIS model |
type |
either omega or sigma |
omega/sigma named matrix
Get the parameters vector for rxode2.
rxodeParams(model)
rxodeParams(model)
model |
CAMPSIS model |
named vector with THETA values
Get a subset of an object.
select(object, ...) ## S4 method for signature 'data.frame' select(object, ...) ## S4 method for signature 'compartment_properties' select(object, ...) ## S4 method for signature 'parameters' select(object, ...)
select(object, ...) ## S4 method for signature 'data.frame' select(object, ...) ## S4 method for signature 'compartment_properties' select(object, ...) ## S4 method for signature 'parameters' select(object, ...)
object |
generic object |
... |
arguments to select |
subset of an object
Create a SIGMA parameter.
Sigma( name = NA, index = NA, index2 = NA, value = NA, fix = FALSE, type = NULL, label = NA, comment = NA )
Sigma( name = NA, index = NA, index2 = NA, value = NA, fix = FALSE, type = NULL, label = NA, comment = NA )
name |
parameter name, e.g. CL (prefix SIGMA will be added automatically) |
index |
parameter index |
index2 |
second parameter index |
value |
parameter value |
fix |
parameter was fixed in estimation, logical value |
type |
variance type: 'var', 'sd', 'covar', 'cv' or 'cv%' |
label |
parameter label, optional |
comment |
any comment, optional |
a SIGMA parameter
Single-array parameter class. This parameter has a single index value.
Sort the specified list.
sort(x, decreasing = FALSE, ...) ## S4 method for signature 'compartment_properties' sort(x, decreasing = FALSE, ...) ## S4 method for signature 'compartments' sort(x, decreasing = FALSE, ...) ## S4 method for signature 'parameters' sort(x, decreasing = FALSE, ...) ## S4 method for signature 'code_records' sort(x, decreasing = FALSE, ...) ## S4 method for signature 'campsis_model' sort(x, decreasing = FALSE, ...)
sort(x, decreasing = FALSE, ...) ## S4 method for signature 'compartment_properties' sort(x, decreasing = FALSE, ...) ## S4 method for signature 'compartments' sort(x, decreasing = FALSE, ...) ## S4 method for signature 'parameters' sort(x, decreasing = FALSE, ...) ## S4 method for signature 'code_records' sort(x, decreasing = FALSE, ...) ## S4 method for signature 'campsis_model' sort(x, decreasing = FALSE, ...)
x |
list object |
decreasing |
increasing or decreasing order |
... |
extra arguments |
same list but ordered
Standardise.
standardise(object, ...) ## S4 method for signature 'theta' standardise(object, ...) ## S4 method for signature 'double_array_parameter' standardise(object, parameters = NULL, ...) ## S4 method for signature 'parameters' standardise(object, ...)
standardise(object, ...) ## S4 method for signature 'theta' standardise(object, ...) ## S4 method for signature 'double_array_parameter' standardise(object, parameters = NULL, ...) ## S4 method for signature 'parameters' standardise(object, ...)
object |
generic object |
... |
extra arguments needed for standardisation |
parameters |
the list of parameters, to be provided only if parameter type is 'cor' |
standardised object
Create a THETA parameter.
Theta( name = NA, index = NA, value = NA, fix = FALSE, label = NA, unit = NA, comment = NA )
Theta( name = NA, index = NA, value = NA, fix = FALSE, label = NA, unit = NA, comment = NA )
name |
parameter name, e.g. CL (prefix THETA will be added automatically) |
index |
parameter index |
value |
parameter value |
fix |
parameter was fixed in estimation, logical value |
label |
parameter label, optional |
unit |
parameter unit, optional |
comment |
any comment, optional |
a THETA parameter
ToString generic method.
toString(object, ...) ## S4 method for signature 'unknown_statement' toString(object, ...) ## S4 method for signature 'comment' toString(object, ...) ## S4 method for signature 'line_break' toString(object, ...) ## S4 method for signature 'equation' toString(object, ...) ## S4 method for signature 'ode' toString(object, ...) ## S4 method for signature 'if_statement' toString(object, ...) ## S4 method for signature 'compartment' toString(object, ...) ## S4 method for signature 'compartment_property' toString(object, ...) ## S4 method for signature 'compartment_initial_condition' toString(object, ...) ## S4 method for signature 'mrgsolve_model' toString(object, ...)
toString(object, ...) ## S4 method for signature 'unknown_statement' toString(object, ...) ## S4 method for signature 'comment' toString(object, ...) ## S4 method for signature 'line_break' toString(object, ...) ## S4 method for signature 'equation' toString(object, ...) ## S4 method for signature 'ode' toString(object, ...) ## S4 method for signature 'if_statement' toString(object, ...) ## S4 method for signature 'compartment' toString(object, ...) ## S4 method for signature 'compartment_property' toString(object, ...) ## S4 method for signature 'compartment_initial_condition' toString(object, ...) ## S4 method for signature 'mrgsolve_model' toString(object, ...)
object |
generic object |
... |
extra arguments needed for toString conversion |
character value/vector
Trim character vector. Remove all leading and trailing spaces.
trim(x)
trim(x)
x |
character vector |
character vector without leading and trailing spaces
Unknown statement class. Any statement not recognized by campsismod.
Create a new ordinary differential equation (ODE).
UnknownStatement(line, comment = as.character(NA))
UnknownStatement(line, comment = as.character(NA))
line |
line which was not recognised |
comment |
comment if any, single character string |
an unknown statement
Update compartments list from the persisted records. Exported especially for package pmxtran. However, this method should not be called.
updateCompartments(model)
updateCompartments(model)
model |
CAMPSIS model |
an updated CAMPSIS model, with an updated compartments list
Create a variable pattern.
VariablePattern(x)
VariablePattern(x)
x |
variable name |
a variable pattern
Write generic object to files.
write(object, file, ...) ## S4 method for signature 'parameters,character' write(object, file, ...) ## S4 method for signature 'code_records,character' write(object, file, ...) ## S4 method for signature 'campsis_model,character' write(object, file, ...)
write(object, file, ...) ## S4 method for signature 'parameters,character' write(object, file, ...) ## S4 method for signature 'code_records,character' write(object, file, ...) ## S4 method for signature 'campsis_model,character' write(object, file, ...)
object |
generic object |
file |
path of the output file or directory |
... |
extra arguments |
logical value, TRUE for success, FALSE for failure
Write subset of parameters (theta, omega or sigma).
writeParameters(object, file, ...)
writeParameters(object, file, ...)
object |
subset of parameters |
file |
filename |
... |
extra arguments, like defaultDf for empty parameters list |
TRUE if success
Write variance-covariance matrix.
writeVarcov(object, file)
writeVarcov(object, file)
object |
matrix |
file |
filename |
TRUE if success