public static MotifJSONView ToJSON(MotifGraph graph) { int edgeCount = 0; MotifJSONView JSONView = new MotifJSONView(); JSONView.edgesJSON = new List<object>(graph.Edges.Count); foreach (MotifEdge edge in graph.Edges) { if (edge.SourceNodeKey == null || edge.TargetNodeKey == null) continue; MotifNode SourceNode = graph.Nodes[edge.SourceNodeKey]; MotifNode TargetNode = graph.Nodes[edge.TargetNodeKey]; string KeyString = SourceNode.Key.ToString() + "-" + TargetNode.Key.ToString() + "," + edge.SynapseType; JSONView.edgesJSON.Add(new { id = edgeCount, node1 = SourceNode.Key.ToString(), node2 = TargetNode.Key.ToString(), label = KeyString, type = edge.SynapseType }); edgeCount++; } return JSONView; }
public void TestMethod1() { AnnotationUtils.MotifGraph graph = new MotifGraph(); graph.BuildGraph(this.Endpoint, this.userCredentials); System.Diagnostics.Debug.Assert(graph != null); MotifDOTView dotGraph = AnnotationUtils.MotifDOTView.ToDOT(graph); string[] Types = new string[] {"svg"}; MotifDOTView.Convert("dot", "C:\\Temp\\Motif.dot", Types); }
public void GenerateMotifGraph() { AnnotationUtils.MotifGraph graph = new MotifGraph(); graph = MotifGraph.BuildGraph(this.Endpoint, this.userCredentials); System.Diagnostics.Debug.Assert(graph != null); MotifDOTView dotGraph = AnnotationUtils.MotifDOTView.ToDOT(graph); string DotFileFullPath = "C:\\Temp\\Motif.dot"; dotGraph.SaveDOT(DotFileFullPath); string[] Types = new string[] {"svg"}; MotifDOTView.Convert("dot", DotFileFullPath, Types); }