Package: campsismod 1.1.1

Nicolas Luyckx

campsismod: Generic Implementation of a PK/PD Model

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]

campsismod_1.1.1.tar.gz
campsismod_1.1.1.zip(r-4.5)campsismod_1.1.1.zip(r-4.4)campsismod_1.1.1.zip(r-4.3)
campsismod_1.1.1.tgz(r-4.4-any)campsismod_1.1.1.tgz(r-4.3-any)
campsismod_1.1.1.tar.gz(r-4.5-noble)campsismod_1.1.1.tar.gz(r-4.4-noble)
campsismod_1.1.1.tgz(r-4.4-emscripten)campsismod_1.1.1.tgz(r-4.3-emscripten)
campsismod.pdf |campsismod.html
campsismod/json (API)
NEWS

# Install 'campsismod' in R:
install.packages('campsismod', repos = c('https://calvagone.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/calvagone/campsismod/issues

Datasets:

On CRAN:

6.30 score 5 stars 1 packages 38 scripts 331 downloads 97 exports 31 dependencies

Last updated 9 months agofrom:df0ac21274. Checks:OK: 7. Indexed: yes.

TargetResultDate
Doc / VignettesOKNov 12 2024
R-4.5-winOKNov 12 2024
R-4.5-linuxOKNov 12 2024
R-4.4-winOKNov 12 2024
R-4.4-macOKNov 12 2024
R-4.3-winOKNov 12 2024
R-4.3-macOKNov 12 2024

Exports:%>%addaddSuffixallNaas.data.frameassertSingleCharacterStringautoDetectNONMEMBioavailabilityCampsisModelCodeRecordsCommentCompartmentCompartmentscontainsdefaultdeletedisableEquationErrorRecordexportextractLhsextractRhsextractTextBetweenBracketsfindfixOmegagetByIndexgetByNamegetCompartmentIndexgetNamegetNameInModelgetNamesgetNONMEMNamegetPrefixgetRecordDelimitergetRecordEquationNamesgetRecordNamegetUncertaintygetVarCovhasCommentIfStatementindexOfInfusionDurationInfusionRateInitialConditionisCommentisDiagisEmptyLineisEquationisIfStatementisODEisRecordDelimiterisStrictRecordDelimiterLagTimeLineBreakMainRecordmaxIndexminIndexModelStatementsmrgsolveBlockmrgsolveCapturemrgsolveCompartmentmrgsolveMainmrgsolveMatrixmrgsolveOdemrgsolveParammrgsolveTableOdeOdeRecordOmegaParametersPatternPositionprocessExtraArgreadread.allparametersread.campsisread.modelread.parametersread.pmxmodread.varcovremoveNaColumnreplacereplaceAllrxodeCoderxodeMatrixrxodeParamsselectSigmasortstandardiseThetatoStringtrimUnknownStatementupdateCompartmentsVariablePatternwrite

Dependencies:assertthatbitbit64clicliprcpp11crayondplyrfansigenericsgluehmslifecyclemagrittrpillarpkgconfigplyrprettyunitsprogresspurrrR6Rcppreadrrlangtibbletidyselecttzdbutf8vctrsvroomwithr

Adapt your model

Rendered fromv03_model_adaptation.Rmdusingknitr::rmarkdownon Nov 12 2024.

Last update: 2021-10-04
Started: 2021-10-04

Adapt your parameters

Rendered fromv05_parameters.Rmdusingknitr::rmarkdownon Nov 12 2024.

Last update: 2022-06-17
Started: 2021-10-04

Append a model to another

Rendered fromv06_append_pd_model.Rmdusingknitr::rmarkdownon Nov 12 2024.

Last update: 2023-10-11
Started: 2021-10-04

Create a minimalist model

Rendered fromv01_model_creation.Rmdusingknitr::rmarkdownon Nov 12 2024.

Last update: 2021-11-30
Started: 2021-10-04

Get started with CAMPSIS model

Rendered fromcampsismod.Rmdusingknitr::rmarkdownon Nov 12 2024.

Last update: 2022-06-17
Started: 2021-10-04

Insight on the structural model

Rendered fromv02_structural_model.Rmdusingknitr::rmarkdownon Nov 12 2024.

Last update: 2021-10-04
Started: 2021-10-04

Play with compartment properties

Rendered fromv04_compartment_properties.Rmdusingknitr::rmarkdownon Nov 12 2024.

Last update: 2021-10-04
Started: 2021-10-04

Readme and manuals

Help Manual

Help pageTopics
Add element to list.add add,campsis_model,campsis_model-method add,campsis_model,code_record-method add,campsis_model,compartment_property-method add,campsis_model,model_statement-method add,campsis_model,parameter-method add,code_record,code_record-method add,code_record,model_statement-method add,code_records,code_records-method add,code_records,model_statement-method add,compartments,compartments-method add,compartments,compartment_property-method add,parameters,double_array_parameter-method add,parameters,parameters-method add,parameters,single_array_parameter-method add,pmx_list,list-method add,pmx_list,pmx_element-method add,pmx_list,pmx_list-method
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 addSuffix,campsis_model,character,character-method addSuffix,code_record,character,character-method addSuffix,code_records,character,character-method addSuffix,compartments,character,character-method addSuffix,parameters,character,character-method
As data frame method.as.data.frame as.data.frame,omega,character,logical-method as.data.frame,sigma,character,logical-method as.data.frame,theta,character,logical-method
Assert the given character vector is a single character string.assertSingleCharacterString
Auto-detect special variables from NONMEM as compartment properties. Bioavailabilities, infusion durations/rates and lag times will be automatically detected.autoDetectNONMEM autoDetectNONMEM,campsis_model-method
Create a bioavailability for the specified compartment.Bioavailability
CAMPSIS model class.campsis_model-class
Create a new CAMPSIS model.CampsisModel
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)code_record-class
Create a list of code records.CodeRecords
Create a new comment.Comment
Comment class. A statement starting with #.comment-class
Create a compartment.Compartment
Compartment bioavailability class.compartment_bioavailability-class
Compartment infusion duration class.compartment_infusion_duration-class
Compartment infusion rate class.compartment_infusion_rate-class
Compartment initial condition class.compartment_initial_condition-class
Compartment lag time class.compartment_lag_time-class
Compartment properties class.compartment_properties-class
Compartment property class.compartment_property-class
Compartment class.compartment-class
Create a list of compartmentsCompartments
Compartments class.compartments-class
Get default element from list.default
Delete an element from this list.delete delete,campsis_model,code_record-method delete,campsis_model,compartment_property-method delete,campsis_model,model_statement-method delete,campsis_model,parameter-method delete,code_records,model_statement-method delete,compartments,compartment_property-method delete,parameters,double_array_parameter-method delete,parameters,single_array_parameter-method delete,pmx_list,integer-method delete,pmx_list,pmx_element-method delete,statements_record,integer-method delete,statements_record,model_statement-method
Disable.disable disable,campsis_model,character-method disable,parameters,character-method
Double-array parameter class. This parameter has 2 indexes. It can thus be used to define correlations between parameters.double_array_parameter-class
(Infusion)-duration record class.duration_record-class
Create a new equation.Equation
Equation class. Any statement in the form A = B.equation-class
Error record class.error_record-class
Create ERROR code record.ErrorRecord
Export function.export export,campsis_model,character-method export,campsis_model,mrgsolve_type-method export,campsis_model,rxode_type-method
Export type class.export_type-class
Extract left-hand-side expression.extractLhs
Extract right-hand-side expression.extractRhs
Extract text between brackets.extractTextBetweenBrackets
Bioavailability record class.f_record-class
Find an element in list.find find,campsis_model,code_record-method find,campsis_model,compartment-method find,campsis_model,compartment_property-method find,campsis_model,model_statement-method find,campsis_model,parameter-method find,code_records,model_statement-method find,compartments,compartment_property-method find,pmx_list,pmx_element-method find,statements_record,model_statement-method
Fix omega matrix for SAME OMEGA parameters that have NA values due to imperfections in Pharmpy import.fixOmega fixOmega,parameters-method
Get element by index.getByIndex getByIndex,compartment_properties,compartment_property-method getByIndex,parameters,parameter-method getByIndex,pmx_list,integer-method getByIndex,pmx_list,numeric-method
Get an element from a list by name. Never return more than 1 element.getByName getByName,pmx_list,character-method
Get the compartment index for the specified compartment name.getCompartmentIndex getCompartmentIndex,campsis_model,character-method getCompartmentIndex,compartments,character-method
Get element name.getName getName,comment-method getName,compartment-method getName,compartment_bioavailability-method getName,compartment_infusion_duration-method getName,compartment_infusion_rate-method getName,compartment_initial_condition-method getName,compartment_lag_time-method getName,duration_record-method getName,equation-method getName,error_record-method getName,f_record-method getName,if_statement-method getName,init_record-method getName,lag_record-method getName,line_break-method getName,main_record-method getName,ode-method getName,ode_record-method getName,omega-method getName,rate_record-method getName,sigma-method getName,theta-method getName,unknown_statement-method
Get the name of the given parameter in the CAMPSIS model.getNameInModel getNameInModel,omega-method getNameInModel,sigma-method getNameInModel,theta-method
Get element names from list.getNames getNames,pmx_list-method
Get NONMEM name.getNONMEMName getNONMEMName,omega-method getNONMEMName,sigma-method getNONMEMName,theta-method
Get prefix.getPrefix getPrefix,compartment_bioavailability-method getPrefix,compartment_infusion_duration-method getPrefix,compartment_infusion_rate-method getPrefix,compartment_initial_condition-method getPrefix,compartment_lag_time-method
Get record delimiter.getRecordDelimiter
Get record name.getRecordName getRecordName,compartment_bioavailability-method getRecordName,compartment_infusion_duration-method getRecordName,compartment_infusion_rate-method getRecordName,compartment_initial_condition-method getRecordName,compartment_lag_time-method
Get uncertainty on the parameters.getUncertainty getUncertainty,campsis_model-method getUncertainty,parameter-method getUncertainty,parameters-method
Get variance-covariance matrix.getVarCov getVarCov,campsis_model-method getVarCov,parameters-method
Check if string contains CAMPSIS-style comments.hasComment
If-statement class. Any statement in the form if (condition) A = B.if_statement-class
Create a new IF-statement.IfStatement
Get the index of an element in list.indexOf indexOf,pmx_list,pmx_element-method
Create an infusion duration.InfusionDuration
Create an infusion rate.InfusionRate
Init record class.init_record-class
Create an initial condition.InitialCondition
Check if string is a CAMPSIS comment (i.e. not an equation).isComment
Is diagonal.isDiag isDiag,double_array_parameter-method
Check if string is an empty line.isEmptyLine
Say if line in record is an equation not.isEquation
Say if line in record is an IF-statement.isIfStatement
Say if line(s) in record is/are ODE or not.isODE
Is record delimiter. A record delimiter is any line starting with [...].isRecordDelimiter
Is strict record delimiter. A strict record delimiter is any line starting with [...] and followed by nothing but spaces or a possible comment.isStrictRecordDelimiter
Lag record class.lag_record-class
Create a lag time for the specified compartment.LagTime
Line-break class. A linebreak in the model.line_break-class
Create a new line break.LineBreak
Main record class.main_record-class
Create MAIN code record.MainRecord
Max index.maxIndex maxIndex,parameters-method
Min index.minIndex minIndex,parameters-method
Model statement class. Any statement in a code record.model_statement-class
Model statements class. A list of statements.model_statements-class
CAMPSIS model suite.model_suite
Create an empty list of model statements.ModelStatements
Mrgsolve export type class.mrgsolve_type-class
Convert code record for mrgsolve.mrgsolveBlock
Get the CAPTURE block for mrgsolve.mrgsolveCapture
Get the compartment block for mrgsolve.mrgsolveCompartment
Get the MAIN block for mrgsolve.mrgsolveMain
Get the OMEGA/SIGMA matrix for mrgsolve.mrgsolveMatrix
Get the ODE block for mrgsolve.mrgsolveOde
Get the parameters block for mrgsolve.mrgsolveParam
Get the TABLE block for mrgsolve.mrgsolveTable
Create a new ordinary differential equation (ODE).Ode
ODE record class.ode_record-class
ODE class. Any statement in the form d/dt(A_CMT) = B.ode-class
Create ODE code record.OdeRecord
Create an OMEGA parameter.Omega
Omega parameter class.omega-class
Parameter class. Any parameter in a pharmacometric model.parameter-class
Create a list of parameters.Parameters
Parameters class.parameters-class
Parse IF-statement. Assumption: isIfStatement method already called and returned TRUE.parseIfStatement
Parse statements code and return CAMPSIS statements.parseStatements
Create a pattern.Pattern
Pattern class.pattern-class
PMX element class.pmx_element-class
PMX position by element class.pmx_position_by_element-class
PMX position by index class.pmx_position_by_index-class
PMX position class.pmx_position-class
Element position in list.Position
Process extra arguments.processExtraArg
Properties record class.properties_record-class
(Infusion)-rate record class.rate_record-class
Generic read method to read data from a file or a folder.read
Read all parameters files at once.read.allparameters
Read a CAMPSIS model.read.campsis
Read model file.read.model
Read parameters file.read.parameters
Read variance-covariance file.read.varcov
Replace element by another in list.replace replace,campsis_model,code_record-method replace,campsis_model,compartment-method replace,campsis_model,compartment_property-method replace,campsis_model,model_statement-method replace,campsis_model,parameter-method replace,code_records,model_statement-method replace,compartments,compartment_property-method replace,parameters,double_array_parameter-method replace,parameters,single_array_parameter-method replace,pmx_list,list-method replace,pmx_list,pmx_element-method replace,pmx_list,pmx_list-method replace,statements_record,model_statement-method
Replace all occurrences in object.replaceAll replaceAll,campsis_model,character,character-method replaceAll,campsis_model,pattern,character-method replaceAll,character,pattern,character-method replaceAll,character,variable_pattern,character-method replaceAll,code_record,pattern,character-method replaceAll,code_records,pattern,character-method replaceAll,compartment_property,pattern,character-method replaceAll,equation,pattern,character-method replaceAll,if_statement,pattern,character-method replaceAll,model_statement,pattern,character-method
RxODE export type class.rxode_type-class
Get code for RxODE.rxodeCode
Get the OMEGA/SIGMA matrix for RxODE.rxodeMatrix
Get the parameters vector for RxODE.rxodeParams
Get a subset of an object.select select,compartment_properties-method select,data.frame-method select,parameters-method
Create a SIGMA parameter.Sigma
Sigma parameter class.sigma-class
Single-array parameter class. This parameter has a single index value.single_array_parameter-class
Sort the specified list.sort sort,campsis_model-method sort,code_records-method sort,compartments-method sort,compartment_properties-method sort,parameters-method
Standardise.standardise standardise,double_array_parameter-method standardise,parameters-method standardise,theta-method
Statements record class.statements_record-class
Create a THETA parameter.Theta
Theta parameter class.theta-class
ToString generic method.toString toString,comment-method toString,compartment-method toString,compartment_initial_condition-method toString,compartment_property-method toString,equation-method toString,if_statement-method toString,line_break-method toString,mrgsolve_model-method toString,ode-method toString,unknown_statement-method
Trim character vector. Remove all leading and trailing spaces.trim
Unknown statement class. Any statement not recognized by campsismod.unknown_statement-class
Create a new ordinary differential equation (ODE).UnknownStatement
Update compartments list from the persisted records. Exported especially for package pmxtran. However, this method should not be called.updateCompartments
Variable pattern class.variable_pattern-class
Create a variable pattern.VariablePattern
Write generic object to files.write write,campsis_model,character-method write,code_records,character-method write,parameters,character-method
Write subset of parameters (theta, omega or sigma).writeParameters
Write variance-covariance matrix.writeVarcov