forked from ivanhanigan/disentangle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedges-test.R
91 lines (83 loc) · 2.61 KB
/
edges-test.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
newnode<-function(dsc, i, o=NA, append=T, notes=F, code=NA, ttype=NA){
# dsc='Clean Weather Data',
# ttype='data',
# i='BOM',
# o='Weather Data',
# append=F,
# notes='Error Checking',
# code
require(Rgraphviz)
require(biocGraph)
# if(!exists('rEG')) {
if(append==F) {
rEG <- new("graphNEL", nodes=c("outcome", "population", "exposure",'analyte'),
edgemode="directed")
rEG <- addEdge("outcome", "analyte", rEG, 1)
rEG <- addEdge("population", "analyte", rEG, 1)
rEG <- addEdge("exposure", "analyte", rEG, 1)
}
rEG <- addNode(node=dsc,object=rEG)
# rEG <- addNode(node=i,object=rEG)
rEG <- addEdge(i, dsc, rEG, 1)
if(!is.na(o)){
rEG <- addEdge(from=dsc, to=o, rEG, 1)
}
return(rEG)
}
# rEG <- new("graphNEL", nodes=c("outcome", "population", "exposure",'analyte'), edgemode="directed")
# plot(rEG)
# rEG <- addNode(node='qc',object=rEG) #,edges=list(c('analyte')))
# rEG <- addEdge("analyte", 'qc', rEG, 1)
#
# rEG <- addNode(node='eda',object=rEG)
# rEG <- addEdge("analyte", 'eda', rEG, 1)
#
# rEG <- addNode(node='model1',object=rEG)
# rEG <- addEdge('eda', 'model1', rEG, 1)
rm(rEG)
rEG <- newnode(dsc='outcome', i='unitRecords', append=F)
rEG <- newnode(dsc='analyte', i='outcome')
rEG <- newnode(dsc='population', i='populationData', o='analyte')
rEG <- newnode(dsc='exposure', i='exposureData', o='analyte')
dev.off()
plot(rEG)
# rEG <- newnode(dsc='report', i='model1')
# rEG<-newnode(dsc='Weather Data',ttype='data',i='BOM',o='exposure',
# append=F,
# notes='Error Checking',
# code=NA)
# rEG<-newnode(dsc='EWE criteria',i='algorithms', o='exposure',
# notes='',
# code=NA)
# rEG<-newnode(dsc='Population Data',ttype='data',o='population',
# i =c('ABS', 'Consistent Spatial Framework'),
# notes='',
# code=NA)
# rEG <- newnode(dsc='Select Mortality Data',ttype='data',
# i = c('Ethics Approval', 'Specific Causes of Death'),
# o= 'outcome',
# notes='',
# code=NA)
# rEG <- addEdge('Consistent Spatial Framework', 'Select Mortality Data', rEG, 1)
#
# plot(rEG)
# dev.off()
# defAttrs <- getDefaultAttrs()
# defAttrs
#
# width = 2500
# height = 2500
# png('edges-test.png', res=500, width=width, height=height)
# par(mai=rep(0,4))
plot(rEG,attrs=list(node=list(label="foo",
fillcolor="grey",shape="ellipse",
fixedsize=FALSE),
edge=list(color="black")))
dev.off()
# width = height = 512
# png('edges-test.png', width=width, height=height)
# par(mai=rep(0,4))
# plot(rEG,attrs=list(node=list(label="foo", fillcolor="lightgreen"),
# edge=list(color="cyan"),
# graph=list(rankdir="LR")))
# dev.off()