Skip to content

Commit

Permalink
data_view
Browse files Browse the repository at this point in the history
  • Loading branch information
zprobot committed Nov 5, 2023
1 parent ad47638 commit fab2514
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
Binary file added docs/data_view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 17 additions & 1 deletion docs/tools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -394,4 +394,20 @@ Example:
--project_file PXD014414/project.json
--attach_file PXD014414-943a8f02-0527-4528-b1a3-b96de99ebe75.featrue.parquet
--category feature_file
--replace_existing
--replace_existing
Data preview
--------------------------
This tool is used to preview your feature files and AE files.
You can run ``streamlit run .\visualize_web_commond.py`` start a web service.
Then set up your working directory to preview the data.

.. image:: data_view.png
:width: 800
:align: center

* If you want to manipulate data on NoteBook, you can introduce the ``Statistic`` class.

.. code:: python
from quantms_io.core.statistic import Statistic
15 changes: 8 additions & 7 deletions python/quantmsio/quantms_io/commands/visualize_web_commond.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
import pandas as pd
from quantms_io.core.database import Database
import os
import random
from st_aggrid import AgGrid,ColumnsAutoSizeMode
from st_aggrid.grid_options_builder import GridOptionsBuilder

#os.chdir(r'D:\converter\AE\PXD010154\PXD010154')


st.set_page_config(page_title="quantms_analyze", layout="wide")
#st.title("quantms_io")
workdir = st.sidebar.text_input('workdir',value='')

def load_unique_list(file_type,View):
Expand All @@ -19,6 +16,8 @@ def load_unique_list(file_type,View):
else:
return View.get_unique_proteins(index)

def refresh_keys(query_list):
random.shuffle(query_list)

if os.path.exists(workdir):
os.chdir(workdir)
Expand Down Expand Up @@ -46,12 +45,13 @@ def load_unique_list(file_type,View):
index = parquet_file_list.index(file_type)
else:
index = ibaq_list.index(file_type)

query_list = load_unique_list(file_type,View)
query_key = st.sidebar.selectbox(
"query peptide or protein",
query_list
query_list[:10]
)
st.sidebar.button("Refresh", on_click=refresh_keys(query_list))

if file_type.endswith('.parquet'):
df = View.query_peptide(query_key, index)
Expand All @@ -61,11 +61,12 @@ def load_unique_list(file_type,View):
gb = GridOptionsBuilder.from_dataframe(df)
gb.configure_pagination(paginationAutoPageSize=False,paginationPageSize=15)
gb.configure_side_bar()
gb.configure_default_column(groupable=True, value=True, enableRowGroup=True, editable=False)
gb.configure_default_column(groupable=True, value=True, enableRowGroup=True, aggFunc="sum", editable=False)
gridOptions = gb.build()
if file_type.endswith('.parquet'):
AgGrid(df,gridOptions,columns_auto_size_mode=ColumnsAutoSizeMode.FIT_CONTENTS,theme='alpine')
else:
AgGrid(df,gridOptions,columns_auto_size_mode=ColumnsAutoSizeMode.FIT_ALL_COLUMNS_TO_VIEW,theme='alpine')



0 comments on commit fab2514

Please sign in to comment.