Skip to content

Commit

Permalink
Update ARCGraph Viz functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
omaus committed Dec 5, 2023
1 parent dc5ada4 commit 9ee242d
Showing 1 changed file with 36 additions and 3 deletions.
39 changes: 36 additions & 3 deletions src/ARCExpect/ARCGraph.fs
Original file line number Diff line number Diff line change
Expand Up @@ -295,17 +295,50 @@ module ARCGraph =
graph

/// Takes an ISA-based FGraph and returns a CyGraph according to its structure.
let isaGraphToFullCyGraph (graph : FGraph<int*string,CvParam,ARCRelation>) =
let isaGraphToFullCyGraph (graph : FGraph<string,IParam,ARCRelation>) =
toFullCyGraph
(fun (h,n) -> $"{h}, {n}")
(fun (d : CvParam) -> $"{d.Name}: {d.Value |> ParamValue.getValueAsString}")
//(fun (h,n) -> $"{h}, {n}") // when using hash * accession or hash * name
id // when using only accession or name
(fun (d : IParam) -> $"{d.Name}: {d.Value |> ParamValue.getValueAsString}")
(fun e ->
[
CyParam.label <| e.ToString()
match e with
| ARCRelation.Follows -> CyParam.color "red"
| ARCRelation.PartOf -> CyParam.color "blue"
| x when x = ARCRelation.PartOf + ARCRelation.Follows -> CyParam.color "purple"
| ARCRelation.IsA -> CyParam.color "lightblue"
| ARCRelation.Misplaced -> CyParam.color "pink"
| ARCRelation.Obsolete -> CyParam.color "yellow"
| ARCRelation.Unknown -> CyParam.color "black"
| x when x = ARCRelation.Obsolete + ARCRelation.Follows -> CyParam.color "orange"
| ARCRelation.HasA -> CyParam.color "brown"
| _ -> CyParam.color "white"
]
)
graph
|> CyGraph.withLayout(Layout.initBreadthfirst <| Layout.LayoutOptions.Cose())

/// Takes an ISA-based FGraph and returns a CyGraph according to its structure.
let isaIntermediateGraphToFullCyGraph (graph : FGraph<string,IParam seq,ARCRelation>) =
toFullCyGraph
//(fun (h,n) -> $"{h}, {n}") // when using hash * accession or hash * name
id // when using only accession or name
(fun (d : IParam seq) -> $"{(Seq.head d).Name}: {(Seq.head d).Value |> ParamValue.getValueAsString}")
(fun e ->
[
CyParam.label <| e.ToString()
match e with
| ARCRelation.Follows -> CyParam.color "red"
| ARCRelation.PartOf -> CyParam.color "blue"
| x when x = ARCRelation.PartOf + ARCRelation.Follows -> CyParam.color "purple"
| ARCRelation.IsA -> CyParam.color "lightblue"
| ARCRelation.Misplaced -> CyParam.color "pink"
| ARCRelation.Obsolete -> CyParam.color "yellow"
| ARCRelation.Unknown -> CyParam.color "black"
| x when x = ARCRelation.Obsolete + ARCRelation.Follows -> CyParam.color "orange"
| ARCRelation.HasA -> CyParam.color "brown"
| _ -> CyParam.color "white"
]
)
graph
Expand Down

0 comments on commit 9ee242d

Please sign in to comment.