diff --git a/Sample_test.txt b/Sample_test.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/Packages.py b/src/Packages.py index 5c1d19856500b2d04cd3b8e439af9323a5311888..8966a1bffa6f7b7af562b55734f6c8b844202163 100644 --- a/src/Packages.py +++ b/src/Packages.py @@ -26,7 +26,7 @@ from scipy.sparse.csgraph import minimum_spanning_tree from scipy.sparse import csgraph # Modelling -from juliacall import Main as jl +#from juliacall import Main as jl from pinard import utils from pinard import preprocessing as pp diff --git a/src/pages/1-samples_selection.py b/src/pages/1-samples_selection.py index c9085bd0d096c62d619ef6b0b26fc11220fbd6f5..7c24b46a9a4b9b56c18502ee3fa10b11e72a8c0a 100644 --- a/src/pages/1-samples_selection.py +++ b/src/pages/1-samples_selection.py @@ -181,14 +181,18 @@ if labels: meta['index'] = spectra.index[selected_samples_idx] selected_samples_metd.write(meta) - +############################################################################ ## Scores if not t.empty: with scores: + fig1, ((ax1, ax2),(ax3,ax4)) = plt.subplots(2,2) st.write('Scores plot') # scores plot with clustering if list(labels) and meta_data.empty: fig = px.scatter_3d(tcr, x=axis1, y=axis2, z = axis3, color = labels) + sns.scatterplot(data = tcr, x = axis1, y =axis2 , hue = labels, ax = ax1) + + # scores plot with metadata elif len(list(labels)) == 0 and not meta_data.empty: @@ -196,9 +200,12 @@ if not t.empty: col = st.selectbox('Color by:', options= filter) if col == 0: fig = px.scatter_3d(tcr, x=axis1, y=axis2, z = axis3) + sns.scatterplot(data = tcr, x = axis1, y =axis2 , ax = ax1) + else: fig = px.scatter_3d(tcr, x=axis1, y=axis2, z = axis3, color = list(map(str.lower,meta_data[col])) ) - + sns.scatterplot(data = tcr, x = axis1, y =axis2 , hue = list(map(str.lower,meta_data[col])), ax = ax1) + # color with scores and metadata elif len(list(labels)) > 0 and not meta_data.empty: if clus_method in cluster_methods[1:]: @@ -210,13 +217,19 @@ if not t.empty: col = st.selectbox('Color by:', options= filter) if col == "None": fig = px.scatter_3d(tcr, x=axis1, y=axis2, z = axis3) + sns.scatterplot(data = tcr, x = axis1, y =axis2 , ax = ax1) elif col == clus_method: fig = px.scatter_3d(tcr, x=axis1, y=axis2, z = axis3, color = labels) + sns.scatterplot(data = tcr, x = axis1, y =axis2 , ax = ax1) else: fig = px.scatter_3d(tcr, x=axis1, y=axis2, z = axis3, color = list(map(str.lower,meta_data[col]))) + sns.scatterplot(data = tcr, x = axis1, y =axis2 , hue = list(map(str.lower,meta_data[col])), ax = ax1) + sns.scatterplot(data = tcr, x = axis1, y =axis2 , hue = list(map(str.lower,meta_data[col])), ax = ax2) + sns.scatterplot(data = tcr, x = axis1, y =axis2 , hue = list(map(str.lower,meta_data[col])), ax = ax3) else: fig = px.scatter_3d(tcr, x=axis1, y=axis2, z = axis3) + sns.scatterplot(data = tcr, x = axis1, y =axis2 , ax = ax1) fig.update_traces(marker=dict(size=4)) if selected_samples_idx: @@ -224,8 +237,10 @@ if not t.empty: fig.add_scatter3d(x = tt.loc[:,axis1], y = tt.loc[:,axis2], z = tt.loc[:,axis3], mode ='markers', marker = dict(size = 7, color = 'black'), name = 'selected samples') + + plt.savefig("./Report/Figures/test.png") st.plotly_chart(fig, use_container_width=True) - + import plotly.express as px if labels: @@ -254,7 +269,29 @@ if not t.empty: fig_axe2_axe3.update_traces(marker=dict(size=4)) fig_axe2_axe3.write_image("./Report/Figures/plot_axe2_axe3.png") + else : + + fig_axe1_axe2 = px.scatter(tcr, x=axis1, y=axis2, color=labels if list(labels) else None) + fig_axe1_axe2.update_layout(title='Axe1-Axe2') + fig_axe1_axe2.update_traces(marker=dict(size=4)) + fig_axe1_axe2.write_image("./Report/Figures/plot_axe1_axe2.png") + + + # Créer et exporter le graphique Axe1-Axe3 en PNG + fig_axe1_axe3 = px.scatter(tcr, x=axis1, y=axis3, color=labels if list(labels) else None) + fig_axe1_axe3.update_layout(title='Axe1-Axe3') + fig_axe1_axe3.update_traces(marker=dict(size=4)) + fig_axe1_axe3.write_image("./Report/Figures/plot_axe1_axe3.png") + + + # Créer et exporter le graphique Axe2-Axe3 en PNG + fig_axe2_axe3 = px.scatter(tcr, x=axis2, y=axis3, color=labels if list(labels) else None) + fig_axe2_axe3.update_layout(title='Axe2-Axe3') + fig_axe2_axe3.update_traces(marker=dict(size=4)) + fig_axe2_axe3.write_image("./Report/Figures/plot_axe2_axe3.png") + +################################################################# if not spectra.empty: if dim_red_method == dim_red_methods[1]: diff --git a/src/pages/4-inputs.py b/src/pages/4-inputs.py index 439c3bf6d04763eda9454e440408be504898c9e5..59fbb88694103f31806b91c16ed2510a18215e03 100644 --- a/src/pages/4-inputs.py +++ b/src/pages/4-inputs.py @@ -1,6 +1,11 @@ import streamlit as st - +from Packages import * +st.set_page_config(page_title="NIRS Utils", page_icon=":goat:", layout="wide",) +if 'interface' not in st.session_state: + st.session_state['interface'] = 'simple' +from Modules import * +from Class_Mod.DATA_HANDLING import * # HTML for the banner "CEFE - CNRS" # bandeau_html = """ # <div style="width: 100%; background-color: #4682B4; padding: 10px; margin-bottom: 10px;"> @@ -28,7 +33,7 @@ with st.container(): .stButton>button { display: block; margin: 0 auto; - width: 200px; + width: 200px; height: 50px; font-size: 16px; } diff --git a/src/pages/new 4.txt b/src/pages/new 4.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/plot_axe1_axe2.png b/src/plot_axe1_axe2.png new file mode 100644 index 0000000000000000000000000000000000000000..a52dfe7b11df2b892ef0bf0b54e86c47fd0714b9 Binary files /dev/null and b/src/plot_axe1_axe2.png differ