A Tutorial on Pharmacodynamic Scripting Facility in Simcyp

Khaled Abduljalil, Duncan L. Edwards, Adrian Barnett, RH Rose, Taylor Cain, Masoud Jamei

CPT Pharmacometrics & Systems Pharmacology · 2016 · 15 citations · 13 references

DOIFull text

Open access

Concepts

Abstract

The Simcyp Simulator provides a framework for mechanistic Physiologically-Based Pharmacokinetic/Pharmacodynamic modeling of potentially interacting drugs. It also provides a scripting facility, using the Lua language, for developing customized pharmacodynamic and toxicity models driven by drug concentrations at the site of action. We present an overview of the scripting facility including the scripting language, the editor, and how scripts are embedded within the Simulator. Examples incorporating differential equations and including inter-individual variability on parameters are presented. The Simcyp population-based Simulator is a widely used platform for predictive simulation of pharmacokinetic/pharmacodynamic (PKPD) parameters and profiles, and drug-drug interaction (DDI) based largely on the extrapolation of a limited set of physicochemical properties and in vitro experimental data, such as the clearance and transport of a drug by one or more metabolizing enzymes and transporters.1, 2 In a clinical setting, several predictive variable factors, i.e. covariates, may be measured in an individual patient or volunteer and used to improve a PKPD model prediction and describe the observed variability. To incorporate inter-individual variability, the Simcyp Simulator generates virtual populations of individuals from models incorporating structural correlation of multiple factors (including demographics, genetic and disease status) generating an individual subject with its own set of parameters.1 A more mechanistic simulation approach can incorporate model components that account for and predict individual covariates. The Simcyp Simulator uses such mechanisms benefiting from both “bottom-up” and “top-down” paradigms, called by some the “middle out approach”.1, 3 While prediction of PBPK involves a certain level of modeling complexity, the extension of such predictions to PD outcomes requires an even more complex layer. Linking PD to the PBPK model allows the possibility of deriving the response (pharmacological or toxicological) by the organ concentration. The Simulator provides common empirical and semi-mechanistic “Built-In” pharmacometric building-blocks to ease construction of quite complex models by picking and mixing such building blocks, in a flexible environment, to various input tissue/organ concentrations to drive the response. These built-in PD models have been described earlier,1 but are defined further here to fully understand the architecture of the environment that includes the scripting features. Briefly, the architecture of the Simcyp PD module presents a number of different model-building blocks called PD Response Units (Figure 1). Such units can be linked together to develop more complex responses via certain “transduction” options offered by the platform (for the basics of transduction see4). There are two types of PD Response unit; a PD Basic unit and a PD Link unit.1 The PD Basic unit offers the most commonly used simple response models that include, linear, exponential and sigmoidal/Hill,5 providing an option to link them to an effect compartment. These models can represent a kinetic receptor binding model and be transduced to a stimulus response model in a subsequent PD Basic unit. The PD Link unit includes transform link models, which are simple transforms to convert response to a probability or event count rate, and parameterised link models which include indirect response models6 and survival models.7 The PD Link unit does not include the effect compartment or kinetic receptor binding links as these models are available in the PD Basic unit. PD Response units are subdivided into a sequence of steps with associated model choices from unit input to unit output. Each step calculates values according to a chosen model for that step and passes its result to the next step in the sequence. Applications of linking PBPK and these PD models to predict the impact of genotypic variability, formulation differences, differences in target binding capacity and target site drug concentrations on drug responses and variability have been described previously.8 Simcyp PD response unit structure and interconnections enabling various combinations of PD units up to three layers. Since a Simcyp PD model is linked onto the PBPK simulation model for a specific compound via a chain of response units and each unit comprises a number of built-in steps in a data flow, this design gives an opportunity for replacing a step within a unit by a custom model (Figure 2). In the same way as for a built-in model, the custom model connects to its input and passes on its output. By this mechanism, the input of the custom model acts in the same manner as the input into the processing step it replaces, and the custom step output feeds back into the sequence of PD processing step in the same way that the output from the step it replaces would have done. Thus, the flow of the PD units is maintained in a sequential manner. The step replacement is represented by a Step function which substitutes a built-in function with a user-scripted function in the Simulator's C++ code. If the PD Custom step is on the first step occurrence in a chain of PD response steps (for example on PD Basic 1), the input to the PD Custom step can be a drug (total or free) concentration or amount in plasma, blood, effect compartment, or any other tissue in the PBPK model. It can be the total dose of the drug, if no PK model is assumed. If the PD Custom step is preceded by one or more PD steps, then the input to the PD Custom step is the output from the preceding step. The output response will be the response in the last step in the PD chain returned by the user, however when the codes contain ODEs, the output will also report all state variable profiles. More than one built-in step can be replaced by a custom step allowing more than 20 places across the various compound types to be used, however replacing only one step can be enough, depending on the PBPKPD model settings. General scheme shows the Custom PD Step within the PD Units Chain. The figure shows how the Custom Step replaces a default PD Step. Each figure block can be equivalent to a single script containing one or more functions. The output function, Rxu1, from an upstream step “1” is considered as an input function to the PD Custom Step, Xu,custom, while the output from the custom step, Rxu,custom, is considered as an input function, Xu3, to a subsequent step “3”. Lua is a high-level freely available, very lightweight, and flexible scripting language (www.lua.org). It can easily be embedded in other programs with no need to run an external compiler, and scripts are run seamlessly as part of a “live simulation.” Lua is a relatively new language for PKPD scientists and modellers but it has been used extensively, particularly in computer games where very fast script execution is required. While advanced features in the Lua language are very powerful, the basics of Lua are rather easy to learn. There is extensive online documentation (www.lua.org/docs.html). Details of this documentation are beyond the scope of the current paper. Mathematical functions available in Standard Lua library are supported, for example logarithm, exponential, random distribution … etc. (www.lua.org/manual/5.1/manual.html#5.6). Only functions that are not required or potentially unsafe for the purposes of a modeling script were disabled. In addition to the requirement of valid Lua Syntax in a script, there are additional rules imposed for valid script execution in the Simcyp environment. Most of these are enforceable through a validation tool linked to the script editor; others through limited access provided by Simcyp Lua Library functions; a few by the user interface itself. The scripting editor is based on generic text editing components from the Scintilla project (www.scintilla.org) but is adapted for Simcyp PD scripting. When a simulation is executed, different branches of the simulator (trial design, population library, and compound library) are initiated in order and connected to generate individual values for the compound and population type under study. The engine then starts to run PKPD calculations and reports the results. A summary scheme of these processes have been provided in the supplementary material (Appendix A). Within a script, there are named script functions (e.g. “Step” and “Setup” functions) which are called by the Simulator platform at specific points in the simulation. Such functions are generically known to programmers as “call-back” functions. Simcyp maintains the signatures of these call-back functions and uses them to give controlled access to inputs and parameters through function arguments and the values to be passed onto as the function's return value. The particular function names are reserved and a particular signature is required for the function to be valid. Coding of Lua scripts is supported by a “Functions” dropdown menu, which provides templates for calls to Simcyp Library functions (calls to Simcyp C++ code available as Lua script functions) as well as function definition templates for user-coded Lua Setup and Step functions (Figure 3; see also Supplementary Materials for additional functions in the dropdown menu). A screenshot of the Simcyp Lua Editor shows the Functions dropdown menu. The expanded menu shows how to access various get functions templates to get individual covariates. Generally, Setup functions map onto execution of simulation contexts and called once a certain simulation context is reached, where Simcyp Library set and get functions can be used to manipulate data stores (see Figure 4). In order to control the information passage, the Simcyp data store provides four types of storage space to support PD custom scripting, namely: stores for values scoped at the simulation-population, compound, individual, and individual-compound data levels with one Setup function corresponding to each scoping level (Figure 4). Simcyp datastores for persistence of script at the different scoping together with the Step, and Simcyp library functions and Lua code that can access or level stores can default parameters for level access when a is not available at the same level as the get The set functions set store values at the same level as the function generates individual values from the distribution at the next The Step functions are used to code the model in or step functions at the individual-compound specific are called for each individual compound and be for each if the model Most step functions have access to an of parameters which are model parameters specific to that step for a particular compound type (see the example Details of these functions are available in Simcyp While PBPKPD using the Simcyp PD module with customized features have been the of this is to a of the structure and of the scripting environment and to a example of a PD model step by step. the equations the of concentration in response to an in the concentration described by an indirect model to the and in which to be by the model. the in the individual at the is as by is the in concentration to be of is the in the individual at the and is the that at of The of in response to a in the concentration of described based on the of the in the individual at the and and represent the and is the from the which set at at the observed in of the than The for the and the in by and by inter-individual variability in an exponential manner on the of The model values is the concentration where to and code for and where The Simcyp Lua code of this model is provided in Figure To code this model, one functions that and the structural model, parameters and distribution and generate individual values and The first function is the function Simcyp Lua code for model on function how differential equations The function has the We have defined here the number of in the In have only one for the It is to values that are for all and individuals this function does not need to be called at level of The in code is to the state but other including covariates, can be here as The function at the population and simulation level and is called only once simulation. through all scripts for a to will in order of compound then then and step sequence within need to on an individual or compound We will with individual level and then compound level the is also The function that on individual level is called function as function We have here a that to The code for this is or for each individual of this will have a code of (see the have to this variable as and a Lua function to generate an individual for this of code here have of the population have the code and have the code but other can be The function is called once for each individual subject to individual We have used this function to set up a of using Simcyp are in the example in In the last of the step function used a set function to store and this is the first in model. need to code compound parameters with distribution types on the compound The function that to that level is called function is called once for each compound response step in the then then function We have an and for and as of We will code them as parameters that have distribution with the and the of the a distribution with assumed. More on the distribution are in this The input to the PD model is the total concentration of The simulator PD input as total or concentration or total amount in Since the input concentration is in the is from to We have these parameters from have the first for that and were will not have any the compound parameters and distribution need in the next step to from these distribution types and values to each To this need to a function called function at the individual-compound level and is called once for each individual compound and response step which on both compound type and individual, for example an individual clearance of a drug, can be function for In model have for the under function, using the distribution associated to each of them and individual values to the level function to be used for the We have one differential with and one We will the for the using a function called function can be if the is it is required. can it function return The type in Lua that can be not only with but also with or any other of the language, to the code can names of by a and it to a variable as function return The is a to or a reserved block of user state reserved by the can code the block of differential equations using a function called is to using the block in other such as in or in The and the returned represent the input (e.g. drug concentration or amount from the PBPK model, such as concentration in the or In example total concentration of The is a to a generic input The and are to or a reserved block of user state and user reserved by Simcyp by and will to and names can be used of as The used within the scope of this function will be as In the is to be on individual and is by individual according to the code. The is the Lua library function for function return up to can be in all custom The user to that the or names are used by each code example for this function is in the model code example (Appendix The total number of user be set up at the of a simulation via a within the The may also contain simple to other It is also to access the state or concentration. it is to the impact of different for and the or If the model does not contain ODEs, such as simple or models, then one can a different Step function from the dropdown menu called function (see example PD models6 or survival in can be using a different function called function to the simulation as the A code example of this function is for a survival model in in the supplementary have the of the Setup and Step functions of the Simcyp Lua script and have Simcyp Library Functions such as set functions and some for distribution functions providing of These will be to the next The Most custom Step functions have access to an of individual parameters specific to the step model for a Lua code in Setup functions may model values and store a in with the function as for the the can be with additional see the survival model code (Appendix Such functions store values at the same scoping level as the function within which (Figure 4). The functions the same level and if the information is not to the next scoping level to the functions need a only as such as the one used at the of the code for the total number of in the simulation. the same used a function to the state variable and other if to function how differential equations code are in the supplementary material are and used for the output of inter-individual variability and individual The function can be used to any values for the current script or can be used to any within the Simcyp The Simcyp Library provides only access to different as part of its virtual population to an individual by one of such as from a or step A code example for using these functions is in the next example as well as in the supplementary (Appendix The of includes and and The in Figure 3 give an of the of The of as part of the PBPK model is that a that is also used by the PD model will be the same for the same individual as is used in the PBPK model. The set function can be used to storage is provided at the level and at the individual levels through the and function, The storage allows additional values or to be set and for of the step for different may be at different functions to while and functions to storage (Figure 4). access is for at all levels with but is only for the same individual through in and Step functions as different individuals may be on different execution More are in the code (Appendix In different parameters for an inter-individual distribution that is used to generate individual values were set up with will be under the and there are types of random available for PD Custom scripting which are from the editor menu, and A distribution for inter-individual variability of model parameters can be through the function in the compound We have defined in the model two types of and in function, there a via to from that The individual is passed as to a step a user can from any of the distribution types via the library function to a Such calls will the same number within Simcyp as the function but the can be and used however the user not for inter-individual variability. A Simcyp simulation with a particular number a user may from a or a with a by a user or from a sequence will however be used to several other that individual can PD simulation of an individual is also set up with a with very from the PK approach maintains of various random of a simulation from a even when some in a model have to Simcyp Library distribution functions will calls in the number specific to the PD context in which the script is but will not the random number of PK based A user also has the option of generating random using in the Lua library for the library random number the functions. Since such calls are there is no to any built-in Simcyp sequence. Thus, the user will have to the effect of calls from multiple example shows a simple pharmacodynamic model commonly known as the model, from a and into a population model. code a model from a that is in Simcyp using Lua script that is equivalent to a code in A The concentration used as the PD input is not defined however it can from the PK model or as part of the data set with will this code as a model through a set of structural parameters by certain random inter-individual with structural values in a block and of the random in a to the and of by the The prediction includes an random represented by an and variable with a defined in the equivalent PD model can be in the PD model parameters specific to a and associated inter-individual random distribution are defined in a to the the Simcyp Simulator can be to individual values from each such distribution in an function and the individual values in the Simcyp The individual values will then be available to a parameterised step function as of function effect of used as function for function effect of on response PD input in the to response model response A variability in for can be through a Simcyp built-in The input include a called where this can be as the rather than example of Simcyp PD Custom scripting has been in this as part of an of factors response to the drug of the of on the in using a indirect PKPD response model incorporating a Details of the code are in that Supplementary additional of scripts are and available of the Simcyp Simulator. These to with the scripting language, Syntax and a for to the that different of the code such as and survival models where a user can individual or or the storage are provided in the supplementary The model are not by however the user can code the example of Simcyp Lua script for distribution is provided in the supplementary (Appendix The first of this scripting facility has on the simulation of custom PD models using the scripting language PKPD have own language using named blocks of code which are and as by the for or for differential equations in PKPD or In some the provides for user code to for a particular context and a user code a user may to specific once in the simulation or specific parameters to each The population modeling when used with its library, calls user code represented by a block in the associated control to equations for a PK model and a to the that a first from a first subsequent for a new Simcyp also these two different and specific Lua functions for namely: for execution and Lua are places that store values and are by default in a may however be to a particular function with the It is to variable to scope them within have scope limited and a to the block where are in the the Simcyp Library includes a number of functions to store within the C++ across different script calls and functions to access have not as been to include can be used for built-in PKPD model parameters when a user script is part of the model. a freely available library has been to a user to run Simcyp from the environment, commonly used for scripting facility has been for the will further of Simcyp parameters from these and potentially be used for models as The current Simcyp architecture of PD response allows the replacement of built-in models seamlessly and is in to more complex of response of drug response on some and parameters have been the Simcyp Lua scripting features have been to the user to individual in the as part of the population library that generates virtual is potentially if the user to these for a population of such as for a new disease or a particular Lua custom scripts may also in the of model components with external model as part of an example project has been developing a of disease models, of which be into Lua A has been which the new allows with a Simcyp Simulator to run in with other such as and and using the allows of the Simulator's of and PBPK models through other such as and A scripting facility for PD response models within the Simcyp Simulator has been a user can the built-in model for a PD step with a script using a The editor a library of Simcyp functions for in the Simulator and for or of the PK and PD simulation. In addition it the of complex PD models defined using with limited the Simcyp platform the of the Lua code allowing to access advanced modeling The Simcyp Simulator is freely available, of the to of and other for and A on Custom PD is provided in the Simcyp facility and is freely from the to the Simcyp the and are freely available on the Simcyp or by We and for with of the are of Simcyp and all the may be in the online of this The is not for the or of any information by the than be to the corresponding for the

References

13