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

selected when no clustering is performed

parent c97108c4
No related branches found
No related tags found
No related merge requests found
......@@ -562,17 +562,36 @@ if not spectra.empty:
st.subheader('III - Selected Samples for Reference Analysis', divider='blue')
if selected:
c16, c17 = st.columns([3, 1])
c16.write("Tabular identifiers of selected samples for reference analysis:")
with c16:
st.write("Tabular identifiers of selected samples for reference analysis:")
if 'labels' in globals():
labels['cluster'] = labels.index
labels.index = labels['names']
result = DataFrame({'names': selected,
'cluster': np.array(labels)[selected]}, index=selected)
if 'labels' in globals():
labels['cluster'] = labels.index
labels.index = labels['names']
result = DataFrame({'names': selected,
'cluster': np.array(labels)[selected]}, index=selected)
else:
st.write(meta_data)
else:
if 'name' in meta_data.columns:
subset = meta_data.drop('name', axis = 1).loc[selected]
else:
subset = meta_data.loc[selected]
st.write(subset)
with c17:
st.info(f'Information !\n - The total number of samples: {n_specs}.\n- The number of samples selected for reference analysis: {len(selected)}.\n - The proportion of samples selected for reference analysis: {round(len(selected)/n_specs*100)}%.')
selected_col = st.selectbox('Color by: ', options=filter, format_func=lambda x: x if x else "<Select>",
disabled=True if len(filter) == 1 else False)
if selected_col:
cmap2 = dict(
zip(set(md_df_st_.loc[selected][selected_col]), colorslist[:len(set(md_df_st_.loc[selected][selected_col]))]))
st.write('The distribution of selected samples across categories')
barhsel = barhplot(md_df_st_.loc[selected][[specs_col]], cmap=cmap2)
st.pyplot(barhsel)
# if meta_data.empty:
......@@ -587,8 +606,6 @@ if selected:
# sam1.insert(loc=0, column='index', value=selected_samples_idx)
# sam1.insert(loc=1, column='cluster', value=np.array(labels)[selected_samples_idx])
# sam1.index = np.arange(len(selected_samples_idx))+1
# with c17:
# st.info(f'Information !\n - The total number of samples: {n_specs}.\n- The number of samples selected for reference analysis: {sam1.shape[0]}.\n - The proportion of samples selected for reference analysis: {round(sam1.shape[0]/n_specs*100)}%.')
# sam = sam1
# if clus_method =='HDBSCAN':
......
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