Calling r from net a case study using rapid nca the non compartmental analysis workflow tool
This presentation is the property of its rightful owner.
Sponsored Links
1 / 33

Calling R from .NET: a case-study using Rapid NCA, the non-compartmental analysis workflow tool PowerPoint PPT Presentation


  • 102 Views
  • Uploaded on
  • Presentation posted in: General

Calling R from .NET: a case-study using Rapid NCA, the non-compartmental analysis workflow tool. Chris Campbell. Agenda. Using .NET Identify Opportunity Design Solution Develop Solution Connections with R.NET Complete & Deploy T ool. Using .NET What is .NET?.

Download Presentation

Calling R from .NET: a case-study using Rapid NCA, the non-compartmental analysis workflow tool

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Calling r from net a case study using rapid nca the non compartmental analysis workflow tool

Calling R from .NET: a case-study using Rapid NCA, the non-compartmental analysis workflow tool

Chris Campbell


Agenda

Agenda

  • Using .NET

  • Identify Opportunity

  • Design Solution

  • Develop Solution

  • Connections with R.NET

  • Complete & Deploy Tool


Using net what is net

Using .NETWhat is .NET?

  • Object-oriented environment to develop applications

  • Safe execution environment

  • Choice of programming languages

  • Framework consisting of:

    • runtime

    • class library

  • Developed with Visual Studio


Using net visual studio

Using .NETVisual Studio

  • A graphical programming tool (IDE)

  • Also, Visual Studio Express is a free version


Using net choice of languages

Using .NETChoice of languages

  • Tried and tested languages

  • C# is the main one

  • F# is a functional language (not a steep learning curve if you know OCaml)

  • Knowledge of XAML (a Microsoft declarative XML language) is required for state of the art graphics

  • C++/CLI useful for legacy and bespoke parallel processing (including GPGPU)

  • Other possibilities..

  • Vb.Net is very like C# (no advantage over it)

  • Third parties have added languages to the CLI platform


Using net an ajar source platform

Using .NETAn “ajar source” platform

  • Not exactly open source, but…

  • Most CLI third party languages are open

  • C# and VB.Net are not – but many open source projects based on them

  • Microsoft have made F# open source

  • There are free (Express) versions of Visual Studio for the languages

  • Compiler is free and other editors / IDEs are available (but not usually preferred by developers)


Using net performance and computation

Using .NETPerformance and Computation

  • Performance is very good

  • On graphics (millions of data points will plot with ease and zoom smoothly)

  • Computation is fast enough in C#, calling R adds little overhead

  • Standard Maths library is limited; third parties and MS maths for “drawing” are better

  • Data parallel computation is possible on the desktop (GPGPU)

  • F# provides further “big data” capabilities


A project case study

A Project Case Study


Identify opportunity

Identify Opportunity

  • Where can repetitive tasks be automated?

  • How can regular outputs be generated?

  • How can we make methods and techniques more accessible to colleagues?


Identify opportunity1

Identify Opportunity

  • Customer needed to send monthly reports to dozens of trial centres

  • Small team, so time limited

  • Normally simple non-compartmental analysis, standard report


Design solution

Design Solution

  • What is the simplest way for the task to be performed?

  • Which steps can be eliminated?

  • What are barriers to understanding for users?


Design solution streamline workflow what is needed

Design SolutionStreamline WorkflowWhat is Needed?

  • Import data to analysis software

  • Map variables

  • Select units

  • Select non-compartmental

  • Select model

  • Select interpolation

  • Select rules for BLQ

  • Select terminal phase calculation method

  • Perform analysis

  • Choose partial area

  • Export results

  • Export plots

  • Write report

  • Format report


Design solution analysis engine using r

Design SolutionAnalysis Engine using R


Let s get net technical

Let’s get .Net technical..


Connections with r net

Connections with R.NET

  • What will be provided to R?

  • What will be returned from R?

  • What happens if something goes wrong?


Connections with r net using the r service

Connections with R.NETUsing the R Service

  • R.NET allows R calls to be submitted to an R service

  • R.NET is not the only option

  • R.NET connects to R down to Expression level

  • So objects can effectively be passed back into .NET

  • Recommend a robust .Net framework to do this


Connections with r net1

_pluginsManager = newRPluginManager(PluginLocation, RLocation);

_pluginsManager.SetActivePlugin();

_session = _pluginsManager.GetSession();

boolsessionOk = _pluginsManager.TryMakeSession(out_session);

Connections with R.NET

  • R is efficiently accessed, via R.Net (as pictured in Visual Studio) via a Plugin (as above)


Connections with r net engineer s framework

Connections with R.NET“Engineer’s” framework


Connections with r net robustness

Connections with R.NETRobustness

  • Function may be passed data outside it’s anticipated structure

> checkOrderedVector(c(0, 1, 3, 2, 4),

+ description = "Time")

Error in checkOrderedVector(c(0, 1, 3, 2, 4),

description = "Time") :

Error: Time is not ordered. Actual value is 0 1 3 2 4

>


Connections with r net robustness1

Connections with R.NETRobustness

  • The tool expects a certain return object

  • An error in an R call should be trapped by the communicating function

  • Return object passed as normal

  • An error checking element of the return object can report information about the error

> check01 <- try(checkOrderedVector(Time,

+ description = "Time"), silent = TRUE)

>


Connections with r net using the framework

_pluginsManager = newRPluginManager(PluginLocation, RLocation);

_pluginsManager.SetActivePlugin();

_session = _pluginsManager.GetSession();

boolsessionOk = _pluginsManager.TryMakeSession(out_session);

_session.SetNumericSymbol("TimePtVector", CheckTimePointData(toAnalyse));

_session.SetNumericSymbol("ConcVector", CheckConcentrationPointData(toAnalyse));

varevalString = string.Format("ncaAnalysis(TimePtVector, ConcVector, …

MathEngineDataRowDto<double> ncaGetBack =

_session.PerformNumericEvaluation(evalString, "ROutput_Error");

_lastErrors = ncaGetBack.ErrorStrings;

_session.FlushConsole();

_pluginsManager.RelinquishSession();

Connections with R.NETUsing the framework


A rapid solution

A Rapid Solution


Complete deploy t ool

Complete & Deploy Tool

  • Can users understand how to use tool?

  • How confident are we in tool output?


Deploy t ool

Deploy Tool


Data import

Data Import


Map variables

Map Variables


Review analysis

Review Analysis


Review grouping

Review Grouping


Generate report

Generate Report


Select report type

Select Report Type


Add group comments

Add Group Comments


View report

View Report


Conclusions

Conclusions

  • Great graphical interfaces can be built using .NET

  • Intuitive interactive features are available

  • R.NET allows R analysis to be accessed as a service

  • Good coding practice will ensure application is robust

  • Work on a well engineered framework will be rewarded with desktop solutions created at high speed


  • Login