Send on object of bnlearn class to Cytoscape for visualization
require(RCytoscape)
getCytoGraph <- function(graph.bn, window, window.title){
#Sends a bn object to Cytoscape
#Args
## graph.bn is a bn object
## window.title: characters for what to tile the window in cytoscape
setDefaultBackgroundColor (window, '#FFFFFF')
setDefaultNodeColor(window, '#4682b4')
adj.mat <- amat(graph.bn)
g.nell <- new("graphAM", adjMat = adj.mat, edgemode='directed')
g.nell <- initEdgeAttribute(g.nell, 'edge.type', 'char', 'Direct')
cw = new.CytoscapeWindow(window.title, g.nell)
displayGraph(cw)
layoutNetwork(cw, 'hierarchical')
setNodeLabelRule(cw, 'label')
setEdgeTargetArrowRule(cw, 'edge.type', 'Direct', 'Arrow')
redraw(cw)
setWindowSize(cw, 1000, 1000)
fitContent(cw)
setZoom(cw, 0.8 * getZoom (cw))
}