R functions to run PKanalix

On the use of a R-functions

PKanalix can be called via R-functions. It is possible to have access to the project exactly in the same way as you would do with the interface.  All the functions are described below.

Installation and initialization

All the installation guidelines and initialization procedure can be found here.

Description of the functions concerning the project management

  • getData: Get a description of the data used in the current project.
  • getStructuralModel: Get the model file for the structural model used in the current project (CA analysis).
  • loadProject: Load a project by parsing the mlxtran-formated file whose path has been given as an input.
  • newProject: Create a new empty project providing model and data specification.
  • saveProject: Save the current project as an Mlxtran-formated file.
  • setData: Set project data giving a data file and specifying headers and observations types.
  • setStructuralModel: Set the structural model.

Description of the functions concerning the scenario

  • runCAEstimation: Estimate the CA parameters for each individual of the project.
  • runEstimation: Run the NCA analysis and the CA analysis if the structural model for the CA calculation is well defined.
  • runNCAEstimation: Estimate the NCA parameters for each individual of the project.
  • abort: Stop the current task run.
  • getLastRunStatus: Return an execution report about the last run with a summary of the error which could have occurred.
  • isRunning: Check if a scenario is currently running.

Description of the functions concerning the results

  • getCAIndividualParameters: Get the estimated values for each subject of some of the individual CA parameters of the current project.
  • getNCAIndividualParameters: Get the estimated values for each subject of some of the individual NCA parameters of the current project.

Description of the functions concerning the data

Description of the functions concerning the compartmental and non compartmental analysis settings

  • getCASettings: Get the settings associated to the compartmental analysis.
  • getDataSettings: Get the data settings associated to the non compartmental analysis.
  • getGlobalObsIdToUse: Get the global observation id used in both the compartmental and non compartmental analysis.
  • getNCASettings: Get the settings associated to the non compartmental analysis.
  • setCASettings: Get the settings associated to the compartmental analysis.
  • setDataSettings: Set the value of one or several of the data settings associated to the non compartmental analysis.
  • setGlobalObsIdToUse: Get the global observation id used in both the compartmental and non compartmental analysis.
  • setNCASettings: Set the value of one or several of the settings associated to the non compartmental analysis.

Description of the functions concerning preferences and project settings

Example

Below is an example of the functions to call to run an NCA and CA analysis from scratch using one of the demo data sets.

# load library and initialize the API
library(lixoftConnectors)
initializeLixoftConnectors(software="pkanalix")

# create a new project by setting a data set
# replace <userFolder> by the path to your home directory
demoPath = '<userFolder>/lixoft/pkanalix/pkanalix2019R1/demos/2.case_studies/data/'
newProject(data = list(dataFile = paste0(demoPath,'M2000_ivbolus_singledose.csv'),
                       headerTypes = c('id','time','amount','observation',
                                       'catcov','contcov','contcov','contcov'),
                       observationTypes = 'continuous'))

# set the options for the NCA analysis
setNCASettings(administrationtype = list("1"="intravascular"),
               integralMethod = "LinLogTrapLinLogInterp", 
               lambdaRule="adjustedR2")

# run the NCA analysis
runNCAEstimation()

# retrieve the output of interest
indivParams <- getNCAIndividualParameters("AUCINF_pred","Cmax")

The estimated NCA parameters can then be further analyzed using typical R functions, and plotted.