SlideShare a Scribd company logo
1 of 41
The SynergyScreen Package
Yury V Bukhman
MadR Meetup, 18 January 2017
Overview
Scientific background
SynergyScreen functionality
Using S4 classes
Developing a package
www.glbrc.org
2
Scientific Background
www.glbrc.org
3
How to Make Biofuels
www.glbrc.org
4
HydrolysateBiomass
Microbes
Fuel
Problem: hydrolysate
contains compounds
that are toxic to
microbes
What is Synergy?
Synergy is “the interaction or cooperation of
two or more organizations, substances, or
other agents to produce a combined effect
greater than the sum of their separate
effects” (Google)
Synergy is when the effect of two toxins is
greater than expected when they do not
interact
The opposite of synergy is called antagonism
www.glbrc.org
5
The Isobole Method
Interaction Index: 𝐼 =
𝑑 𝐴
𝐷 𝐴
+
𝑑 𝐵
𝐷 𝐵
www.glbrc.org
6
No interaction: I = 1 Synergy: I < 1 Antagonism: I > 1
Single Ray Experimental
Design
www.glbrc.org
7
Dose-Response Curve
www.glbrc.org
8
Median effect equation:
Experiments in Microtiter
Plates
www.glbrc.org
9
96 Well Plate Layouts
www.glbrc.org
10
SynergyScreen Functionality
www.glbrc.org
11
SynergyScreen Workflow
Input: a set of compounds and dose ranges
Generate experimental design
[A wet lab scientist conducts the experiment]
Read in experimental results
Compute
 Normalize data from multiple plates
 Model dose-response curves
 Compute interaction index values
Find synergies and antagonisms
Plot results
 Interaction matrix
 Isoboles
 Dose-response curves
www.glbrc.org
12
SynergyScreen Commands
See quick start vignette
www.glbrc.org
13
Using S4 Classes
www.glbrc.org
14
S4 Classes
Why use classes? As opposed to (nested) lists and data
frames?
 Constrain and validate contents of objects
 Define custom show, plot and other methods
 Inheritance
[At least] 3 OOP systems in R: S3, S4 and RC
S4 is recommended by Bioconductor project
S4 learning resources
 Hadley Wickham, Advanced R, OO field guide, S4: http://adv-
r.had.co.nz/OO-essentials.html#s4
 John Chambers’ Software for Data Analysis
 S4 system development in Bioconductor
 My S4 slides: http://rpubs.com/ybukhman/intro_to_S4
www.glbrc.org
15
Synergy Screen Structure
Synergy screen
 Compounds
 Experimental design
 Raw data
 Normalized data
 Dose-response experiments
• Compounds; doses; responses; models
 Synergy experiments
• Dose-response experiments
 Interaction index values
www.glbrc.org
16
Define an S4 class
www.glbrc.org
17
Slot accessors
www.glbrc.org
18
Define generic functions
Define methods
Auto-generate accessors
Use function standardMethods from
package distr.
www.glbrc.org
19
Custom plot method
www.glbrc.org
20
Generic plot function supplied by R: plot(x, y, …)
Debug a method
www.glbrc.org
21
I know this is a hack. However, in my hands, setting break points in
Rstudio or using trace() did not consistently work.
An S4 class that extends list
How: use contains argument with setClass
Why: constrain list elements, e.g. to be of the same
class, DRE
www.glbrc.org
22
setClass("DREList", contains="list",
validity=function(object) {
checks = sapply(object, is, "DRE")
if(!all(checks)) {
return(paste("The following elements are not of class DRE:",
paste(object[!checks], collapse="; ")))
}
# Check names
cnames = sapply(object, function(x) x@name)
if (is.null(names(object)) || any(names(object) != cnames){
return("Inconsistent names")
}
# All done
return(TRUE)
}
)
Coerce list to S4 class
www.glbrc.org
23
Developing a Package
www.glbrc.org
24
Why develop a package?
Users can download and install your software
using standard procedures
Provide documentation for your software
Provide example dataset(s)
Submit your code to CRAN or Bioconductor
Publish a paper
www.glbrc.org
25
Initialize a new R package
Create a new package from an R session:
devtools::create(“MyNewPackage”)
Initialize a project at a git or SVN server
Edit DESCRIPTION
Let roxygen2 generate and manage NAMESPACE
Add a package documentation file, e.g. MyNewPackage.R
Start writing a vignette:
devtools::use_vignette(“my-first-
vignette”)
www.glbrc.org
26
DESCRIPTION
Information about your package and its
maintainer
License
List of other packages that your package
needs to function
Information on how to collate files in your
package (autogenerated by roxygen2)
www.glbrc.org
27
Package structure
Project root folder: DESCRIPTION, NAMESPACE,
.gitignore, .Rbuildignore, RStudio project file
(SynergyScreen.Rproj)
Subfolders
 R – .R files that contain functions, classes, methods etc.
 man – help pages (.Rd)
 data - datasets
 tests – test scripts
 vignettes – long-form documentation using R markdown
 inst – other stuff, e.g. raw data files, one-off scripts etc.
www.glbrc.org
28
Document your package
Use roxygen2 to parse specially formatted
comments and generate documentation (.Rd)
files
Write long form documentation in the form
of vignettes
www.glbrc.org
29
Package documentation file
www.glbrc.org
30
Document a class
www.glbrc.org
31
Document a method
www.glbrc.org
32
[….]
Document accessor methods
www.glbrc.org
33
Document accessor methods
continued
www.glbrc.org
34
Document a dataset
www.glbrc.org
35
Organize code and
documentation files
Organize by generic function
Organize by class
Use @include tags to specify collation
order
Put data documentation in data.R
www.glbrc.org
36
Namespace
Why namespaces?
 Avoid confusion when different packages define functions that have
the same name
 Import functions from other packages
 Export functions from your package to make them accessible to others
Poor practice
 Edit file NAMESPACE manually
 Export everything
www.glbrc.org
37
Good Practice
Read Hadley’s book, http://r-
pkgs.had.co.nz/namespace.html
Let roxygen2 generate the NAMESPACE file
For imports:
 List packages under Imports field in DESCRIPTION
 Call functions explicitly by package::function
 For frequently used functions, use @importFrom package
function
 To import all functions from a package, use @import package
For exports:
 use the @export tag to export functions, classes and methods
 Datasets are exported automatically: no need for @export
www.glbrc.org
38
A NAMESPACE file generated
by roxygen2
www.glbrc.org
39
Tests
Why test? Verify that new edits do not inadvertently damage
previously developed functionality.
Use package testthat. Read Hadley’s book: http://r-
pkgs.had.co.nz/tests.html
Do a package check or just run the tests. The former also
checks syntax, documentation etc.
www.glbrc.org
40
Questions?
www.glbrc.org
41

More Related Content

Viewers also liked

Commonly Used Statistics in Medical Research Part I
Commonly Used Statistics in Medical Research Part ICommonly Used Statistics in Medical Research Part I
Commonly Used Statistics in Medical Research Part IPat Barlow
 
Fixed Dose combination ppt
Fixed Dose combination  pptFixed Dose combination  ppt
Fixed Dose combination pptKamini Sharma
 
Fixed dose drug combinations
Fixed dose drug combinationsFixed dose drug combinations
Fixed dose drug combinationsVishnu Vardhan
 
Statistical Treatment
Statistical TreatmentStatistical Treatment
Statistical TreatmentDaryl Tabogoc
 
Statistical tools in research
Statistical tools in researchStatistical tools in research
Statistical tools in researchShubhrat Sharma
 
Common statistical tools used in research and their uses
Common statistical tools used in research and their usesCommon statistical tools used in research and their uses
Common statistical tools used in research and their usesNorhac Kali
 
Lecture 2 Dose Response Relationship 1
Lecture 2  Dose Response Relationship 1Lecture 2  Dose Response Relationship 1
Lecture 2 Dose Response Relationship 1Dr Shah Murad
 
Commonly Used Statistics in Survey Research
Commonly Used Statistics in Survey ResearchCommonly Used Statistics in Survey Research
Commonly Used Statistics in Survey ResearchPat Barlow
 

Viewers also liked (8)

Commonly Used Statistics in Medical Research Part I
Commonly Used Statistics in Medical Research Part ICommonly Used Statistics in Medical Research Part I
Commonly Used Statistics in Medical Research Part I
 
Fixed Dose combination ppt
Fixed Dose combination  pptFixed Dose combination  ppt
Fixed Dose combination ppt
 
Fixed dose drug combinations
Fixed dose drug combinationsFixed dose drug combinations
Fixed dose drug combinations
 
Statistical Treatment
Statistical TreatmentStatistical Treatment
Statistical Treatment
 
Statistical tools in research
Statistical tools in researchStatistical tools in research
Statistical tools in research
 
Common statistical tools used in research and their uses
Common statistical tools used in research and their usesCommon statistical tools used in research and their uses
Common statistical tools used in research and their uses
 
Lecture 2 Dose Response Relationship 1
Lecture 2  Dose Response Relationship 1Lecture 2  Dose Response Relationship 1
Lecture 2 Dose Response Relationship 1
 
Commonly Used Statistics in Survey Research
Commonly Used Statistics in Survey ResearchCommonly Used Statistics in Survey Research
Commonly Used Statistics in Survey Research
 

Similar to The SynergyScreen Package

Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBRaghunath A
 
Code camp 2014 Talk Scientific Thinking
Code camp 2014 Talk Scientific ThinkingCode camp 2014 Talk Scientific Thinking
Code camp 2014 Talk Scientific ThinkingMitch Miller
 
ProGuard / DexGuard Tips and Tricks
ProGuard / DexGuard Tips and TricksProGuard / DexGuard Tips and Tricks
ProGuard / DexGuard Tips and Tricksnetomi
 
GraphQL Advanced
GraphQL AdvancedGraphQL Advanced
GraphQL AdvancedLeanIX GmbH
 
R programming for data science
R programming for data scienceR programming for data science
R programming for data scienceSovello Hildebrand
 
Groovygrailsnetbeans 12517452668498-phpapp03
Groovygrailsnetbeans 12517452668498-phpapp03Groovygrailsnetbeans 12517452668498-phpapp03
Groovygrailsnetbeans 12517452668498-phpapp03Kevin Juma
 
Through the firewall with miniCRAN
Through the firewall with miniCRANThrough the firewall with miniCRAN
Through the firewall with miniCRANRevolution Analytics
 
Developing applications with rules, workflow and event processing (it@cork 2010)
Developing applications with rules, workflow and event processing (it@cork 2010)Developing applications with rules, workflow and event processing (it@cork 2010)
Developing applications with rules, workflow and event processing (it@cork 2010)Geoffrey De Smet
 
Applying soft computing techniques to corporate mobile security systems
Applying soft computing techniques to corporate mobile security systemsApplying soft computing techniques to corporate mobile security systems
Applying soft computing techniques to corporate mobile security systemsPaloma De Las Cuevas
 
Offline Reinforcement Learning for Informal Summarization in Online Domains.pdf
Offline Reinforcement Learning for Informal Summarization in Online Domains.pdfOffline Reinforcement Learning for Informal Summarization in Online Domains.pdf
Offline Reinforcement Learning for Informal Summarization in Online Domains.pdfPo-Chuan Chen
 
Tech Talk - JPA and Query Optimization - publish
Tech Talk  -  JPA and Query Optimization - publishTech Talk  -  JPA and Query Optimization - publish
Tech Talk - JPA and Query Optimization - publishGleydson Lima
 
Managing large scale projects in R with R Suite
Managing large scale projects in R with R SuiteManaging large scale projects in R with R Suite
Managing large scale projects in R with R SuiteWLOG Solutions
 
Recommendation and graph algorithms in Hadoop and SQL
Recommendation and graph algorithms in Hadoop and SQLRecommendation and graph algorithms in Hadoop and SQL
Recommendation and graph algorithms in Hadoop and SQLDavid Gleich
 
GraphQL & DGraph with Go
GraphQL & DGraph with GoGraphQL & DGraph with Go
GraphQL & DGraph with GoJames Tan
 
Rule Engine & Drools
Rule Engine & DroolsRule Engine & Drools
Rule Engine & DroolsSandip Jadhav
 

Similar to The SynergyScreen Package (20)

Proguard android
Proguard androidProguard android
Proguard android
 
Testing Spring Applications
Testing Spring ApplicationsTesting Spring Applications
Testing Spring Applications
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Code camp 2014 Talk Scientific Thinking
Code camp 2014 Talk Scientific ThinkingCode camp 2014 Talk Scientific Thinking
Code camp 2014 Talk Scientific Thinking
 
ProGuard / DexGuard Tips and Tricks
ProGuard / DexGuard Tips and TricksProGuard / DexGuard Tips and Tricks
ProGuard / DexGuard Tips and Tricks
 
Drools rule Concepts
Drools rule ConceptsDrools rule Concepts
Drools rule Concepts
 
GraphQL Advanced
GraphQL AdvancedGraphQL Advanced
GraphQL Advanced
 
R programming for data science
R programming for data scienceR programming for data science
R programming for data science
 
Groovygrailsnetbeans 12517452668498-phpapp03
Groovygrailsnetbeans 12517452668498-phpapp03Groovygrailsnetbeans 12517452668498-phpapp03
Groovygrailsnetbeans 12517452668498-phpapp03
 
Through the firewall with miniCRAN
Through the firewall with miniCRANThrough the firewall with miniCRAN
Through the firewall with miniCRAN
 
Developing applications with rules, workflow and event processing (it@cork 2010)
Developing applications with rules, workflow and event processing (it@cork 2010)Developing applications with rules, workflow and event processing (it@cork 2010)
Developing applications with rules, workflow and event processing (it@cork 2010)
 
Applying soft computing techniques to corporate mobile security systems
Applying soft computing techniques to corporate mobile security systemsApplying soft computing techniques to corporate mobile security systems
Applying soft computing techniques to corporate mobile security systems
 
Offline Reinforcement Learning for Informal Summarization in Online Domains.pdf
Offline Reinforcement Learning for Informal Summarization in Online Domains.pdfOffline Reinforcement Learning for Informal Summarization in Online Domains.pdf
Offline Reinforcement Learning for Informal Summarization in Online Domains.pdf
 
Tech Talk - JPA and Query Optimization - publish
Tech Talk  -  JPA and Query Optimization - publishTech Talk  -  JPA and Query Optimization - publish
Tech Talk - JPA and Query Optimization - publish
 
Managing large scale projects in R with R Suite
Managing large scale projects in R with R SuiteManaging large scale projects in R with R Suite
Managing large scale projects in R with R Suite
 
Recommendation and graph algorithms in Hadoop and SQL
Recommendation and graph algorithms in Hadoop and SQLRecommendation and graph algorithms in Hadoop and SQL
Recommendation and graph algorithms in Hadoop and SQL
 
GraphQL & DGraph with Go
GraphQL & DGraph with GoGraphQL & DGraph with Go
GraphQL & DGraph with Go
 
Rule Engine & Drools
Rule Engine & DroolsRule Engine & Drools
Rule Engine & Drools
 
Custom plugin
Custom pluginCustom plugin
Custom plugin
 
Grails Custom Plugin
Grails Custom PluginGrails Custom Plugin
Grails Custom Plugin
 

Recently uploaded

Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.aasikanpl
 
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCESTERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCEPRINCE C P
 
Luciferase in rDNA technology (biotechnology).pptx
Luciferase in rDNA technology (biotechnology).pptxLuciferase in rDNA technology (biotechnology).pptx
Luciferase in rDNA technology (biotechnology).pptxAleenaTreesaSaji
 
Disentangling the origin of chemical differences using GHOST
Disentangling the origin of chemical differences using GHOSTDisentangling the origin of chemical differences using GHOST
Disentangling the origin of chemical differences using GHOSTSérgio Sacani
 
Orientation, design and principles of polyhouse
Orientation, design and principles of polyhouseOrientation, design and principles of polyhouse
Orientation, design and principles of polyhousejana861314
 
VIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C PVIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C PPRINCE C P
 
G9 Science Q4- Week 1-2 Projectile Motion.ppt
G9 Science Q4- Week 1-2 Projectile Motion.pptG9 Science Q4- Week 1-2 Projectile Motion.ppt
G9 Science Q4- Week 1-2 Projectile Motion.pptMAESTRELLAMesa2
 
Boyles law module in the grade 10 science
Boyles law module in the grade 10 scienceBoyles law module in the grade 10 science
Boyles law module in the grade 10 sciencefloriejanemacaya1
 
Bentham & Hooker's Classification. along with the merits and demerits of the ...
Bentham & Hooker's Classification. along with the merits and demerits of the ...Bentham & Hooker's Classification. along with the merits and demerits of the ...
Bentham & Hooker's Classification. along with the merits and demerits of the ...Nistarini College, Purulia (W.B) India
 
zoogeography of pakistan.pptx fauna of Pakistan
zoogeography of pakistan.pptx fauna of Pakistanzoogeography of pakistan.pptx fauna of Pakistan
zoogeography of pakistan.pptx fauna of Pakistanzohaibmir069
 
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...Lokesh Kothari
 
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroidsHubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroidsSérgio Sacani
 
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...jana861314
 
Physiochemical properties of nanomaterials and its nanotoxicity.pptx
Physiochemical properties of nanomaterials and its nanotoxicity.pptxPhysiochemical properties of nanomaterials and its nanotoxicity.pptx
Physiochemical properties of nanomaterials and its nanotoxicity.pptxAArockiyaNisha
 
Isotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoIsotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoSérgio Sacani
 
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |aasikanpl
 
Grafana in space: Monitoring Japan's SLIM moon lander in real time
Grafana in space: Monitoring Japan's SLIM moon lander  in real timeGrafana in space: Monitoring Japan's SLIM moon lander  in real time
Grafana in space: Monitoring Japan's SLIM moon lander in real timeSatoshi NAKAHIRA
 
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43bNightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43bSérgio Sacani
 
Biological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdfBiological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdfmuntazimhurra
 

Recently uploaded (20)

Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
 
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCESTERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
 
Luciferase in rDNA technology (biotechnology).pptx
Luciferase in rDNA technology (biotechnology).pptxLuciferase in rDNA technology (biotechnology).pptx
Luciferase in rDNA technology (biotechnology).pptx
 
Disentangling the origin of chemical differences using GHOST
Disentangling the origin of chemical differences using GHOSTDisentangling the origin of chemical differences using GHOST
Disentangling the origin of chemical differences using GHOST
 
Orientation, design and principles of polyhouse
Orientation, design and principles of polyhouseOrientation, design and principles of polyhouse
Orientation, design and principles of polyhouse
 
VIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C PVIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C P
 
G9 Science Q4- Week 1-2 Projectile Motion.ppt
G9 Science Q4- Week 1-2 Projectile Motion.pptG9 Science Q4- Week 1-2 Projectile Motion.ppt
G9 Science Q4- Week 1-2 Projectile Motion.ppt
 
Boyles law module in the grade 10 science
Boyles law module in the grade 10 scienceBoyles law module in the grade 10 science
Boyles law module in the grade 10 science
 
Bentham & Hooker's Classification. along with the merits and demerits of the ...
Bentham & Hooker's Classification. along with the merits and demerits of the ...Bentham & Hooker's Classification. along with the merits and demerits of the ...
Bentham & Hooker's Classification. along with the merits and demerits of the ...
 
zoogeography of pakistan.pptx fauna of Pakistan
zoogeography of pakistan.pptx fauna of Pakistanzoogeography of pakistan.pptx fauna of Pakistan
zoogeography of pakistan.pptx fauna of Pakistan
 
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
 
The Philosophy of Science
The Philosophy of ScienceThe Philosophy of Science
The Philosophy of Science
 
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroidsHubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
 
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...
 
Physiochemical properties of nanomaterials and its nanotoxicity.pptx
Physiochemical properties of nanomaterials and its nanotoxicity.pptxPhysiochemical properties of nanomaterials and its nanotoxicity.pptx
Physiochemical properties of nanomaterials and its nanotoxicity.pptx
 
Isotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoIsotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on Io
 
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |
 
Grafana in space: Monitoring Japan's SLIM moon lander in real time
Grafana in space: Monitoring Japan's SLIM moon lander  in real timeGrafana in space: Monitoring Japan's SLIM moon lander  in real time
Grafana in space: Monitoring Japan's SLIM moon lander in real time
 
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43bNightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
 
Biological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdfBiological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdf
 

The SynergyScreen Package

  • 1. The SynergyScreen Package Yury V Bukhman MadR Meetup, 18 January 2017
  • 2. Overview Scientific background SynergyScreen functionality Using S4 classes Developing a package www.glbrc.org 2
  • 4. How to Make Biofuels www.glbrc.org 4 HydrolysateBiomass Microbes Fuel Problem: hydrolysate contains compounds that are toxic to microbes
  • 5. What is Synergy? Synergy is “the interaction or cooperation of two or more organizations, substances, or other agents to produce a combined effect greater than the sum of their separate effects” (Google) Synergy is when the effect of two toxins is greater than expected when they do not interact The opposite of synergy is called antagonism www.glbrc.org 5
  • 6. The Isobole Method Interaction Index: 𝐼 = 𝑑 𝐴 𝐷 𝐴 + 𝑑 𝐵 𝐷 𝐵 www.glbrc.org 6 No interaction: I = 1 Synergy: I < 1 Antagonism: I > 1
  • 10. 96 Well Plate Layouts www.glbrc.org 10
  • 12. SynergyScreen Workflow Input: a set of compounds and dose ranges Generate experimental design [A wet lab scientist conducts the experiment] Read in experimental results Compute  Normalize data from multiple plates  Model dose-response curves  Compute interaction index values Find synergies and antagonisms Plot results  Interaction matrix  Isoboles  Dose-response curves www.glbrc.org 12
  • 13. SynergyScreen Commands See quick start vignette www.glbrc.org 13
  • 15. S4 Classes Why use classes? As opposed to (nested) lists and data frames?  Constrain and validate contents of objects  Define custom show, plot and other methods  Inheritance [At least] 3 OOP systems in R: S3, S4 and RC S4 is recommended by Bioconductor project S4 learning resources  Hadley Wickham, Advanced R, OO field guide, S4: http://adv- r.had.co.nz/OO-essentials.html#s4  John Chambers’ Software for Data Analysis  S4 system development in Bioconductor  My S4 slides: http://rpubs.com/ybukhman/intro_to_S4 www.glbrc.org 15
  • 16. Synergy Screen Structure Synergy screen  Compounds  Experimental design  Raw data  Normalized data  Dose-response experiments • Compounds; doses; responses; models  Synergy experiments • Dose-response experiments  Interaction index values www.glbrc.org 16
  • 17. Define an S4 class www.glbrc.org 17
  • 19. Auto-generate accessors Use function standardMethods from package distr. www.glbrc.org 19
  • 20. Custom plot method www.glbrc.org 20 Generic plot function supplied by R: plot(x, y, …)
  • 21. Debug a method www.glbrc.org 21 I know this is a hack. However, in my hands, setting break points in Rstudio or using trace() did not consistently work.
  • 22. An S4 class that extends list How: use contains argument with setClass Why: constrain list elements, e.g. to be of the same class, DRE www.glbrc.org 22 setClass("DREList", contains="list", validity=function(object) { checks = sapply(object, is, "DRE") if(!all(checks)) { return(paste("The following elements are not of class DRE:", paste(object[!checks], collapse="; "))) } # Check names cnames = sapply(object, function(x) x@name) if (is.null(names(object)) || any(names(object) != cnames){ return("Inconsistent names") } # All done return(TRUE) } )
  • 23. Coerce list to S4 class www.glbrc.org 23
  • 25. Why develop a package? Users can download and install your software using standard procedures Provide documentation for your software Provide example dataset(s) Submit your code to CRAN or Bioconductor Publish a paper www.glbrc.org 25
  • 26. Initialize a new R package Create a new package from an R session: devtools::create(“MyNewPackage”) Initialize a project at a git or SVN server Edit DESCRIPTION Let roxygen2 generate and manage NAMESPACE Add a package documentation file, e.g. MyNewPackage.R Start writing a vignette: devtools::use_vignette(“my-first- vignette”) www.glbrc.org 26
  • 27. DESCRIPTION Information about your package and its maintainer License List of other packages that your package needs to function Information on how to collate files in your package (autogenerated by roxygen2) www.glbrc.org 27
  • 28. Package structure Project root folder: DESCRIPTION, NAMESPACE, .gitignore, .Rbuildignore, RStudio project file (SynergyScreen.Rproj) Subfolders  R – .R files that contain functions, classes, methods etc.  man – help pages (.Rd)  data - datasets  tests – test scripts  vignettes – long-form documentation using R markdown  inst – other stuff, e.g. raw data files, one-off scripts etc. www.glbrc.org 28
  • 29. Document your package Use roxygen2 to parse specially formatted comments and generate documentation (.Rd) files Write long form documentation in the form of vignettes www.glbrc.org 29
  • 36. Organize code and documentation files Organize by generic function Organize by class Use @include tags to specify collation order Put data documentation in data.R www.glbrc.org 36
  • 37. Namespace Why namespaces?  Avoid confusion when different packages define functions that have the same name  Import functions from other packages  Export functions from your package to make them accessible to others Poor practice  Edit file NAMESPACE manually  Export everything www.glbrc.org 37
  • 38. Good Practice Read Hadley’s book, http://r- pkgs.had.co.nz/namespace.html Let roxygen2 generate the NAMESPACE file For imports:  List packages under Imports field in DESCRIPTION  Call functions explicitly by package::function  For frequently used functions, use @importFrom package function  To import all functions from a package, use @import package For exports:  use the @export tag to export functions, classes and methods  Datasets are exported automatically: no need for @export www.glbrc.org 38
  • 39. A NAMESPACE file generated by roxygen2 www.glbrc.org 39
  • 40. Tests Why test? Verify that new edits do not inadvertently damage previously developed functionality. Use package testthat. Read Hadley’s book: http://r- pkgs.had.co.nz/tests.html Do a package check or just run the tests. The former also checks syntax, documentation etc. www.glbrc.org 40