Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,7 +11,8 @@ from utils import (
|
|
| 11 |
wens_method_heatmap,
|
| 12 |
plot_fcgr,
|
| 13 |
plot_persistence_homology,
|
| 14 |
-
plot_distrobutions
|
|
|
|
| 15 |
)
|
| 16 |
import os
|
| 17 |
import seaborn as sns
|
|
@@ -148,7 +149,40 @@ with ui.navset_card_tab(id="tab"):
|
|
| 148 |
ax.set_xlabel("Basepair")
|
| 149 |
ax.set_ylabel("Variance")
|
| 150 |
return ax
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
|
|
|
|
| 152 |
with ui.nav_panel("Viral Microstructure"):
|
| 153 |
ui.panel_title("Kmer Distribution")
|
| 154 |
with ui.layout_columns():
|
|
|
|
| 11 |
wens_method_heatmap,
|
| 12 |
plot_fcgr,
|
| 13 |
plot_persistence_homology,
|
| 14 |
+
plot_distrobutions,
|
| 15 |
+
process_data_sub_specie
|
| 16 |
)
|
| 17 |
import os
|
| 18 |
import seaborn as sns
|
|
|
|
| 149 |
ax.set_xlabel("Basepair")
|
| 150 |
ax.set_ylabel("Variance")
|
| 151 |
return ax
|
| 152 |
+
########################################################### 2D Sub-Specie #####################################################################
|
| 153 |
+
with ui.nav_panel("Virus Sub-Specie"):
|
| 154 |
+
ui.panel_title("Can we create sub-specie based on 2d representation? How does their 2D representation vary?")
|
| 155 |
+
with ui.layout_columns():
|
| 156 |
+
with ui.card():
|
| 157 |
+
ui.input_selectize("virus_selector_2", "Select your viruses:", virus_new, multiple=False, selected=None)
|
| 158 |
+
|
| 159 |
+
ui.input_selectize(
|
| 160 |
+
"plot_type_distro_sub",
|
| 161 |
+
"Select plot type:",
|
| 162 |
+
["2D sub-specie - nominal", "2D sub-specie - detrended"],
|
| 163 |
+
multiple=False,
|
| 164 |
+
selected="2D sub-specie - nominal",
|
| 165 |
+
)
|
| 166 |
+
ui.input_slider("variance", "variance from 2d rep", 1, 5, 3)
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
|
| 170 |
+
@render.plot()
|
| 171 |
+
def plot_sub_specie():
|
| 172 |
+
import seaborn as sns
|
| 173 |
+
plot_type = input.plot_type_distro_sub()
|
| 174 |
+
if plot_type == "2D sub-specie - nominal":
|
| 175 |
+
df = process_data_sub_specie(MASTER_DF, input.virus_selector_2(), input.variance())
|
| 176 |
+
df = df.explode('two_d').copy()
|
| 177 |
+
df['x'] = np.array((df['two_d'].tolist()))[:,0]
|
| 178 |
+
df['y'] = np.array((df['two_d'].tolist()))[:,1]
|
| 179 |
+
ax = sns.scatterplot(data=df, x='x',y='y', hue='group')
|
| 180 |
+
ax.set_title("Sub-specie")
|
| 181 |
+
# ax.set_xlabel("")
|
| 182 |
+
# ax.set_ylabel("Density")
|
| 183 |
+
return ax
|
| 184 |
|
| 185 |
+
|
| 186 |
with ui.nav_panel("Viral Microstructure"):
|
| 187 |
ui.panel_title("Kmer Distribution")
|
| 188 |
with ui.layout_columns():
|