예제 #1
0
        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;
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }