diff --git a/.github/workflows/test_streamlit_app.yaml b/.github/workflows/test_streamlit_app.yaml deleted file mode 100644 index 79b8462bd..000000000 --- a/.github/workflows/test_streamlit_app.yaml +++ /dev/null @@ -1,103 +0,0 @@ -name: Test streamlit executable for Windows -on: - workflow_dispatch: - -jobs: - build-executable: - runs-on: windows-latest - - env: - PYTHON_VERSION: 3.11.0 - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: ${{ env.PYTHON_VERSION }} - - - name: Setup virtual environment - shell: cmd - run: | - python -m venv myenv - call myenv\Scripts\activate.bat - pip install -r requirements.txt - pip install pyinstaller - - - name: Check if myenv is activated - shell: cmd - run: | - call myenv\Scripts\activate.bat - if "%VIRTUAL_ENV%" == "" ( - echo myenv is not activated - ) else ( - echo myenv is activated - ) - - - name: Debug Environment - shell: cmd - run: | - echo Current directory: %CD% - echo Path to myenv: %CD%\myenv - dir %CD%\myenv\Scripts - - - name: Write function to cli.py - shell: bash - run: | - head -n -2 D:/a/streamlit-template/streamlit-template/myenv/Lib/site-packages/streamlit/web/cli.py > temp_cli.py - - cat << EOF >> temp_cli.py - def _main_run_clExplicit(file, command_line, args=[], flag_options=[]): - main._is_running_with_streamlit = True - bootstrap.run(file, command_line, args, flag_options) - - - if __name__ == "__main__": - main() - EOF - - mv temp_cli.py D:/a/streamlit-template/streamlit-template/myenv/Lib/site-packages/streamlit/web/cli.py - - - name: Compile app with pyinstaller - shell: cmd - run: | - call myenv\Scripts\activate.bat - pyinstaller --onefile --additional-hooks-dir ./hooks run_app.py --clean - - - name: Copy everything to dist directory - shell: bash - run: | - cp -r .streamlit dist/.streamlit - cp -r pages dist/pages - cp -r src dist/src - cp -r example-data dist/example-data - cp -r assets dist/assets - cp app.py dist/ - - - name: Modify .spec file - shell: bash - run: | - cp run_app_temp.spec run_app.spec - - - name: Make executable - shell: cmd - run: | - call myenv\Scripts\activate.bat - pyinstaller run_app.spec --clean - - - name: Copy artifacts - shell: bash - run: | - mkdir artifacts - cp -r dist artifacts/ - cp -r build artifacts/ - cp run_app.spec artifacts/ - cp D:/a/streamlit-template/streamlit-template/myenv/Lib/site-packages/streamlit/web/cli.py artifacts/ - - - name: Upload artifacts - uses: actions/upload-artifact@v3 - with: - name: Outfolders - path: artifacts diff --git a/.github/workflows/workflow-tests.yml b/.github/workflows/workflow-tests.yml deleted file mode 100644 index 7b71c53a2..000000000 --- a/.github/workflows/workflow-tests.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Test workflow functions - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v3 - with: - python-version: "3.10" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - pip install pytest - - name: Running test cases - run: | - pytest test.py diff --git a/environment.yml b/environment.yml index c237f1d31..a1aebadcd 100644 --- a/environment.yml +++ b/environment.yml @@ -12,7 +12,5 @@ dependencies: - pip: # dependencies only available through pip # streamlit dependencies - streamlit==1.29.0 - - streamlit-plotly-events==0.0.6 - - streamlit-aggrid==0.3.4.post3 - st_pages==0.4.5 - captcha==0.5.0 diff --git a/pages/FLASHTaggerViewer.py b/pages/FLASHTaggerViewer.py index 33b514bc8..405ff2e4d 100644 --- a/pages/FLASHTaggerViewer.py +++ b/pages/FLASHTaggerViewer.py @@ -222,9 +222,9 @@ def sendDataToJS(selected_data, layout_info_per_exp): elif comp_name == 'sequence_view': # data_to_send['sequence_data'] = getFragmentDataFromSeq(st.session_state.input_sequence) component_arguments = SequenceViewTagger() - elif comp_name == 'internal_fragment_view': + elif comp_name == 'internal_fragment_map': # data_to_send['internal_fragment_data'] = getInternalFragmentDataFromSeq(st.session_state.input_sequence) - component_arguments = InternalFragmentView() + component_arguments = InternalFragmentMap() components_of_this_row.append(FlashViewerComponent(component_arguments)) components.append(components_of_this_row) @@ -266,7 +266,7 @@ def sendDataToJS(selected_data, layout_info_per_exp): def setSequenceViewInDefaultView(): if 'input_sequence' in st.session_state and st.session_state.input_sequence: global DEFAULT_LAYOUT - DEFAULT_LAYOUT = DEFAULT_LAYOUT + [['sequence_view']] + [['internal_fragment_view']] + DEFAULT_LAYOUT = DEFAULT_LAYOUT + [['sequence_view']] + [['internal_fragment_map']] def content(): diff --git a/pages/FileUploadTagger.py b/pages/FileUploadTagger.py index 1070706b6..91db88582 100644 --- a/pages/FileUploadTagger.py +++ b/pages/FileUploadTagger.py @@ -228,6 +228,8 @@ def content(): # for error message or list of uploaded files deconv_files = sorted(st.session_state["deconv_dfs"].keys()) anno_files = sorted(st.session_state["anno_dfs"].keys()) + tag_files = sorted(st.session_state["tag_dfs"].keys()) + db_files = sorted(st.session_state["protein_dfs"].keys()) # error message if files not exist if len(deconv_files) == 0 and len(anno_files) == 0: @@ -240,7 +242,7 @@ def content(): st.error("The same number of deconvolved and annotated mzML file should be uploaded!") else: v_space(2) - st.session_state["experiment-df"] = getUploadedFileDF(deconv_files, anno_files) + st.session_state["experiment-df"] = getUploadedFileDF(deconv_files, anno_files, tag_files, db_files) st.markdown('**Uploaded experiments in current workspace**') st.dataframe(st.session_state["experiment-df"]) # show table v_space(1) diff --git a/run_app.py b/run_app.py new file mode 100644 index 000000000..2b3886be7 --- /dev/null +++ b/run_app.py @@ -0,0 +1,7 @@ +from streamlit.web import cli + +if __name__ == "__main__": + cli._main_run_clExplicit( + file="app.py", command_line="streamlit run", args=["local"] + ) # run in local mode + # we will create this function inside our streamlit framework diff --git a/test.py b/test.py deleted file mode 100644 index 58e36ca3c..000000000 --- a/test.py +++ /dev/null @@ -1,24 +0,0 @@ -# test_my_math.py -import unittest -from urllib.request import urlretrieve - -from src.simpleworkflow import generate_random_table -from src.complexworkflow import mzML_file_get_num_spectra - -from pathlib import Path - -class TestSimpleWorkflow(unittest.TestCase): - def test_workflow(self): - result = generate_random_table(2, 3).shape - self.assertEqual(result, (2,3), "Expected dataframe shape.") - -class TestComplexWorkflow(unittest.TestCase): - def test_workflow(self): - # load data from url - urlretrieve("https://raw.githubusercontent.com/OpenMS/streamlit-template/main/example-data/mzML/Treatment.mzML", "testfile.mzML") - result = mzML_file_get_num_spectra("testfile.mzML") - Path("testfile.mzML").unlink() - self.assertEqual(result, 786, "Expected dataframe shape.") - -if __name__ == '__main__': - unittest.main()