generated from Knowledge-Graph-Hub/kg-example
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from ncbo/viz
Add visualizations to dashboard
- Loading branch information
Showing
7 changed files
with
105 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
"""Create static plotly figures for KG-Bioportal""" | ||
|
||
import pandas as pd | ||
import plotly.express as px | ||
import yaml | ||
from plotly.subplots import make_subplots | ||
|
||
with open("onto_status.yaml", "r") as infile: | ||
ontos = pd.DataFrame(((yaml.safe_load(infile)))["ontologies"]) | ||
countcols = ["nodecount", "edgecount"] | ||
ontos[countcols] = ontos[countcols].apply(pd.to_numeric, errors="coerce") | ||
|
||
# Consider putting these in subplots | ||
# https://plotly.com/python/pie-charts/#pie-charts-in-subplots | ||
|
||
# Node counts across all ontologies, unmerged | ||
nodeontos = ontos.loc[ontos["nodecount"] < 150000, "id"] = "All other ontologies" | ||
fig1 = px.pie( | ||
ontos, | ||
values="nodecount", | ||
names="id", | ||
title="Nodes used to make KG-Bioportal", | ||
hole=.3 | ||
) | ||
fig1.update_traces(textposition='inside', textinfo='percent+label') | ||
fig1.update_layout(uniformtext_minsize=14, uniformtext_mode='hide') | ||
fig1.write_html("fig1.html", include_plotlyjs='cdn') | ||
|
||
# Edge counts across all ontologies, unmerged | ||
ontos.loc[ontos["edgecount"] < 150000, "id"] = "All other ontologies" | ||
fig2 = px.pie( | ||
ontos, | ||
values="edgecount", | ||
names="id", | ||
title="Edges used to make KG-Bioportal", | ||
hole=.3 | ||
) | ||
fig2.update_traces(textposition='inside', textinfo='percent+label') | ||
fig2.update_layout(uniformtext_minsize=14, uniformtext_mode='hide') | ||
fig2.write_html("fig2.html", include_plotlyjs='cdn') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters