Skip to content

Commit

Permalink
Bump version to v0.5.0 for release
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanwilliammd committed Apr 10, 2024
1 parent 85fd173 commit afa1e0f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## [v0.5.0](https://github.com/ivanwilliammd/iderare-pheno/releases/tag/v0.5.0) - 2024-04-10
- Added ```omim2name``` function and ```streamlit_utils.py``` to accomodate Streamlit app

## [v0.4.0](https://github.com/ivanwilliammd/iderare-pheno/releases/tag/v0.4.0) - 2024-04-07
- Added export iderare.yml function

Expand Down
1 change: 1 addition & 0 deletions iderare_pheno/simrec.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def hpo2name(hpo_set):
hpo_name = [Ontology.hpo(int(d.strip("HP:"))).name for d in hpo_set]
return hpo_name


# Get OMIM Name from HPO Code
def omim2name(diagnosis_sets):
omim_name = [Omim.get(int(d.strip("OMIM:"))).name for d in diagnosis_sets]
Expand Down
29 changes: 20 additions & 9 deletions iderare_pheno/streamlit_utils.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import io
import os
from datetime import datetime

import pandas as pd
import scipy.cluster
import streamlit as st
import yaml
from matplotlib import pyplot as plt

Expand Down Expand Up @@ -37,11 +39,13 @@ def list2tsv(
# Print the dendrogram tree
def linkage_dendrogram(linkage, labels, title="Similarity", threshold=0.3, path_to_save=None):
if len(linkage) == 0:
print("Linkage is empty. The data not possible due to blank linkage information.")
st.write("Linkage is empty. The data not possible due to blank linkage information.")
return

plt.figure(figsize=(20, len(linkage)))
scipy.cluster.hierarchy.dendrogram(
linkage,
distance_sort="ascending",
labels=labels,
show_contracted=True,
leaf_font_size=plt.rcParams["font.size"] * 1.5,
Expand All @@ -65,14 +69,21 @@ def linkage_dendrogram(linkage, labels, title="Similarity", threshold=0.3, path_
plt.ylabel("Disease", fontsize=plt.rcParams["font.size"] * 2)
plt.tight_layout()

if not os.path.exists("output"):
os.makedirs("output")
print("Folder output created.")
else:
print("Folder output already exists.")
col1, col2 = st.columns([3, 1])
with col1:
st.success("Dendrogram tree plotted successfully")

if path_to_save is None:
path_to_save = "output/{date_time}_{title}.png".format(
path_to_save = os.path.join(
"{date_time}_{title}.png".format(
date_time=datetime.now().strftime("%Y%m%d_%H%M%S"), title=title[0:30]
)
plt.savefig(path_to_save)
)
img = io.BytesIO()

plt.savefig(img, format="png")
with col2:
st.download_button(
label="📷 Download graph", data=img, file_name=path_to_save, mime="image/png"
)

st.pyplot(plt, use_container_width=True)

0 comments on commit afa1e0f

Please sign in to comment.