Skip to content
Snippets Groups Projects
Commit 6894c76a authored by DIANE's avatar DIANE
Browse files

score plot(group samples based on metadata or on clustering results

parent 8915f27a
No related branches found
No related tags found
No related merge requests found
...@@ -121,26 +121,41 @@ if not t.empty: ...@@ -121,26 +121,41 @@ if not t.empty:
with scores: with scores:
st.write('Scores plot') st.write('Scores plot')
# scores plot with clustering # scores plot with clustering
if list(labels): if list(labels) and meta_data.empty:
fig = px.scatter_3d(t, x=axis1, y=axis2, z = axis3, color = labels) fig = px.scatter_3d(t, x=axis1, y=axis2, z = axis3, color = labels)
else:
# scores plot with metadata # scores plot with metadata
if not meta_data.empty: elif len(list(labels)) == 0 and not meta_data.empty:
filter = meta_data.columns[1:] filter = meta_data.columns[1:]
col = st.selectbox('filter', options= filter) col = st.selectbox('Group by:', options= filter)
if col == 0: if col == 0:
fig = px.scatter_3d(t, x=axis1, y=axis2, z = axis3) fig = px.scatter_3d(t, x=axis1, y=axis2, z = axis3)
else: else:
fig = px.scatter_3d(t, x=axis1, y=axis2, z = axis3, color = list(map(str.lower,meta_data[col])) ) fig = px.scatter_3d(t, x=axis1, y=axis2, z = axis3, color = list(map(str.lower,meta_data[col])) )
# color with scores and metadata
elif len(list(labels)) > 0 and not meta_data.empty:
if clus_method in cluster_methods[1:]:
filter = ['None', clus_method]
filter.extend(meta_data.columns[1:])
else:
filter = meta_data.columns[1:].insert(0,'None')
col = st.selectbox('Group by:', options= filter)
if col == "None":
fig = px.scatter_3d(t, x=axis1, y=axis2, z = axis3)
elif col == clus_method:
fig = px.scatter_3d(t, x=axis1, y=axis2, z = axis3, color = labels)
else: else:
# scores plot with neither metadata nor clustering fig = px.scatter_3d(t, x=axis1, y=axis2, z = axis3, color = list(map(str.lower,meta_data[col])))
fig = px.scatter_3d(t, x=axis1, y=axis2, z = axis3)
else:
fig = px.scatter_3d(t, x=axis1, y=axis2, z = axis3)
fig.update_traces(marker=dict(size=4)) fig.update_traces(marker=dict(size=4))
st.plotly_chart(fig) st.plotly_chart(fig)
if not spectra.empty: if not spectra.empty:
if dim_red_method == dim_red_methods[1]: if dim_red_method == dim_red_methods[1]:
with loadings: with loadings:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment