calling r from net a case study using rapid nca the non compartmental analysis workflow tool
Download
Skip this Video
Download Presentation
Calling R from .NET: a case-study using Rapid NCA, the non-compartmental analysis workflow tool

Loading in 2 Seconds...

play fullscreen
1 / 33

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


  • 141 Views
  • Uploaded on

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?.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

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


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
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
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 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
complete deploy t ool
Complete & Deploy Tool
  • Can users understand how to use tool?
  • How confident are we in tool output?
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
ad