Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ lib/
.builderrc
.eslintrc
.npmignore
.editorconfig
.eslintignore
.prettierrc
.circleci
.github

# demo folder has special meaning in R
# this should hopefully make it still
Expand All @@ -15,7 +20,7 @@ demo/.*\.js
demo/.*\.html
demo/.*\.css

# ignore python files/folders
# ignore Python files/folders
setup.py
usage.py
setup.py
Expand Down
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [0.3.0] - 2021-05-19

### Added
* Contributed initial build of Julia package.
* R package now includes an example application for `cytoCytoscape`.

### Changed
* Dash has been upgraded to 1.* in requirements.txt and tests/requirements.txt (#123)
Expand All @@ -15,7 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
* Various security fixes

## [0.2.0] - 20120-07-09
## [0.2.0] - 2020-07-09

### Added
* Contributed initial build of R package.
Expand Down
10 changes: 5 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
Package: dashCytoscape
Title: A Component Library for Dash aimed at facilitating network visualization in R, wrapped around Cytoscape.js
Version: 0.1.1
Description: A Component Library for Dash aimed at facilitating network visualization in R, wrapped around Cytoscape.js
Title: A Component Library for 'Dash' aimed at facilitating network visualization in R, wrapped around Cytoscape.js.
Version: 0.3.0
Description: A Component Library for 'Dash' aimed at facilitating network visualization in R, wrapped around Cytoscape.js.
Depends: R (>= 3.0.2)
Imports:
Suggests:
Authors@R: c(person("Chris", "Parmer", email = "chris@plotly.com", role = c("aut")), person("Xing Han", "Lu", email = "xinghan@plotly.com", role = c("cre")), person(family = "Plotly Technologies, Inc.", role = "cph"))
License: MIT + file LICENSE
Copyright: Plotly Technologies, Inc.
URL: https://github.com/plotly/dash-cytoscape
BugReports: https://github.com/plotly/dash-cytoscape/issues
Encoding: UTF-8
LazyData: true
KeepSource: true
Author: The Plotly Team [aut]
Maintainer: The Plotly Team <cytoscape@plotly.com>
6 changes: 3 additions & 3 deletions R/cytoCytoscape.R
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# AUTO GENERATED FILE - DO NOT EDIT

cytoCytoscape <- function(id=NULL, className=NULL, style=NULL, elements=NULL, stylesheet=NULL, layout=NULL, pan=NULL, zoom=NULL, panningEnabled=NULL, userPanningEnabled=NULL, minZoom=NULL, maxZoom=NULL, zoomingEnabled=NULL, userZoomingEnabled=NULL, boxSelectionEnabled=NULL, autoungrabify=NULL, autolock=NULL, autounselectify=NULL, autoRefreshLayout=NULL, tapNode=NULL, tapNodeData=NULL, tapEdge=NULL, tapEdgeData=NULL, mouseoverNodeData=NULL, mouseoverEdgeData=NULL, selectedNodeData=NULL, selectedEdgeData=NULL) {
cytoCytoscape <- function(id=NULL, autoRefreshLayout=NULL, autolock=NULL, autoungrabify=NULL, autounselectify=NULL, boxSelectionEnabled=NULL, className=NULL, elements=NULL, generateImage=NULL, imageData=NULL, layout=NULL, maxZoom=NULL, minZoom=NULL, mouseoverEdgeData=NULL, mouseoverNodeData=NULL, pan=NULL, panningEnabled=NULL, responsive=NULL, selectedEdgeData=NULL, selectedNodeData=NULL, style=NULL, stylesheet=NULL, tapEdge=NULL, tapEdgeData=NULL, tapNode=NULL, tapNodeData=NULL, userPanningEnabled=NULL, userZoomingEnabled=NULL, zoom=NULL, zoomingEnabled=NULL) {

props <- list(id=id, className=className, style=style, elements=elements, stylesheet=stylesheet, layout=layout, pan=pan, zoom=zoom, panningEnabled=panningEnabled, userPanningEnabled=userPanningEnabled, minZoom=minZoom, maxZoom=maxZoom, zoomingEnabled=zoomingEnabled, userZoomingEnabled=userZoomingEnabled, boxSelectionEnabled=boxSelectionEnabled, autoungrabify=autoungrabify, autolock=autolock, autounselectify=autounselectify, autoRefreshLayout=autoRefreshLayout, tapNode=tapNode, tapNodeData=tapNodeData, tapEdge=tapEdge, tapEdgeData=tapEdgeData, mouseoverNodeData=mouseoverNodeData, mouseoverEdgeData=mouseoverEdgeData, selectedNodeData=selectedNodeData, selectedEdgeData=selectedEdgeData)
props <- list(id=id, autoRefreshLayout=autoRefreshLayout, autolock=autolock, autoungrabify=autoungrabify, autounselectify=autounselectify, boxSelectionEnabled=boxSelectionEnabled, className=className, elements=elements, generateImage=generateImage, imageData=imageData, layout=layout, maxZoom=maxZoom, minZoom=minZoom, mouseoverEdgeData=mouseoverEdgeData, mouseoverNodeData=mouseoverNodeData, pan=pan, panningEnabled=panningEnabled, responsive=responsive, selectedEdgeData=selectedEdgeData, selectedNodeData=selectedNodeData, style=style, stylesheet=stylesheet, tapEdge=tapEdge, tapEdgeData=tapEdgeData, tapNode=tapNode, tapNodeData=tapNodeData, userPanningEnabled=userPanningEnabled, userZoomingEnabled=userZoomingEnabled, zoom=zoom, zoomingEnabled=zoomingEnabled)
if (length(props) > 0) {
props <- props[!vapply(props, is.null, logical(1))]
}
component <- list(
props = props,
type = 'Cytoscape',
namespace = 'dash_cytoscape',
propNames = c('id', 'className', 'style', 'elements', 'stylesheet', 'layout', 'pan', 'zoom', 'panningEnabled', 'userPanningEnabled', 'minZoom', 'maxZoom', 'zoomingEnabled', 'userZoomingEnabled', 'boxSelectionEnabled', 'autoungrabify', 'autolock', 'autounselectify', 'autoRefreshLayout', 'tapNode', 'tapNodeData', 'tapEdge', 'tapEdgeData', 'mouseoverNodeData', 'mouseoverEdgeData', 'selectedNodeData', 'selectedEdgeData'),
propNames = c('id', 'autoRefreshLayout', 'autolock', 'autoungrabify', 'autounselectify', 'boxSelectionEnabled', 'className', 'elements', 'generateImage', 'imageData', 'layout', 'maxZoom', 'minZoom', 'mouseoverEdgeData', 'mouseoverNodeData', 'pan', 'panningEnabled', 'responsive', 'selectedEdgeData', 'selectedNodeData', 'style', 'stylesheet', 'tapEdge', 'tapEdgeData', 'tapNode', 'tapNodeData', 'userPanningEnabled', 'userZoomingEnabled', 'zoom', 'zoomingEnabled'),
package = 'dashCytoscape'
)

Expand Down
2 changes: 1 addition & 1 deletion R/internal.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.dashCytoscape_js_metadata <- function() {
deps_metadata <- list(`dash_cytoscape` = structure(list(name = "dash_cytoscape",
version = "0.1.1", src = list(href = NULL,
version = "0.3.0", src = list(href = NULL,
file = "deps"), meta = NULL,
script = 'dash_cytoscape.min.js',
stylesheet = NULL, head = NULL, attachment = NULL, package = "dashCytoscape",
Expand Down
62 changes: 60 additions & 2 deletions dash-info.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,62 @@
pkg_help_description: >-
A Component Library for Dash aimed at facilitating network visualization in R, wrapped around Cytoscape.js
A Component Library for 'Dash' aimed at facilitating network visualization in R, wrapped around Cytoscape.js.
pkg_help_title: >-
A Component Library for Dash aimed at facilitating network visualization in R, wrapped around Cytoscape.js
A Component Library for 'Dash' aimed at facilitating network visualization in R, wrapped around Cytoscape.js.
pkg_authors: >-
c(person("Chris", "Parmer", email = "chris@plotly.com", role = c("aut")), person("Xing Han", "Lu", email = "xinghan@plotly.com", role = c("cre")), person(family = "Plotly Technologies, Inc.", role = "cph"))
pkg_copyright: >-
Plotly Technologies, Inc.
r_examples:
- name: cytoCytoscape
dontrun: FALSE
code: |
if (interactive()) {
library(dash)
library(dashCytoscape)

app <- Dash$new()

app$layout(
cytoCytoscape(
id='cytoscape-elements-boolean',
layout = list(name = 'preset'),
style = list(width = '100\%', height = '400px'),
elements=list(
list(
data = list(id = 'one', label = 'Locked'),
position = list(x = 75, y = 75),
locked = TRUE
),
list(
data = list(id = 'two', label = 'Selected'),
position = list(x = 75, y = 200),
selected = TRUE
),
list(
data = list(id = 'three', label = 'Not Selectable'),
position = list(x = 200, y = 75),
selectable = FALSE
),
list(
data = list(id = 'four', label = 'Not Grabbable'),
position = list(x = 200, y = 200),
grabbable = FALSE
),
list(
data = list(source = 'one', target = 'two')
),
list(
data = list(source = 'two', target = 'three')
),
list(
data = list(source = 'three', target = 'four')
),
list(
data = list(source = 'two', target = 'four')
)
)
)
)

app$run_server()
}
71 changes: 71 additions & 0 deletions demosR/usage-animated-bfs.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# original demo: http://js.cytoscape.org/demos/animated-bfs/
# code: https://github.com/cytoscape/cytoscape.js/tree/master/documentation/demos/animated-bfs
#
# note: animation not implemented yet, please refer to code.

library(dash)
library(dashCytoscape)
library(jsonlite)

app <- Dash$new()

# define data
elements <- list(
list('data' = list('id' = 'a')),
list('data' = list('id' = 'b')),
list('data' = list('id' = 'c')),
list('data' = list('id' = 'd')),
list('data' = list('id' = 'e')),
list('data' = list('id' = 'a"e', 'weight' = 1, 'source' = 'a', 'target' = 'e')),
list('data' = list('id' = 'ab', 'weight' = 3, 'source' = 'a', 'target' = 'b')),
list('data' = list('id' = 'be', 'weight' = 4, 'source' = 'b', 'target' = 'e')),
list('data' = list('id' = 'bc', 'weight' = 5, 'source' = 'b', 'target' = 'c')),
list('data' = list('id' = 'ce', 'weight' = 6, 'source' = 'c', 'target' = 'e')),
list('data' = list('id' = 'cd', 'weight' = 2, 'source' = 'c', 'target' = 'd')),
list('data' = list('id' = 'de', 'weight' = 7, 'source' = 'd', 'target' = 'e'))
)

# define app layout
app$layout(
htmlDiv(
list(
cytoCytoscape(
id = 'cytoscape',
elements = elements,
layout = list(
'name' = 'breadthfirst',
'directed' = TRUE,
'roots' = '#a',
'padding' = 10
),
stylesheet = list(
list(
'selector' = 'node',
'style' = list(
'content' = 'data(id)'
)
), list(
'selector' = 'edge',
'style' = list(
'curve-style' = 'bezier',
'target-arrow-shape' = 'triangle',
'width' = 4,
'line-color' = '#ddd',
'target-arrow-color' = '#ddd'
)
)
),
style = list(
'width' = '100%',
'height' = '100%',
'position' = 'absolute',
'left' = 0,
'top' = 0,
'z-index' = 999
)
)
)
)
)

app$run_server(debug = TRUE)
128 changes: 128 additions & 0 deletions demosR/usage-breadthfirst-layout.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# original demo: http://js.cytoscape.org/demos/images-breadthfirst-layout/
#
# note: click animation is not implemented

library(dash)
library(dashCytoscape)
library(jsonlite)

app <- Dash$new()

# define data
elements <- list(
list('data' = list('id' = 'cat')),
list('data' = list('id' = 'bird')),
list('data' = list('id' = 'ladybug')),
list('data' = list('id' = 'aphid')),
list('data' = list('id' = 'rose')),
list('data' = list('id' = 'grasshopper')),
list('data' = list('id' = 'plant')),
list('data' = list('id' = 'wheat')),
list('data' = list('source' = 'cat', 'target' = 'bird')),
list('data' = list('source' = 'bird', 'target' = 'ladybug')),
list('data' = list('source' = 'bird', 'target' = 'grasshopper')),
list('data' = list('source' = 'grasshopper', 'target' = 'plant')),
list('data' = list('source' = 'grasshopper', 'target' = 'wheat')),
list('data' = list('source' = 'ladybug', 'target' = 'aphid')),
list('data' = list('source' = 'aphid', 'target' = 'rose'))
)

# define stylesheet
stylesheet <- list(
list(
'selector' = 'node',
'style' = list(
'height' = 80,
'width' = 80,
'background-fit' = 'cover',
'border-color' = '#000',
'border-width' = 3,
'border-opacity' = 0.5
)
),
list(
'selector' = 'edge',
'style' = list(
'curve-style' = 'bezier',
'width' = 6,
'target-arrow-shape' = 'triangle',
'line-color' = '#ffaaaa',
'target-arrow-color' = '#ffaaaa'
)
),
list(
'selector' = '#bird',
'style' = list(
'background-image' = 'https://farm8.staticflickr.com/7272/7633179468_3e19e45a0c_b.jpg'
)
),
list(
'selector' = '#cat',
'style' = list(
'background-image' = 'https://farm2.staticflickr.com/1261/1413379559_412a540d29_b.jpg'
)
),
list(
'selector' = '#ladybug',
'style' = list(
'background-image' = 'https://farm4.staticflickr.com/3063/2751740612_af11fb090b_b.jpg'
)
),
list(
'selector' = '#aphid',
'style' = list(
'background-image' = 'https://farm9.staticflickr.com/8316/8003798443_32d01257c8_b.jpg'
)
),
list(
'selector' = '#rose',
'style' = list(
'background-image' = 'https://farm6.staticflickr.com/5109/5817854163_eaccd688f5_b.jpg'
)
),
list(
'selector' = '#grasshopper',
'style' = list(
'background-image' = 'https://farm7.staticflickr.com/6098/6224655456_f4c3c98589_b.jpg'
)
),
list(
'selector' = '#plant',
'style' = list(
'background-image' = 'https://farm1.staticflickr.com/231/524893064_f49a4d1d10_z.jpg'
)
),
list(
'selector' = '#wheat',
'style' = list(
'background-image' = 'https://farm3.staticflickr.com/2660/3715569167_7e978e8319_b.jpg'
)
)
)

# define app layout
app$layout(
htmlDiv(
list(
cytoCytoscape(
id = 'cytoscape',
elements = elements,
stylesheet = stylesheet,
layout = list(
'name' = 'breadthfirst',
'directed' = TRUE,
'padding' = 10
),
style = list(
'width' = '100%',
'height' = '100%',
'position' = 'absolute',
'left' = 0,
'top' = 0
)
)
)
)
)

app$run_server(debug = TRUE)
Loading