The Task Execution Language (TEL) for DDMoRe

Download Report

Transcript The Task Execution Language (TEL) for DDMoRe

The “DDMoRe” R package for workflow scripting
Mike K Smith, Pfizer
Jonathan Chard, Mango Solutions
This work is presented on behalf of the DDMoRe project
(www.ddmore.eu).
On behalf of the DDMoRe consortium
The Problem
 I have data I want to analyze.
 I want to design my next trial.
 I know models exist
• Published
• I could contact the author for code
 I need to transcribe to the software I have available.
 If there are problems…
• Is it my transcription?
• Is it errors in the manuscript?
EARL2014
Data sample (21 patients)
long duration clinical study of patients with glioma
Before treatment
During treatment
After treatment size decrease
After treatment size increase
EARL2014
TGI model
The Problem
 I have data I want to analyze.
 I want to design my next trial.
 I know models exist
• Published
• I could contact the author for code
 I need to transcribe to the software I have available.
 If there are problems…
• Is it my transcription?
• Is it errors in the manuscript?
EARL2014
Publication
EARL2014
TGI model
Schematic view
EARL2014
TGI model
The Problem
 I have data I want to analyze.
 I want to design my next trial.
 I know models exist
• Published
• I could contact the author for code
 I need to transcribe to the software I have available.
 If there are problems…
• Is it my transcription?
• Is it errors in the manuscript?
EARL2014
Monolix code
DESCRIPTION:
CCR2012_TGI_p5p2.mlxtran
DATA:
path = "%MLXPROJECT%/../Data/",
file ="dataLGG_PCV_nh2_nohead.csv",
headers = {ID,TIME,AMT,Y,MDV,EVID},
columnDelimiter = ","
INDIVIDUAL:
DELTAQP = {distribution=logNormal, iiv=yes},
GAMA = {distribution=logNormal, iiv=yes},
KDE = {distribution=logNormal, iiv=yes},
KPQ = {distribution=logNormal, iiv=yes},
KQPP = {distribution=logNormal, iiv=yes},
LAMBDAP = {distribution=logNormal, iiv=yes},
PT0 = {distribution=logNormal, iiv=yes},
Q0 = {distribution=logNormal, iiv=yes}
STRUCTURAL_MODEL:
file = "mlxt:TGI",
path = "%MLXPROJECT%",
output = {PSTAR}
OBSERVATIONS:
Pstar = {type=continuous, prediction=PSTAR, error=constant}
TASKS:
; settings
globalSettings={
EARL2014
The Problem
 I have data I want to analyze.
 I want to design my next trial.
 I know models exist
• Published
• I could contact the author for code
 I need to transcribe to the software I have available.
 If there are problems…
• Is it my transcription?
DAYS/WEEKS
• Is it errors in the manuscript?
• Is the model not applicable to my data?
EARL 2014
The Problem
March 2011 – February 2016
Noordwijkerhout workshop 2014
12
The vision
EARL2014
The vision
EARL2014
The vision
EARL2014
The vision
EARL2014
DDMoRe Framework Overview
EARL2014
Introduction
DDMoRe Framework Overview
EARL2014
Introduction
DDMoRe Framework Overview
EARL2014
Introduction
DDMoRe Framework Overview
EARL2014
Introduction
20
Model Repository
 Browsing using different
classifications
• Therapeutic areas – e.g. oncology
• Substance of interest – e.g. drug
 Sorting based on different orders
– alphabetical, therapeutic
 Display model overview and
definition
 Browse model files
 Open API/specification - reference
implementation available, follow
specification to create your own
EARL2014
Repository
MDL - Modelling Description Language
 Target independent model code
•Usable with different software targets commonly
used in modelling e.g. NONMEM, Monolix
EARL2014
MDL
Model display – files
EARL2014
Repository
MDL & MDL-IDE (Eclipse)
EARL2014
MDL - Modelling Description Language
 Independent model, data, parameter, task
objects
•Plug & Play different items
EARL2014
MDL
MDL – modularity
Language
MDL
Object Group
Objects
1. Tham 2008
2. Claret 2010
3. Ribba 2012
Public
Repository
MCL Modelling Object Group
Model
Parameter
1. Drug A
2. Drug B
3. Drug X
Data
Task & workflow definition
Task
Properties
R Script
1. Phase 2
2. Phase 3-1
3. Phase 3-2
Company
Repository
EARL2014
1. Estimation
2. CTS
3. Optimal Design
Different
tasks
MDL
MDL = Nouns + Verbs
 Models, Data, Parameters = Nouns
• Models – from DDMoRe model repository
• Data – your own, or provided via repository
• Parameters – (previously) estimated, guesstimated or initial values
 DDMoRe functions = “Verbs” = methods
• What do you want to do with the model? estimate, simulate, design,
read, plot, summary?
• Defines and scripts workflow with model + objects
• Define / extend to new methods…
 Task Properties = Adverbs
• “Like this…”
EARL2014
DDMoRe Framework – User perspective
Essentially
magic
Introduction
EARL2014
Integration of R into a the MDL-IDE
Eclipse IDE
+ StatET
EARL2014
Why R? Why an R package?
▪ R is open source, cross-platform
▪ Most of our target users are already familiar with R
▪
Familiarity in working with and manipulating R objects.
▪ Many tools already exist in R:
▪
e.g. Xpose, coda, lattice, ggplot2, PFIM
▪ Tools being developed & recoded for R:
▪
e.g. simulx, PopED
▪ Ability for our target users to contribute to and expand on
functionality after the end of the project.
EARL2014
Workflow & “recipes”
▪ Ability to define workflow
▪
Write R scripts to perform multiple tasks involved in fitting and
assessing one model.
▪ Ability to define functions for tasks which are performed
regularly.
▪
User uses DDMoRe package functions / methods and writes a wrapper
function to define repeatable units of workflow.
▪
E.g. Bootstrap estimation = sample data + estimate parameters + store
results and repeat <<n>> times.
▪
Make these “recipes” software agnostic.
▪ Ability to write “converters” to existing packages.
▪
E.g. as.xpdb (for Xpose); as.coda; as.pfim etc.
EARL2014
Workflow example - R script
▪
Read and visualise data.
▪
Assign Task Properties depending on task.
▪
Combine Data, Parameters, Model and Task Properties as appropriate.
▪
Execute task.
•
Translate model to target software e.g. NM-TRAN, Monolix
•
Translate task call to target software
•
Submit task and monitor status.
•
Parse & Convert output to standardised output object in R.
▪
Examine attributes of output object.
▪
Pass output to other packages e.g. Xpose, coda, simulx
▪
Perform next steps in workflow…
▪
Produce output using appropriate packages e.g. knitr
EARL2014
DDMoRe Framework – User perspective
Essentially
magic
Introduction
EARL2014
Framework – Technical perspective
Introduction
EARL2014
Background
 MDL is a “Domain Specific Language”
• Semantics/concepts derived from the domain of Pharmacometrics
• Syntax developed ourselves to fit the understanding/experience of
modeller
 MDL grammar implemented with Xtext, a framework for
developing programming languages
• Define grammar
• “Compilation” creates
- Java classes
- Parser
- Instance of Eclipse that supports the language
EARL2014
Crossing the language barrier
 How do we read an MDL file into R?
 Use an intermediary between R and the Framework
• R asks Framework Integration Service (“FIS”) for MDL in a file
• FIS parses model
• Returns JSON object
• R loads JSON with rjson
 R holds a parsed representation of the MDL in an object (S4)
• User can tweak elements of data, parameters, task properties.
• Model seen as “immutable” for each task.
EARL2014
MDL <-> (PharmML) <-> native code
JSON
R
Framework
Integration
Service
MDL
Converter
Toolbox
PharmML
FIS
JMS
Interoperability
Framework
Results
Script
Target Tool
PharmML & Files
JSON
FIS
R
EARL2014
Converter
Toolbox
PharmML
Interoperability
Framework
Technical Details
 Why R, Java and Web Services?
• R’s strengths:
- Data manipulation, data visualisation and user extensibility
- Best choice for implementation of user’s scripting tools
• Java’s strengths:
- File/network/job management
- Configuration, extension, pluggability
- Good choice for interoperability framework implementation
• Web Services strengths:
- Providing client-agnostic and language-agnostic functionality
- Best choice for gluing together disparate language environments
EARL2014
Flexible environment
Mixed environments
Local environment
Local environment
R
R
FIS
FIS
Framework
IF
IF(s)
Tool
Execution environment
(e.g. Grid, Cloud)
Tool
EARL2014
The Problem
How do you find disease or drug models that might be useful for
your analysis?
How can you be sure that published models are relevant?
How can you be sure that published models work (are reproducible)?
If code is available in software X, but you use software Y, how do
you translate the model and ensure that the result is
equivalent?
How much of your time is spent writing code to do tasks other
than fit models to data e.g. data processing, graphical
diagnostics, simulation?
EARL2014
The Solution
• How to store published models and their associated details (Repository)
•
Curation of these models to ensure reproducibility.
•
Metadata and ontologies to help you find the models you need.
• How to create, review, extend and combine published models using a
common modelling description language (MDL).
• Construct models, check syntax, perform tasks within an integrated
development environment (MDL-IDE).
•
Integrate with existing modelling tools via R (DDMoRe package).
• Provide standards for model inputs and outputs using a software
interchange standard language to allow translation between target
modelling tools (PharmML).
EARL2014
Road map
1-09-2012
Design & Prototype
1-03-2014
1-03-2016
Validation,
Core Developement Documentation & Training
M18
M36
M60
Public release Nov 2013
Public release
Q2 –Q4 2014
• PharmML specification
• Model Repository
• MDL specification
• Simulx
• MDL-IDE
• Framework
Demonstrator
Partners
43
BACKUP
EARL2014