36
KNIME SUMMIT 2016 Antje Janosch – Technology Development Studio MPI-CBG Dresden Scripting Integration Workshop

Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

KNIMESUMMIT2016

Antje Janosch – Technology Development Studio MPI-CBG Dresden

Scripting Integration Workshop

Page 2: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

History

Antje Janosch, MPI-CBG, Dresden, Germany 2

2009 2016? R-Scrip4ng,PythonScrip4ng,

MatlabScrip4ng2010?

2013/2014

Page 3: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

General Features

•  Server/Clientbasedsolu4on•  Parallelexecu4on•  Centralizedsetup

•  Remotetemplaterepositories•  Templateconfigura4onvia“KNIME-like”GUI

•  DeploymentofKNIME-nodeswithscrip4ngbehind

Antje Janosch, MPI-CBG, Dresden, Germany 3

Page 4: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

Short news

R•  RowIDsupport(bothdirec4ons)•  Domainvalues•  Color/Size/Shapemodelsupport•  Flowvariablesupport•  Chunkedtransfer•  ‘Openexternal’•  R-workspaceasgenericRport

Antje Janosch, MPI-CBG, Dresden, Germany 4

Page 5: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

Client-(server) model

Antje Janosch, MPI-CBG, Dresden, Germany 5

RServe

remoteorlocal

Matlab-Server

local

remoteorlocal

local

Python

-Server

remoteorlocal

Page 6: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

Getting started (Client)

•  InstallScrip4ngpluginsfrom“TrustedCommunityContribu4ons”updatesite(KNIME>=3.0recommended)

Antje Janosch, MPI-CBG, Dresden, Germany 6

Page 7: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

Preferences

Antje Janosch, MPI-CBG, Dresden, Germany 7

Page 8: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

Node Types

•  Plot•  Snippet•  (OpenIn…)•  Genericnodes(R)

Antje Janosch, MPI-CBG, Dresden, Germany 8

Page 9: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

Plot / Snippet – Script editor tab

Antje Janosch, MPI-CBG, Dresden, Germany 9

Column namesScripting area

Page 10: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

Plot / Snippet – Template tab

10

Page 11: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

Plot / Snippet – Template tab

11

Template Repository

Page 12: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

Plot / Snippet – Template tab

12

Template Repository

Page 13: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

Plot / Snippet – Template tab

13

Template Repository

Page 14: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

Plot / Snippet – Template tab

14

Template Repository

Template Description / Source

Page 15: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

Plot / Snippet – Template tab

15

Template Repository

Template Description / Source

Page 16: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

Script editor tab – template view

Antje Janosch, MPI-CBG, Dresden, Germany 16

Page 17: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

Script editor tab – template view

Antje Janosch, MPI-CBG, Dresden, Germany 17

RGG interface of the selected template

Page 18: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

Script editor tab – template view

Antje Janosch, MPI-CBG, Dresden, Germany 18

RGG interface of the selected template

modify final script

Page 19: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

Script editor tab – template view

Antje Janosch, MPI-CBG, Dresden, Germany 19

RGG interface of the selected template

modify final script

Page 20: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

Script editor tab – template view

Antje Janosch, MPI-CBG, Dresden, Germany 20

RGG interface of the selected template

modify final script

Page 21: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

Script editor tab – template view

Antje Janosch, MPI-CBG, Dresden, Germany 21

Page 22: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

Script editor tab – template view

Antje Janosch, MPI-CBG, Dresden, Germany 22

modify template (dev)

Page 23: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

Script editor tab – template view

Antje Janosch, MPI-CBG, Dresden, Germany 23

modify template (dev)

RGG (XML)

Page 24: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

Tips and Tricks for Editing (R)

•  Mouseclick=”Columnname”•  Alt+Mouseclick=kIn$”Columnname”•  Ctrl+Mouseclick=Displayspossibledomainvaluesofthe

columnandofferstoinsertaselec4on(commaseparated•  PressApple/Windowskey

andselectmul4ple=assoonasyoureleasethekey,theselectedcolumnnameswillbeinserted“column1”,”column2”,...

•  FLOWVAR(currentColumnName)placeholdertoenabletheuseofflowvariables

Antje Janosch, MPI-CBG, Dresden, Germany 24

Page 25: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

Plot – Output Options tab

Antje Janosch, MPI-CBG, Dresden, Germany 25

Placeholders for filename $$DATE$$ - yymmdd $$USER$$ - user name $$WS$$ - knime.workspace FLOWVAR(varName) – flow variable

Page 26: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

Plot - View options (R)

•  Dynamicrepain4ngacermouseclick

Antje Janosch, MPI-CBG, Dresden, Germany 26

Page 27: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

KNIME tables in R

•  Inputports(kInorkIn1,kIn2,…)•  Rdata.frame•  RowIDsasrownames•  Domainvaluesasfactorlevels

•  Colormodel(kIn.color.model)•  Rdata.frame•  Colorsashex-values

•  Shapemodel(kIn.shape.model)•  Rdata.frame•  ShapesaspchandtheirKNIMEname

Antje Janosch, MPI-CBG, Dresden, Germany 27

Page 28: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

KNIME tables in R

•  Sizemodel(kIn.size.model+kIn.size.model.fun)•  Nameofthecolumnhavingasizemodel•  Func4ontocalculatethesizebasedontheKNIMEsizemodel

•  Flowvariables(knime.flow.in)

•  Rlist

Antje Janosch, MPI-CBG, Dresden, Germany 28

Page 29: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

KNIME tables in R

•  Sizemodel(kIn.size.model+kIn.size.model.fun)•  Nameofthecolumnhavingasizemodel•  Func4ontocalculatethesizebasedontheKNIMEsizemodel

•  Flowvariables(knime.flow.in)

•  Rlist

Antje Janosch, MPI-CBG, Dresden, Germany 29

Page 30: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

KNIME tables in R

•  Sizemodel(kIn.size.model+kIn.size.model.fun)•  Nameofthecolumnhavingasizemodel•  Func4ontocalculatethesizebasedontheKNIMEsizemodel

•  Flowvariables(knime.flow.in)

•  Rlist

Antje Janosch, MPI-CBG, Dresden, Germany 30

Page 31: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

Template repositories Template.txt

Antje Janosch, MPI-CBG, Dresden, Germany 31

##################################################!# name: !A very cool method!# author: !Antje Janosch!# category: !KNIME-UGM/!# preview: !niceImage.png! !(optional)!!This is my template description.!######!!R/Python/Matlab code !Optionally emmbedded in RGG!!##################################################!# name: !Another very cool method!# author: !Antje Janosch!...!!

Page 32: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

RGG

•  RGUIGenerator

•  Addi4onalelement<panellistbox label="Label" items="item1,item2,item3" span="full"/>

Antje Janosch, MPI-CBG, Dresden, Germany 32

http://rgg.r-forge.r-project.org/ RGG: a general GUI Framework for R scripts.BMC Bioinformatics. 2009 Mar 2 ; 10:74. doi: 10.1186/1471-2105-10-74.

<rgg>!some interface elements definitions!<![CDATA[!R-script!]]>! </rgg>!!

Page 33: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

RGG

•  Placeholders$$$NUM_ATTRIBUTES$$$ - for all numeric columns $$$STR_ATTRIBUTES$$$ - for all string columns $$$ALL_ATTRIBUTES$$$ - for all columns !

Antje Janosch, MPI-CBG, Dresden, Germany 33

Page 34: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

Demos (R)

1.  Iwanttousetemplates

2.  IwanttowritemyownR-scripts

3.  IwanttocreateknimeR-workflows(genericnodes)

4.  Iwanttocreatetemplates

5.  IwanttocreateaKNIMEnodewithRbehind

Antje Janosch, MPI-CBG, Dresden, Germany 34

Page 35: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

Outlook

•  SupportofrowIDsforPython/Matlabandforbothdirec4ons

•  ConsoleoutputviewforRnodes•  Keepofflinecopyoftemplatefiles•  …

Antje Janosch, MPI-CBG, Dresden, Germany 35

Page 36: Scripting Integration Workshop - KNIME · 2017-05-23 · 2. I want to write my own R-scripts 3. I want to create knimeR-workflows (generic nodes) 4. I want to create templates 5

Contact us!

[email protected]@mpi-cbg.de

Antje Janosch, MPI-CBG, Dresden, Germany 36