Quality Network Analysis
Quickly and Cheaply
Cytoscape Cyberinfrastructure
Chapter 2
ISMB/NetBioSIG 2016
Orlando, Florida
July 8, 2016
Keiichiro Ono, Eric Sage & Barry Demchak
Ideker Lab
1
Problems and Solutions
 Creating (Network Biology) Software is slow
and expensive
 We want
 Novel and reproducible workflows
 Mature standardized workflows
 Sharable networks, workflows, and results
 More memory, processors & storage
 Cytoscape Cyberinfrastructure (CI)
 Distributed microservice-based architecture
2
What I Hope to Convey Today
 How to build network biology workflows
• Using reusable components (*** God reuses code!)
• Computational
• Storage
• User interface
• Coordinate with Cytoscape, NDEx, and other
NB assets
 How to build reusable components
 Useful from Cytoscape and other programs
 The “reuse party” is worth coming to! 3
Imagine Your New Application
4Enriched Networks
Putative drivers
Where are we now?
 Python + Jupyter, R + RStudio, Matlab
 General functionality, agile, shareable code,
reproducible workflows
 Young analysis/viz, data silos, short jobs, no scaling
 Cytoscape / NDEx / cyREST / cytoscape.js
 Mature, extensible, shareable networks
 Non-agile, no scaling, non-reproducible
 Taverna / Galaxy
 Mature, reproducible workflows, big data
 Non-agile, data silos
 GenomeSpace, GenePattern … 5
Cytoscape CI Microservice Approach
Network Biology Services
6
Computation Storage
Workflow Visualization
Analysis
Layout
App Service
Message Bus (REST/Internet)
Return(yyy)
Calculate(xxx)
Calculate(xxx)
Return(yyy)
1 2 34
What is a Microservice?
App Service
Return(yyy)
Calculate(xxx)
Time
7
 Late Binding
 Scalability
 Reusability
 Language choice
Partial Workflow
8
Selection/
Enrichment
Application
Relevance
Service
NDEx Network
Database
Node List Query
Network List
Prioritized
Network List
Services in Action – Cytoscape as Service
Jupyter application calls Cytoscape/cyREST
as a service for visualizing networks
9
Send Network
Send Styles cyREST / Cytoscape
(Click here for video showing Jupyter creating network in Cytoscape)
Important Considerations
 How do I call or build a service?
 What (actually) is being exchanged?
 Where does the service run?
 What if your service becomes popular?
 How to do create a good service?
 What if your service is too slow?
 What if your service is buggy? 10
Anatomy of a Service Call
11
Send Network
Send Styles
cyREST /
Cytoscape
igraph
py2cytoscape
igraph2CX
model.impl
CX.impl
cyREST
cyREST1 / Internet
CX encode/decode
Local network model
App ServiceCI
1http://www.ncbi.nlm.nih.gov/pubmed/26672762
Making Your Service Real
1. Create function
 Python, R, Go, Java …
2. Add REST wrapper
 Eve, OpenCPU, GoRilla, Jersey…
3. Add client call using REST
12
Function
Data CX
REST
Function
Data CX
App
CX
REST
Function
Data CXData
REST
More later … Network + params
on server
Important Considerations
 How do I call or build a service?
 What (actually) is being exchanged?
 Where does the service run?
 What if your service becomes popular?
 What if your service is too slow?
 What if your service is buggy?
 How to do you test your service? 13
CX Transfer Format
1
3 2
Example Graph
4
5
nodes Aspect
edges Aspect
cartesianLayout Aspect
Aspect Relationships
Organizes
Positions
ID=1 ID=2 ID=3
nodes Aspect (3 nodes)
edges Aspect (2 edges)
Source Target Source TargetID=4 ID=5
cartesianLayout Aspect
X=100 Y=100ID X=200 Y=200ID X=100 Y=200ID
CX Encoding
14
X
X
Benefits
 Streamable (large networks)
 Lossless (BioPAX, SGML, OpenBEL…)
 Extensible (new aspects)
 Transfers only aspects of interest
 Community, community, community
A CX Snippet
[
{"nodes": [{"@id": "_:1"}, {"@id": "_:2"}]},
{"edges": [{"source": "_:1", "@id": "_:4", "target": "_:2"}]},
{"cartesianLayout": [{"x": "100", "node": "_:1", "y": "100"}]},
{"cartesianLayout": [{"x": "200", "node": "_:2", "y": "300"}]},
{"nodes": [{"@id": "_:3"}]},
{"edges": [{"source": "_:2", "@id": "_:5", "target": "_:3"}]},
{"cartesianLayout": [{"x": "100", "node": "_:3", "y": "200"}]}
]
15
Important Considerations
 How do I call or build a service?
 What (actually) is being exchanged?
 Where does the service run?
 What if your service becomes popular?
 How to do create a good service?
 What if your service is too slow?
 What if your service is buggy? 16
Deploying, Scaling, Speeding Up
17
App
CX Data
REST
REST
Function
Data CX
 Your Server
 Amazon
 NRNB Servers
Deploying, Scaling, Speeding Up
18
App
CX Data
REST
REST
Function
Data CX
 Your Server
 Amazon
 NRNB Servers
REST
Function
Data CX
REST
Function
Data CX
REST
Function
Data CX
Elsa
REST
Function
Data CX
…
 Other servers
Important Considerations
 How do I call or build a service?
 What (actually) is being exchanged?
 Where does the service run?
 What if your service becomes popular?
 How to do create a good service?
 What if your service is too slow?
 What if your service is buggy? 19
App Tests
CX Data
REST
App Tests
CX Data
RESTTests
CX Data
Development Model
20
Step 1: Step 2:
Step 3:
Function
Data CX
App Tests
CX Data
Function
Data CX
Function
Data CX
REST
Function
Data CX
REST
Elsa
Function
Data CX
REST
Step 4:
Important Considerations
 How do I call or build a service?
 What (actually) is being exchanged?
 Where does the service run?
 What if your service becomes popular?
 How to do create a good service?
 What if your service is too slow?
 What if your service is buggy? 21
CyComponents - Embeded UI Services
 Embeddable in Web apps and Cytoscape apps
 GUI front end to services
 Builds on
 Cytoscape.js network display library
 BioJS libraries
 Other widgets
 Based on Facebook’s React framework
 Simple to build
 Simple to incorporate into apps
22
Reusing CyComponents is Easy
23
 Can be used from Cytoscape app or Web app
function init(loginInfo) {
const cyto = CyFramework.config([NDExStore]);
cyto.render(NDExLogin, document.getElementById('valet'), {
defaults: loginInfo,
onSubmit: () => {
const state = cyto.getStore('ndex').server.toJS();
connect(state);}
});
}
CyComponents in Action
24
NDEx Valet CyComponent in NDEx web site
CyComponents in Action
NDEx web site calls NDEx database using
NDEx Valet CyComponent
25
Send Query
Return NetList
Get Network
Return Network
NDEX Valet is also a part of a Cytoscape app
that loads NDEx networks into Cytoscape
Services in Action – Cytoscape + NDEx
Cytoscape calls cyNDEx app to load network,
cyNDEX uses NDEx Valet to call NDEx
26
Send Query
Return NetList
Get Network
Return Network
Choose Networks
Send Networks
cyREST /
Cytoscape
(Click here for video showing NDEx Valet creating network in Cytoscape)
Publishing of the Future … as CI
27
Publishing of the Future … as CI
28
Cytoscape Cyberinfrastructure (CI)
30
Clustering
Cytoscape
NDEx
Layouts · R · Java ·
· Python ·
· Matlab ·
Science
Direct
Additional services:
• Heat Dissipation
• NDEx GUI Interface
• ID Translation
• Network viewers
… many more!
Services/apps interact
via Internet-based
messaging
Support
 National Resource for Network Biology (NRNB)
 Supports software and staging hardware
 Pharma & NCI support NDEx
 Elsevier
 All sources open and on GitHub
31
Call to Community
 App authorshipCytoscape community thrives
 Pride of authorship, listing in App Store
 Tangible realization of useful research
 Valuable workflows for all to use
 Publishable results (e.g., F1000)
 CI community inherits all of these! … but also:
 More direct path from algorithm to useful code
 Wider audience
 Easier coding & dissemination
 Better coding practices
 More resources
32
More Information
bdemchak@ucsd.edu
Reading List
 http://martinfowler.com/articles/microservices.html
 http://home.ndexbio.org/about-ndex-2
 http://idekerlab.github.io/cy-net-share
 Lincoln Stein. Towards a cyberinfrastructure for the biological
sciences: progress, visions and challenges.
http://www.nature.com/nrg/journal/v9/n9/full/nrg2414.html
 Barry Demchak, et al. PALMS: A Modern Coevolution of Community
and Computing Using Policy Driven Development.
https://sosa.ucsd.edu/ResearchCentral/view.jsp?id=203
 Stephen Goff, et al. The iPlant collaborative: cyberinfrastructure for
plant biology.
http://journal.frontiersin.org/article/10.3389/fpls.2011.00034/pdf
33
End of Deck
 Backup slides are beyond here
34
Existing Ecosystem
 Visual Workflow Systems
 Taverna & Galaxy – high level orchestration
 MyExperiment – sharing workflows
 Service Repositories
 BioCatalogue
 General programming languages & tools
 Python, R, Java, Matlab, IPython/Jupyter
 Network Analysis & Visualization
 Cytoscape & cytoscape.js
 GeneMANIA
 Cytoscape Cyberinfrastructure (?)
++ - - ++
++ - - ++
++
+ ++ + -
+ + ++ -
+ - +
++ ++ ++ ++
35
CX Timings
 Using Human network (18K nodes, 127K edges)
 CX output around 150MB
 Timings exclude accessing Cytoscape data
model – Cytoscape data model increases
timings by 2-4x
36
Aspect Read (ms) Write (ms)
Nodes 6 3
Edges 97 51
NodeAttrs 77 58
EdgeAttrs 1289 1077

Cytoscape CI Chapter 2

  • 1.
    Quality Network Analysis Quicklyand Cheaply Cytoscape Cyberinfrastructure Chapter 2 ISMB/NetBioSIG 2016 Orlando, Florida July 8, 2016 Keiichiro Ono, Eric Sage & Barry Demchak Ideker Lab 1
  • 2.
    Problems and Solutions Creating (Network Biology) Software is slow and expensive  We want  Novel and reproducible workflows  Mature standardized workflows  Sharable networks, workflows, and results  More memory, processors & storage  Cytoscape Cyberinfrastructure (CI)  Distributed microservice-based architecture 2
  • 3.
    What I Hopeto Convey Today  How to build network biology workflows • Using reusable components (*** God reuses code!) • Computational • Storage • User interface • Coordinate with Cytoscape, NDEx, and other NB assets  How to build reusable components  Useful from Cytoscape and other programs  The “reuse party” is worth coming to! 3
  • 4.
    Imagine Your NewApplication 4Enriched Networks Putative drivers
  • 5.
    Where are wenow?  Python + Jupyter, R + RStudio, Matlab  General functionality, agile, shareable code, reproducible workflows  Young analysis/viz, data silos, short jobs, no scaling  Cytoscape / NDEx / cyREST / cytoscape.js  Mature, extensible, shareable networks  Non-agile, no scaling, non-reproducible  Taverna / Galaxy  Mature, reproducible workflows, big data  Non-agile, data silos  GenomeSpace, GenePattern … 5
  • 6.
    Cytoscape CI MicroserviceApproach Network Biology Services 6 Computation Storage Workflow Visualization Analysis Layout
  • 7.
    App Service Message Bus(REST/Internet) Return(yyy) Calculate(xxx) Calculate(xxx) Return(yyy) 1 2 34 What is a Microservice? App Service Return(yyy) Calculate(xxx) Time 7  Late Binding  Scalability  Reusability  Language choice
  • 8.
  • 9.
    Services in Action– Cytoscape as Service Jupyter application calls Cytoscape/cyREST as a service for visualizing networks 9 Send Network Send Styles cyREST / Cytoscape (Click here for video showing Jupyter creating network in Cytoscape)
  • 10.
    Important Considerations  Howdo I call or build a service?  What (actually) is being exchanged?  Where does the service run?  What if your service becomes popular?  How to do create a good service?  What if your service is too slow?  What if your service is buggy? 10
  • 11.
    Anatomy of aService Call 11 Send Network Send Styles cyREST / Cytoscape igraph py2cytoscape igraph2CX model.impl CX.impl cyREST cyREST1 / Internet CX encode/decode Local network model App ServiceCI 1http://www.ncbi.nlm.nih.gov/pubmed/26672762
  • 12.
    Making Your ServiceReal 1. Create function  Python, R, Go, Java … 2. Add REST wrapper  Eve, OpenCPU, GoRilla, Jersey… 3. Add client call using REST 12 Function Data CX REST Function Data CX App CX REST Function Data CXData REST More later … Network + params on server
  • 13.
    Important Considerations  Howdo I call or build a service?  What (actually) is being exchanged?  Where does the service run?  What if your service becomes popular?  What if your service is too slow?  What if your service is buggy?  How to do you test your service? 13
  • 14.
    CX Transfer Format 1 32 Example Graph 4 5 nodes Aspect edges Aspect cartesianLayout Aspect Aspect Relationships Organizes Positions ID=1 ID=2 ID=3 nodes Aspect (3 nodes) edges Aspect (2 edges) Source Target Source TargetID=4 ID=5 cartesianLayout Aspect X=100 Y=100ID X=200 Y=200ID X=100 Y=200ID CX Encoding 14 X X Benefits  Streamable (large networks)  Lossless (BioPAX, SGML, OpenBEL…)  Extensible (new aspects)  Transfers only aspects of interest  Community, community, community
  • 15.
    A CX Snippet [ {"nodes":[{"@id": "_:1"}, {"@id": "_:2"}]}, {"edges": [{"source": "_:1", "@id": "_:4", "target": "_:2"}]}, {"cartesianLayout": [{"x": "100", "node": "_:1", "y": "100"}]}, {"cartesianLayout": [{"x": "200", "node": "_:2", "y": "300"}]}, {"nodes": [{"@id": "_:3"}]}, {"edges": [{"source": "_:2", "@id": "_:5", "target": "_:3"}]}, {"cartesianLayout": [{"x": "100", "node": "_:3", "y": "200"}]} ] 15
  • 16.
    Important Considerations  Howdo I call or build a service?  What (actually) is being exchanged?  Where does the service run?  What if your service becomes popular?  How to do create a good service?  What if your service is too slow?  What if your service is buggy? 16
  • 17.
    Deploying, Scaling, SpeedingUp 17 App CX Data REST REST Function Data CX  Your Server  Amazon  NRNB Servers
  • 18.
    Deploying, Scaling, SpeedingUp 18 App CX Data REST REST Function Data CX  Your Server  Amazon  NRNB Servers REST Function Data CX REST Function Data CX REST Function Data CX Elsa REST Function Data CX …  Other servers
  • 19.
    Important Considerations  Howdo I call or build a service?  What (actually) is being exchanged?  Where does the service run?  What if your service becomes popular?  How to do create a good service?  What if your service is too slow?  What if your service is buggy? 19
  • 20.
    App Tests CX Data REST AppTests CX Data RESTTests CX Data Development Model 20 Step 1: Step 2: Step 3: Function Data CX App Tests CX Data Function Data CX Function Data CX REST Function Data CX REST Elsa Function Data CX REST Step 4:
  • 21.
    Important Considerations  Howdo I call or build a service?  What (actually) is being exchanged?  Where does the service run?  What if your service becomes popular?  How to do create a good service?  What if your service is too slow?  What if your service is buggy? 21
  • 22.
    CyComponents - EmbededUI Services  Embeddable in Web apps and Cytoscape apps  GUI front end to services  Builds on  Cytoscape.js network display library  BioJS libraries  Other widgets  Based on Facebook’s React framework  Simple to build  Simple to incorporate into apps 22
  • 23.
    Reusing CyComponents isEasy 23  Can be used from Cytoscape app or Web app function init(loginInfo) { const cyto = CyFramework.config([NDExStore]); cyto.render(NDExLogin, document.getElementById('valet'), { defaults: loginInfo, onSubmit: () => { const state = cyto.getStore('ndex').server.toJS(); connect(state);} }); }
  • 24.
    CyComponents in Action 24 NDExValet CyComponent in NDEx web site
  • 25.
    CyComponents in Action NDExweb site calls NDEx database using NDEx Valet CyComponent 25 Send Query Return NetList Get Network Return Network NDEX Valet is also a part of a Cytoscape app that loads NDEx networks into Cytoscape
  • 26.
    Services in Action– Cytoscape + NDEx Cytoscape calls cyNDEx app to load network, cyNDEX uses NDEx Valet to call NDEx 26 Send Query Return NetList Get Network Return Network Choose Networks Send Networks cyREST / Cytoscape (Click here for video showing NDEx Valet creating network in Cytoscape)
  • 27.
    Publishing of theFuture … as CI 27
  • 28.
    Publishing of theFuture … as CI 28
  • 29.
    Cytoscape Cyberinfrastructure (CI) 30 Clustering Cytoscape NDEx Layouts· R · Java · · Python · · Matlab · Science Direct Additional services: • Heat Dissipation • NDEx GUI Interface • ID Translation • Network viewers … many more! Services/apps interact via Internet-based messaging
  • 30.
    Support  National Resourcefor Network Biology (NRNB)  Supports software and staging hardware  Pharma & NCI support NDEx  Elsevier  All sources open and on GitHub 31
  • 31.
    Call to Community App authorshipCytoscape community thrives  Pride of authorship, listing in App Store  Tangible realization of useful research  Valuable workflows for all to use  Publishable results (e.g., F1000)  CI community inherits all of these! … but also:  More direct path from algorithm to useful code  Wider audience  Easier coding & dissemination  Better coding practices  More resources 32 More Information bdemchak@ucsd.edu
  • 32.
    Reading List  http://martinfowler.com/articles/microservices.html http://home.ndexbio.org/about-ndex-2  http://idekerlab.github.io/cy-net-share  Lincoln Stein. Towards a cyberinfrastructure for the biological sciences: progress, visions and challenges. http://www.nature.com/nrg/journal/v9/n9/full/nrg2414.html  Barry Demchak, et al. PALMS: A Modern Coevolution of Community and Computing Using Policy Driven Development. https://sosa.ucsd.edu/ResearchCentral/view.jsp?id=203  Stephen Goff, et al. The iPlant collaborative: cyberinfrastructure for plant biology. http://journal.frontiersin.org/article/10.3389/fpls.2011.00034/pdf 33
  • 33.
    End of Deck Backup slides are beyond here 34
  • 34.
    Existing Ecosystem  VisualWorkflow Systems  Taverna & Galaxy – high level orchestration  MyExperiment – sharing workflows  Service Repositories  BioCatalogue  General programming languages & tools  Python, R, Java, Matlab, IPython/Jupyter  Network Analysis & Visualization  Cytoscape & cytoscape.js  GeneMANIA  Cytoscape Cyberinfrastructure (?) ++ - - ++ ++ - - ++ ++ + ++ + - + + ++ - + - + ++ ++ ++ ++ 35
  • 35.
    CX Timings  UsingHuman network (18K nodes, 127K edges)  CX output around 150MB  Timings exclude accessing Cytoscape data model – Cytoscape data model increases timings by 2-4x 36 Aspect Read (ms) Write (ms) Nodes 6 3 Edges 97 51 NodeAttrs 77 58 EdgeAttrs 1289 1077