Skip to content

Commit ccfa2d2

Browse files
committed
✨ New Features added to Pages
1 parent 45065ce commit ccfa2d2

File tree

4 files changed

+131
-16
lines changed

4 files changed

+131
-16
lines changed

cells/streamlit/cells/Hello.py

+5-16
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import streamlit as st
2-
import sys
3-
sys.path.append('/app')
2+
3+
44

55

66
st.set_page_config(
7-
page_title="Hello",
7+
page_title="Welcome",
88
page_icon="👋",
99
)
1010

@@ -14,18 +14,7 @@
1414

1515
st.markdown(
1616
"""
17-
Streamlit is an open-source app framework built specifically for
18-
Machine Learning and Data Science projects.
19-
**👈 Select a demo from the sidebar** to see some examples
20-
of what Streamlit can do!
21-
### Want to learn more?
22-
- Check out [streamlit.io](https://streamlit.io)
23-
- Jump into our [documentation](https://docs.streamlit.io)
24-
- Ask a question in our [community
25-
forums](https://discuss.streamlit.io)
26-
### See more complex demos
27-
- Use a neural net to [analyze the Udacity Self-driving Car Image
28-
Dataset](https://github.com/streamlit/demo-self-driving)
29-
- Explore a [New York City rideshare dataset](https://github.com/streamlit/demo-uber-nyc-pickups)
17+
Geomstats is an open-source Python package for computations, statistics, and machine learning on nonlinear manifolds. Data from many application fields are elements of manifolds. For instance, the manifold of 3D rotations SO(3) naturally appears when performing statistical learning on articulated objects like the human spine or robotics arms.
18+
**👈 Select a demo from the sidebar**
3019
"""
3120
)

cells/streamlit/cells/pages/ Elastic_Metric_for_Cell_Boundary_Analysis.py

+62
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import streamlit as st
55
import time
66
import numpy as np
7+
import pandas as pd
78
import matplotlib.pyplot as plt
89
from scipy import stats
910

@@ -142,6 +143,67 @@
142143

143144
st.pyplot(fig)
144145

146+
147+
148+
fig = plt.figure(figsize=(18, 8))
149+
150+
ncols = len(means) // 2
151+
152+
for i, (mean_name, mean) in enumerate(means.items()):
153+
ax = fig.add_subplot(2, ncols, i+1)
154+
mean = CLOSED_CURVES_SPACE.projection(mean)
155+
ax.plot(mean[:, 0], mean[:, 1], "black")
156+
ax.set_aspect("equal")
157+
ax.axis("off")
158+
axs_title = mean_name
159+
if mean_name not in ["Linear", "SRV"]:
160+
a = mean_name[0]
161+
b = mean_name[1]
162+
ratio = a / (2 * b)
163+
mean_name = f"Elastic {mean_name}\n a / (2b) = {ratio}"
164+
ax.set_title(mean_name)
165+
166+
167+
st.markdown("__Remark:__ Unfortunately, there are some numerical issues with the projection in the space of closed curves, as shown by the V-shaped results above.")
168+
169+
st.markdown("Since ratios of 1 give the same results as for the SRV metric, we only select AS, BS with a ratio that is not 1 for the elastic metrics.")
170+
171+
st.markdown("We also continue the analysis with the space of open curves, as opposed to the space of closed curves, for the numerical issues observed above.")
172+
173+
174+
NEW_AS = [0.75, 0.5, 0.25, 0.01] #, 1.6] #, 1.4, 1.2, 1, 0.5, 0.2, 0.1]
175+
NEW_BS = [0.5, 0.5, 0.5, 0.5] #, 2, 2, 2, 2, 2, 2, 2]
176+
177+
st.makrdown("## Distances to the Mean")
178+
179+
# We multiply the distances by a 100, for visualization purposes. It amounts to a change of units.
180+
dists = {}
181+
182+
dists["Linear"] = [100 * gs.linalg.norm(means["Linear"] - cell) / n_sampling_points for cell in cell_shapes]
183+
184+
dists["SRV"] = [
185+
100 * SRV_METRIC.dist(means["SRV"], cell) / n_sampling_points for cell in cell_shapes
186+
]
187+
188+
for a, b in zip(NEW_AS, NEW_BS):
189+
dists[a, b] = [
190+
100 * ELASTIC_METRIC[a, b].dist(means[a, b], cell) / n_sampling_points for cell in cell_shapes
191+
]
192+
193+
194+
dists_summary = pd.DataFrame(
195+
data={
196+
labels_a_name: labels_a,
197+
labels_b_name: labels_b,
198+
"Linear": dists["Linear"],
199+
"SRV": dists["SRV"],
200+
}
201+
)
202+
203+
for a, b in zip(NEW_AS, NEW_BS):
204+
dists_summary[f"Elastic({a}, {b})"] = dists[a, b]
205+
206+
st.dataframe(dists_summary)
145207
# SAVEFIG = True
146208
# if SAVEFIG:
147209
# figs_dir = os.path.join(work_dir, f"cells/saved_figs/{dataset_name}")
+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import streamlit as st
2+
import pandas as pd
3+
from io import StringIO
4+
5+
st.write("# Welcome to the Cell Shear Analysis App! 👋")
6+
7+
st.markdown(
8+
"""
9+
## Data Source
10+
11+
> Ehsan Sadeghipour, Miguel A Garcia, William James Nelson, Beth L Pruitt (2018) Shear-induced damped oscillations in an epithelium depend on actomyosin contraction and E-cadherin cell adhesion eLife 7:e39640 https://doi.org/10.7554/eLife.39640
12+
13+
![](https://raw.githubusercontent.com/amilworks/ece594n/728845ba67ef604d307be98f78b872aa4d4052a4/hw_project/PredictingCellShear/figs/Graphical_Abstract_V1%404x.png)
14+
15+
# Introduction and Motivation
16+
17+
Cell-cell shear, or the action of cells sliding past each other, has roles in development, disease, and wound healing. Throughout development cells are moving past each other in every stage of development. These biomechanical cues have influences on differentiation, cell shape, behavior, the proteome, and the transcriptome.
18+
19+
Previous research on shear focused on fluid shear so in this paper they focused on cell-cell shear which has been well characterized. Epithelial cells known as MDCK cells were used on a MEMS device which can be precisely displaced to create consistent cell-cell shear forces. Using new segmentation and machine learning techniques we are reanalyzing the data to use the changes in cell shape to predict cell behavior/migration.
20+
21+
"""
22+
)
23+
24+
uploaded_file = st.file_uploader("Choose a file")
25+
if uploaded_file is not None:
26+
# To read file as bytes:
27+
bytes_data = uploaded_file.getvalue()
28+
st.write(bytes_data)
29+
30+
# To convert to a string based IO:
31+
stringio = StringIO(uploaded_file.getvalue().decode("utf-8"))
32+
st.write(stringio)
33+
34+
# To read file as string:
35+
string_data = stringio.read()
36+
st.write(string_data)
37+
38+
# Can be used wherever a "file-like" object is accepted:
39+
dataframe = pd.read_csv(uploaded_file)
40+
st.write(dataframe)
41+
st.set_page_config(
42+
page_title="Hello",
43+
page_icon="👋",
44+
)
45+
46+
47+
48+
st.sidebar.success("Select a demo above.")
49+

pyproject.toml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[tool.poetry]
2+
name = "cells"
3+
version = "0.1.0"
4+
description = "Streamlit application for Cell Shape Analysis"
5+
authors = ["Amil Khan <[email protected]>"]
6+
readme = "README.md"
7+
8+
[tool.poetry.dependencies]
9+
python = "^3.10"
10+
streamlit = "^1.21.0"
11+
12+
13+
[build-system]
14+
requires = ["poetry-core"]
15+
build-backend = "poetry.core.masonry.api"

0 commit comments

Comments
 (0)