Skip to content

Commit c9248f1

Browse files
committed
use DiagrammeR
1 parent e3d9ae4 commit c9248f1

15 files changed

+1144
-980
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,5 @@ Suggests:
7272
VignetteBuilder: knitr
7373
Imports: methods,ontologyIndex,
7474
datasets, graphics, stats, utils, knitr,
75-
SummarizedExperiment, S4Vectors, rols, igraph
75+
SummarizedExperiment, S4Vectors, rols, igraph, DiagrammeR
7676
biocViews: WorkflowStep

NAMESPACE

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ S3method(.DollarNames,iterator)
88
S3method(.DollarNames,metric)
99
S3method(.DollarNames,model)
1010
S3method(.DollarNames,model_dag)
11+
S3method(.DollarNames,model_dag_chart)
1112
S3method(.DollarNames,model_node)
1213
S3method(.DollarNames,optimiser)
1314
S3method(.DollarNames,prediction_node)
@@ -44,6 +45,7 @@ export(entity_stato)
4445
export(enum)
4546
export(enum_stato)
4647
export(example_chart)
48+
export(example_dag)
4749
export(example_iterator)
4850
export(example_model)
4951
export(get_description)
@@ -169,17 +171,18 @@ exportMethods(stato_id)
169171
exportMethods(stato_name)
170172
exportMethods(stato_summary)
171173
exportMethods(value)
174+
import(DiagrammeR)
172175
import(S4Vectors)
173176
import(SummarizedExperiment)
174177
import(datasets)
175-
import(ggplot2)
176178
import(methods)
179+
importFrom(DiagrammeR,add_edge)
180+
importFrom(DiagrammeR,add_node)
181+
importFrom(DiagrammeR,create_graph)
182+
importFrom(DiagrammeR,render_graph)
183+
importFrom(DiagrammeR,set_edge_attrs)
184+
importFrom(DiagrammeR,set_node_attrs)
177185
importFrom(graphics,plot)
178-
importFrom(igraph,graph_from_data_frame)
179-
importFrom(igraph,layout_as_tree)
180-
importFrom(igraph,layout_in_circle)
181-
importFrom(igraph,layout_randomly)
182-
importFrom(igraph,layout_with_sugiyama)
183186
importFrom(knitr,purl)
184187
importFrom(ontologyIndex,get_ontology)
185188
importFrom(stats,runif)

R/chart_node_class.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ chart_node = function(name = character(0), description = character(0), chart = N
4040
),
4141
prototype = list(
4242
chart = NULL,
43-
input_objects = list()
43+
input_objects = list(),
44+
.params=c('chart','input_objects')
4445
)
4546
)
4647

@@ -109,4 +110,4 @@ setMethod(f = "show",
109110

110111
#' @export
111112
#' @rdname autocompletion
112-
setMethod('.DollarNames','chart_node',.DollarNames.chart_node)
113+
setMethod('.DollarNames','chart_node',.DollarNames.chart_node)

R/data_node_class.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ data_node = function(name = character(0), description = character(0), data = NUL
3636
),
3737
prototype = list(
3838
data = NULL,
39-
input_data = NULL
39+
.params=c('data','input_data')
4040
)
4141
)
4242

@@ -100,4 +100,4 @@ setMethod(f = "show",
100100

101101
#' @export
102102
#' @rdname autocompletion
103-
setMethod('.DollarNames','data_node',.DollarNames.data_node)
103+
setMethod('.DollarNames','data_node',.DollarNames.data_node)

R/example_objects.R

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -201,13 +201,39 @@ chart_node_example = function() {
201201
return(NULL)
202202
}
203203

204-
205-
206-
207-
208-
209-
210-
211-
212-
213-
204+
#' Example DAG
205+
#'
206+
#' An example model_dag for testing the DAG chart functionality.
207+
#' Creates a simple DAG with two connected nodes.
208+
#' @export
209+
#' @return model_dag object
210+
#' @examples
211+
#' DAG = example_dag()
212+
#' C = model_dag_chart()
213+
#' chart_plot(C, DAG)
214+
example_dag = function() {
215+
# Create example nodes
216+
node1 = example_model(value_1 = 5, value_2 = 10)
217+
node2 = example_model(value_1 = 15, value_2 = 25)
218+
219+
# Create edges
220+
edges = list(
221+
list(from = "node1", to = "node2")
222+
)
223+
224+
# Create nodes list
225+
nodes = list(
226+
node1 = node1,
227+
node2 = node2
228+
)
229+
230+
# Create the DAG
231+
dag = model_dag(
232+
name = "Example DAG",
233+
description = "A simple example DAG with two connected nodes",
234+
edges = edges,
235+
nodes = nodes
236+
)
237+
238+
return(dag)
239+
}

0 commit comments

Comments
 (0)