1+ // #r "nuget: Newtonsoft.Json"
2+ // #r "nuget: DynamicObj"
3+ // #r @"C:\Users\Lukas\Downloads\Cyjs.NET-main\bin\Cyjs.NET\netstandard2.1\Cyjs.NET.dll"
4+ #r " nuget: Cyjs.NET"
5+ #r " nuget: ISADotNet.XLSX"
6+
7+ open ISADotNet
8+ open ISADotNet.API
9+ open ISADotNet.XLSX
10+
11+ open Cyjs.NET
12+ open Elements
13+
14+ let source = __ SOURCE_ DIRECTORY__
15+
16+ let _ , _ , _ , assay = AssayFile.AssayFile.fromFile ( source + @" \content\files\AssayFile.xlsx" )
17+
18+
19+
20+ let myFirstGraph =
21+ CyGraph.initEmpty ()
22+
23+
24+ let edges =
25+ assay.ProcessSequence.Value
26+ |> List.collect ( fun p ->
27+ p.Outputs.Value
28+ |> List.zip p.Inputs.Value
29+ |> List.map ( fun ( i , o ) -> ProcessInput.getName i |> Option.get, ProcessOutput.getName o |> Option.get, p.Name.Value)
30+ )
31+
32+
33+
34+
35+ let cyNodes =
36+ edges
37+ |> List.collect ( fun ( i , o , e ) -> [ i; o])
38+ |> List.distinct
39+ |> List.map ( fun n -> node n [ CyParam.label n])
40+
41+ let cyEgdes =
42+ edges
43+ |> List.mapi ( fun index ( i , o , e ) -> edge ( string index) i o [ CyParam.label e])
44+
45+ let myGraph =
46+ CyGraph.initEmpty ()
47+ |> CyGraph.withElements cyNodes
48+ |> CyGraph.withElements cyEgdes
49+ |> CyGraph.withStyle " node"
50+ [
51+ CyParam.content =. CyParam.label
52+ CyParam.color " #A00975"
53+ ]
54+ |> CyGraph.withStyle " edge"
55+ [
56+ CyParam.content =. CyParam.label
57+ CyParam.color " #FF0000"
58+ ]
59+ |> CyGraph.withLayout ( Layout.initBreadthfirst id)
60+ |> CyGraph.withSize( 800 , 400 )
61+
62+ Layout.initBreadthfirst
63+
64+ myGraph
65+ |> CyGraph.show
0 commit comments