Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add combined node and edge counts to dashboard #100

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ plugins:

# Ontology status table goes under here.
totalcount: 1050
totalnodecount: 10509205
totaledgecount: 20055264
ontologies:
- edgecount: 555
id: REGN_BRO
Expand Down
2 changes: 2 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ <h3>Learn more about KG-Bioportal</h3>
<h3>KG-Bioportal Overview</h3>
<p>The collection includes graph files for {{ site.totalcount }} ontologies. </p>

<p>In all, this includes {{site.totalnodecount }} ontology classes as nodes and {{site.totaledgecount}} relations between classes as edges.</p>

{% include fig1.html %}
{% include fig2.html %}
<br>
Expand Down
11 changes: 11 additions & 0 deletions src/kg_bioportal/transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,23 @@ def transform_all(self, compress: bool) -> None:
# Write total stats to a yaml
logging.info("Writing total stats to total_stats.yaml.")
# Get the count of successful transforms
# Plus total node and edge counts
success_count = 0
for onto in onto_log:
if onto_log[onto]["status"]:
success_count += 1
with open(os.path.join(self.output_dir, "total_stats.yaml"), "w") as f:
f.write("totalcount: " + str(success_count) + "\n")
f.write(
"totalnodecount: "
+ str(sum([onto_log[onto]["nodecount"] for onto in onto_log]))
+ "\n"
)
f.write(
"totaledgecount: "
+ str(sum([onto_log[onto]["edgecount"] for onto in onto_log]))
+ "\n"
)

# Dump onto_log to a yaml
# Rearrange it a bit first
Expand Down
Loading