Coder Social home page Coder Social logo

roestlab / massdash Goto Github PK

View Code? Open in Web Editor NEW
16.0 16.0 3.0 198.41 MB

MassDash: A web-based dashboard for streamlined DIA-MS visualization, analysis, prototyping, and optimization

Home Page: https://massdash.streamlit.app/

License: BSD 3-Clause "New" or "Revised" License

Python 3.31% Dockerfile 0.01% Jupyter Notebook 29.94% Shell 0.01% HTML 66.74%
data-independent-acquisition mass-spectrometry visualization

massdash's People

Contributors

alhigaylan avatar github-actions[bot] avatar irahorecka avatar jcharkow avatar singjc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

massdash's Issues

[BUG] Search Results Load Example Data

  File "/media/justincsing/ExtraDrive1/Documents2/Roest_Lab/Github/massdash/massdash/gui.py", line 154, in main
    show_search_results_analysis.main()
  File "/media/justincsing/ExtraDrive1/Documents2/Roest_Lab/Github/massdash/massdash/server/SearchResultsAnalysisServer.py", line 106, in main
    search_results_access_dict = self.load_search_result_entries(self.massseer_gui.file_input_settings.feature_file_entries)
  File "/home/justincsing/anaconda3/envs/py39/lib/python3.9/site-packages/streamlit/runtime/caching/cache_utils.py", line 212, in wrapper
    return cached_func(*args, **kwargs)
  File "/home/justincsing/anaconda3/envs/py39/lib/python3.9/site-packages/streamlit/runtime/caching/cache_utils.py", line 241, in __call__
    return self._get_or_create_cached_value(args, kwargs)
  File "/home/justincsing/anaconda3/envs/py39/lib/python3.9/site-packages/streamlit/runtime/caching/cache_utils.py", line 267, in _get_or_create_cached_value
    return self._handle_cache_miss(cache, value_key, func_args, func_kwargs)
  File "/home/justincsing/anaconda3/envs/py39/lib/python3.9/site-packages/streamlit/runtime/caching/cache_utils.py", line 321, in _handle_cache_miss
    computed_value = self._info.func(*func_args, **func_kwargs)
  File "/media/justincsing/ExtraDrive1/Documents2/Roest_Lab/Github/massdash/massdash/server/SearchResultsAnalysisServer.py", line 51, in load_search_result_entries
    data_access = OSWDataAccess(entry_data['search_results_file_path'], mode='gui')
  File "/media/justincsing/ExtraDrive1/Documents2/Roest_Lab/Github/massdash/massdash/loaders/access/OSWDataAccess.py", line 76, in __init__
    self._initializePeptideHashtable()
  File "/media/justincsing/ExtraDrive1/Documents2/Roest_Lab/Github/massdash/massdash/loaders/access/OSWDataAccess.py", line 103, in _initializePeptideHashtable
    tmp = pd.read_sql(stmt, self.conn)
  File "/home/justincsing/anaconda3/envs/py39/lib/python3.9/site-packages/pandas/io/sql.py", line 564, in read_sql
    return pandas_sql.read_query(
  File "/home/justincsing/anaconda3/envs/py39/lib/python3.9/site-packages/pandas/io/sql.py", line 2078, in read_query
    cursor = self.execute(*args)
  File "/home/justincsing/anaconda3/envs/py39/lib/python3.9/site-packages/pandas/io/sql.py", line 2030, in execute
    raise ex from exc
pandas.errors.DatabaseError: Execution failed on sql '
            SELECT MODIFIED_SEQUENCE, CHARGE, PRECURSOR_ID 
            FROM PRECURSOR
            INNER JOIN PRECURSOR_PEPTIDE_MAPPING ON PRECURSOR_PEPTIDE_MAPPING.PRECURSOR_ID = PRECURSOR.ID
            INNER JOIN PEPTIDE ON PEPTIDE.ID = PRECURSOR_PEPTIDE_MAPPING.PEPTIDE_ID': file is not a database

This seems to occur because the downloaded OSW test file is not actually an sqlite osw file

$ head /home/justincsing/Downloads/massdash_example_dataset//test.osw
{"payload":{"allShortcutsEnabled":false,"fileTree":{"test/test_data/example_dia/openswath/osw":{"items":[{"name":"test.osw","path":"test/test_data/example_dia/openswath/osw/test.osw","contentType":"file"}],"totalCount":1},"test/test_data/example_dia/openswath":{"items":[{"name":"lib","path":"test/test_data/example_dia/openswath/lib","contentType":"directory"},{"name":"osw","path":"test/test_data/example_dia/openswath/osw","contentType":"directory"},{"name":"xics","path":"test/test_data/example_dia/openswath/xics","contentType":"directory"}],"totalCount":3},"test/test_data/example_dia":{"items":[{"name":"diann","path":"test/test_data/example_dia/diann","contentType":"directory"},{"name":"dreamdia","path":"test/test_data/example_dia/dreamdia","contentType":"directory"},{"name":"openswath","path":"test/test_data/example_dia/openswath","contentType":"directory"},{"name":"raw","path":"test/test_data/example_dia/raw","contentType":"directory"}],"totalCount":4},"test/test_data":{"items":[{"name":"diann","path":"test/test_data/diann","contentType":"directory"},{"name":"example_dia","pat
$ file /home/justincsing/Downloads/massdash_example_dataset//test.osw
/home/justincsing/Downloads/massdash_example_dataset//test.osw: JSON data

Similarly for the dreamdia test example

$ file /home/justincsing/Downloads/massdash_example_dataset//test_dreamdia_report.tsv 
/home/justincsing/Downloads/massdash_example_dataset//test_dreamdia_report.tsv: JSON data

[BUG] Unexpected keyword argument for conformer peak picking

Describe the bug

Unexpected keyword argument (window_size) when selecting conformer for peak picking.

[2024-01-25 13:14:18,645] GenericResultsAccess - INFO - Selected peptide: KVVITAPGGNDVK Selected charge: 2
Pretrained model file: /media/justincsing/ExtraDrive1/Documents2/Roest_Lab/Github/massdash/massdash/ui/../assets/models/conformer/base_cape.onnx
2024-01-25 13:14:18.785 Uncaught app exception
Traceback (most recent call last):
  File "/home/justincsing/anaconda3/envs/py39/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 535, in _run_script
    exec(code, module.__dict__)
  File "/media/justincsing/ExtraDrive1/Documents2/Roest_Lab/Github/massdash/massdash/gui.py", line 153, in <module>
    main()
  File "/home/justincsing/anaconda3/envs/py39/lib/python3.9/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/home/justincsing/anaconda3/envs/py39/lib/python3.9/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/home/justincsing/anaconda3/envs/py39/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/justincsing/anaconda3/envs/py39/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/media/justincsing/ExtraDrive1/Documents2/Roest_Lab/Github/massdash/massdash/gui.py", line 139, in main
    show_xic_exp.main()
  File "/media/justincsing/ExtraDrive1/Documents2/Roest_Lab/Github/massdash/massdash/server/ExtractedIonChromatogramAnalysisServer.py", line 166, in main
    peak_picker = ConformerPeakPicker(self.massdash_gui.file_input_settings.osw_file_path, peak_picking_settings.peak_picker_algo_settings.pretrained_model_file, window_size=peak_picking_settings.peak_picker_algo_settings.conformer_window_size, prediction_threshold=peak_picking_settings.peak_picker_algo_settings.conformer_prediction_threshold, prediction_type=peak_picking_settings.peak_picker_algo_settings.conformer_prediction_type)
TypeError: __init__() got an unexpected keyword argument 'window_size'

To Reproduce
Steps to reproduce the behavior:

  1. Run GUI
  2. Load test example data for extracted ion chromatogram workflow
  3. Select conformer from peak picking drop down list
  4. See error

Screenshots
image

Desktop (please complete the following information):

  • OS: Linux
  • Firefox
  • Version dev branch

[ADD] Extraction shaded region to raw extraction

Add extraction shaded box to show extraction windows, similar to skyline.

Add an optional extra amount to extraction windows of data to extract for this to make sense/usability. Current extraction, extracts data with the exact windows.

Can add bands to bokeh plot using something like below.

p.xgrid.band_fill_color = "olive"
p.xgrid.band_fill_alpha = 0.1

GUI config file arg

It would be nice to have an argument to the gui that allows passing a config file with desired workflow and files, so that the application automatically loads require workflow and data instead of opening to the welcome page.

Python module - loading Interactive Plotter

When loading interactive plotter as a python module using

from massseer.plotting import InteractivePlotter

I get the following streamlit warning:
2023-11-15 08:37:21.961 WARNING streamlit.runtime.caching.cache_data_api: No runtime found, using MemoryCacheStorageManager

Not sure if there is a way to check if this is being run in a streamlit context or not

Error with visualizing non smoothed chromatograms

When setting smoothing to none we get an error.

image

Although this could be solved by either getting rid of the if condition in chromatogram_plotting_settings these setting do not make sense. We also cannot get rid of these settings all together because these settings are needed for peak picking performed on a chromatogram with None.

Proposed Solution #1: Create seperate sgolay parameters (and advanced pannel) for peak picker MRM. These should by default be the same as sgolay or should be set manually if no sgolay filter is applied

Proposed Solution #2: Perform peak picking directly on raw chromatograms if no sgolay filter.

SqMassLoader not laoding transitionChroms?

I'm running into this issue when I call the loadTransitionGroups method from a SqMassLoader object, it only seems to return precursorChrom data and not transitionChrom data. I'm using the test data, so there should be transition data.

I call the sqMassLoader like this:

self.xic_data = SqMassLoader(self.massseer_gui.file_input_settings.sqmass_file_path_list, self.massseer_gui.file_input_settings.osw_file_path)

tr_group_data = self.xic_data.loadTransitionGroups(transition_list_ui.transition_settings.selected_peptide, transition_list_ui.transition_settings.selected_charge)

The Selected peptide: ANS(UniMod:21)SPTTNIDHLK(UniMod:259) and Selected charge: 2

Specifically in the method call for when if gets transitions

transition_chroms = t.getDataForChromatograms(metaInfo['TRANSITION_ID'], metaInfo['PRODUCT_ANNOTATION'])

It seems like metaInfo['TRANSITION_ID'] evaluates to pd,.DataSeries, similar with metaInfo['PRODUCT_ANNOTATION']

metaInfo['TRANSITION_ID']
0         174
1         175
2         176
3         177
4         178
        ...  
384    700416
385    700417
386    700418
387    700419
388    700420
Name: TRANSITION_ID, Length: 389, dtype: int64
metaInfo['PRODUCT_ANNOTATION']
0      y9^1
1      y3^1
2      y7^1
3      y8^1
4      y4^1
       ... 
384    y9^2
385    y9^1
386    y9^1
387    y9^2
388    y9^2
Name: PRODUCT_ANNOTATION, Length: 389, dtype: object

Checking for the length of precursorChrom and transitionChrom in the TransitionGroup object

Length of transition chromatograms: 0
Length of precursor chromatograms: 1

Plot Interface Refactoring

Refactor plotting documentation for easier interaction with python interface/jupyter notebook interface. I am not too sure which strategy would be best.

Some ideas:

Remove the config interface and directly take in parameters on initiation.

plotting methods directly built into structs?

Installation Issue on Windows

Related to #20

$ pip install -e . 
Obtaining file:///mnt/f/Users/JustinS/github/massseer
Installing build dependencies ... done 
Checking if build backend supports build_editable ... done 
Getting requirements to build editable ... done 
Preparing editable metadata (pyproject.toml) ... done 
Requirement already satisfied: Click in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from MassSeer==0.1.0a0) (8.1.7) Requirement already satisfied: streamlit in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from MassSeer==0.1.0a0) (1.28.1) Requirement already satisfied: numpy>=1.9.0 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from MassSeer==0.1.0a0) (1.26.1) Requirement already satisfied: pandas>=0.17 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from MassSeer==0.1.0a0) (2.1.2) Requirement already satisfied: cython==0.29.32 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from MassSeer==0.1.0a0) (0.29.32) Requirement already satisfied: scipy in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from MassSeer==0.1.0a0) (1.11.3) Requirement already satisfied: pyopenms in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from MassSeer==0.1.0a0) (3.1.0) Requirement already satisfied: PyMSNumpress==0.2.2 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from MassSeer==0.1.0a0) (0.2.2) Requirement already satisfied: bokeh==2.4.3 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from MassSeer==0.1.0a0) (2.4.3) Requirement already satisfied: matplotlib in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from MassSeer==0.1.0a0) (3.8.1) Requirement already satisfied: Jinja2>=2.9 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from bokeh==2.4.3->MassSeer==0.1.0a0) (3.1.2) Requirement already satisfied: packaging>=16.8 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from bokeh==2.4.3->MassSeer==0.1.0a0) (23.2) Requirement already satisfied: pillow>=7.1.0 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from bokeh==2.4.3->MassSeer==0.1.0a0) (10.1.0) Requirement already satisfied: PyYAML>=3.10 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from bokeh==2.4.3->MassSeer==0.1.0a0) (6.0.1) Requirement already satisfied: tornado>=5.1 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from bokeh==2.4.3->MassSeer==0.1.0a0) (6.3.3) Requirement already satisfied: typing-extensions>=3.10.0 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from bokeh==2.4.3->MassSeer==0.1.0a0) (4.8.0) Requirement already satisfied: python-dateutil>=2.8.2 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from pandas>=0.17->MassSeer==0.1.0a0) (2.8.2) Requirement already satisfied: pytz>=2020.1 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from pandas>=0.17->MassSeer==0.1.0a0) (2023.3.post1) Requirement already satisfied: tzdata>=2022.1 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from pandas>=0.17->MassSeer==0.1.0a0) (2023.3) Requirement already satisfied: contourpy>=1.0.1 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from matplotlib->MassSeer==0.1.0a0) (1.2.0) Requirement already satisfied: cycler>=0.10 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from matplotlib->MassSeer==0.1.0a0) (0.12.1) Requirement already satisfied: fonttools>=4.22.0 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from matplotlib->MassSeer==0.1.0a0) (4.44.0) Requirement already satisfied: kiwisolver>=1.3.1 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from matplotlib->MassSeer==0.1.0a0) (1.4.5) Requirement already satisfied: pyparsing>=2.3.1 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from matplotlib->MassSeer==0.1.0a0) (3.1.1) Requirement already satisfied: importlib-resources>=3.2.0 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from matplotlib->MassSeer==0.1.0a0) (6.1.1) Requirement already satisfied: altair<6,>=4.0 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from streamlit->MassSeer==0.1.0a0) (5.1.2) Requirement already satisfied: blinker<2,>=1.0.0 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from streamlit->MassSeer==0.1.0a0) (1.7.0) Requirement already satisfied: cachetools<6,>=4.0 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from streamlit->MassSeer==0.1.0a0) (5.3.2) Requirement already satisfied: importlib-metadata<7,>=1.4 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from streamlit->MassSeer==0.1.0a0) (6.8.0) Requirement already satisfied: protobuf<5,>=3.20 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from streamlit->MassSeer==0.1.0a0) (4.25.0) Requirement already satisfied: pyarrow>=6.0 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from streamlit->MassSeer==0.1.0a0) (14.0.0) Requirement already satisfied: requests<3,>=2.27 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from streamlit->MassSeer==0.1.0a0) (2.31.0) Requirement already satisfied: rich<14,>=10.14.0 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from streamlit->MassSeer==0.1.0a0) (13.6.0) Requirement already satisfied: tenacity<9,>=8.1.0 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from streamlit->MassSeer==0.1.0a0) (8.2.3) Requirement already satisfied: toml<2,>=0.10.1 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from streamlit->MassSeer==0.1.0a0) (0.10.2) Requirement already satisfied: tzlocal<6,>=1.1 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from streamlit->MassSeer==0.1.0a0) (5.2) Requirement already satisfied: validators<1,>=0.2 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from streamlit->MassSeer==0.1.0a0) (0.22.0) Requirement already satisfied: gitpython!=3.1.19,<4,>=3.0.7 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from streamlit->MassSeer==0.1.0a0) (3.1.40) Requirement already satisfied: pydeck<1,>=0.8.0b4 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from streamlit->MassSeer==0.1.0a0) (0.8.1b0) Requirement already satisfied: watchdog>=2.1.5 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from streamlit->MassSeer==0.1.0a0) (3.0.0) Requirement already satisfied: jsonschema>=3.0 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from altair<6,>=4.0->streamlit->MassSeer==0.1.0a0) (4.19.2) Requirement already satisfied: toolz in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from altair<6,>=4.0->streamlit->MassSeer==0.1.0a0) (0.12.0) Requirement already satisfied: gitdb<5,>=4.0.1 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from gitpython!=3.1.19,<4,>=3.0.7->streamlit->MassSeer==0.1.0a0) (4.0.11) Requirement already satisfied: zipp>=0.5 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from importlib-metadata<7,>=1.4->streamlit->MassSeer==0.1.0a0) (3.17.0) Requirement already satisfied: MarkupSafe>=2.0 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from Jinja2>=2.9->bokeh==2.4.3->MassSeer==0.1.0a0) (2.1.3) Requirement already satisfied: six>=1.5 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from python-dateutil>=2.8.2->pandas>=0.17->MassSeer==0.1.0a0) (1.16.0) Requirement already satisfied: charset-normalizer<4,>=2 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from requests<3,>=2.27->streamlit->MassSeer==0.1.0a0) (3.3.2) Requirement already satisfied: idna<4,>=2.5 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from requests<3,>=2.27->streamlit->MassSeer==0.1.0a0) (3.4) Requirement already satisfied: urllib3<3,>=1.21.1 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from requests<3,>=2.27->streamlit->MassSeer==0.1.0a0) (2.0.7) Requirement already satisfied: certifi>=2017.4.17 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from requests<3,>=2.27->streamlit->MassSeer==0.1.0a0) (2023.7.22) Requirement already satisfied: markdown-it-py>=2.2.0 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from rich<14,>=10.14.0->streamlit->MassSeer==0.1.0a0) (3.0.0) Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from rich<14,>=10.14.0->streamlit->MassSeer==0.1.0a0) (2.16.1) Requirement already satisfied: smmap<6,>=3.0.1 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from gitdb<5,>=4.0.1->gitpython!=3.1.19,<4,>=3.0.7->streamlit->MassSeer==0.1.0a0) (5.0.1) Requirement already satisfied: attrs>=22.2.0 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from jsonschema>=3.0->altair<6,>=4.0->streamlit->MassSeer==0.1.0a0) (23.1.0) Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from jsonschema>=3.0->altair<6,>=4.0->streamlit->MassSeer==0.1.0a0) (2023.7.1) Requirement already satisfied: referencing>=0.28.4 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from jsonschema>=3.0->altair<6,>=4.0->streamlit->MassSeer==0.1.0a0) (0.30.2) Requirement already satisfied: rpds-py>=0.7.1 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from jsonschema>=3.0->altair<6,>=4.0->streamlit->MassSeer==0.1.0a0) (0.12.0) Requirement already satisfied: mdurl~=0.1 in /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages (from markdown-it-py>=2.2.0->rich<14,>=10.14.0->streamlit->MassSeer==0.1.0a0) (0.1.2) 
Building wheels for collected packages: MassSeer 
Building editable for MassSeer (pyproject.toml) ... done 
Created wheel for MassSeer: filename=MassSeer-0.1.0a0-0.editable-py3-none-any.whl size=5247 sha256=d0e43ba08ed1f714a1a0cd8b5c584e319447b095b0d940eb25a60527c44d773f 
Stored in directory: /tmp/pip-ephem-wheel-cache-77l9g1uu/wheels/e8/05/3b/b5068ddd1d07ff8394b3b94438f5416bbf5ab2aef00c613ed0 
Successfully built MassSeer 
Installing collected packages: MassSeer 
Attempting uninstall: MassSeer Found existing installation: MassSeer 0.1.0a0 
Uninstalling MassSeer-0.1.0a0: 
Successfully uninstalled MassSeer-0.1.0a0 Successfully installed MassSeer-0.1.0a0 

(py39) roestlab@DESKTOP-GUU42V4:/mnt/f/Users/JustinS/github/massseer$ MassSeer gui 
Traceback (most recent call last): File "/home/roestlab/anaconda3/envs/py39/bin/MassSeer", line 5, in <module>}
from massseer.main import cli ModuleNotFoundError: No module named 'massseer'

TransitionGroupFeatures not labelled in plot

It seems that the interactive plot function takes in a list of TransitionGroupFeatures however it does not seem to plot them. Not sure if this is done somewhere else?

A little confusing though for python library usage

Unexpected Spectrum Plot upon zoom in

Currently playing around more with plotting spectra.

Upon zooming in to the spectra I get an unexpected result. Not sure if this is also present in the streamlit interface.

Possibly have to change to using the vbar command?

image

[REFACTOR] Targeted Extraction with pyOpenMS

Currently the targeted extraction in MzMLDataAccess.py uses pyOpenMS to access the data, but all the extraction / filtering of spectra is done in python. Expose or use extraction methods from pyOpenMS to try speed up extraction, and to be inline with how OpenSwathWorkflow performs extraction.

Missing Packages during install

If someone install this on a fresh environment, they will have troubles with these packages not being installed

Numpy
Scipy

Also, cython for some reason is not installed properly when I used 'pip install -r requirements.txt' If someone calls 'pip install Cython', it will install a version that is not compatible with MSNumpress.

[BUG] Test data not packaged with dist

Test data does not get packaged with built and dist package. This causes the Load example data option in the gui to fail since it can't find the test data.

(base) roestlab@DESKTOP-GUU42V4:~$ ls /home/roestlab/anaconda3/envs/py39/lib/python3.9/site-packages/massdash
__init__.py  assets          gui.py   main.py      plotting    server   ui
__pycache__  dataProcessing  loaders  peakPickers  preprocess  structs  util.py

sqMass Data Access Compression Level 1

Need to add a check for compression level 1, when the data is only zlib compressed. This is usually is not the case if you output a sqMass directly from OpenSwathWorkflow. However, if you output a chrom.mzML and then convert the chrom.mzML to chrom.sqMass, then the compression can be set to 1, zlib only, depending on what flags are set inOpenSwathMzMLFileCacher

Can simply add the following in the _returnDataForChromatogram method

import struct

if compr == 1:
    tmp = zlib.decompress(d)
    result = struct.unpack("<%sd" % (len(tmp) // 8), tmp)

Note: this assumes the data is 64 bit data. I don't think the sqmass stores what type of data the arrays are stored as, but for 32-bit, we could just do result = struct.unpack("<%sd" % (len(tmp) // 4), tmp)

[BUG] KeyError: 'st.session_state has no key "clicked"

Mohammed (@alhigaylan) is running into errors when running the app on Mac.

KeyError: 'st.session_state has no key "clicked". Did you forget to initialize it? More info: https://docs.streamlit.io/library/advanced-features/session-state#initialization'

During handling of the above exception, another exception occurred:

  File "/opt/anaconda3/envs/mseer/lib/python3.9/multiprocessing/spawn.py", line 125, in _main
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/anaconda3/envs/mseer/lib/python3.9/multiprocessing/spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "/opt/anaconda3/envs/mseer/lib/python3.9/multiprocessing/spawn.py", line 125, in _main
    prepare(preparation_data)
  File "/opt/anaconda3/envs/mseer/lib/python3.9/multiprocessing/spawn.py", line 236, in prepare
    prepare(preparation_data)
  File "/opt/anaconda3/envs/mseer/lib/python3.9/multiprocessing/spawn.py", line 236, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
  File "/opt/anaconda3/envs/mseer/lib/python3.9/multiprocessing/spawn.py", line 287, in _fixup_main_from_path
    _fixup_main_from_path(data['init_main_from_path'])
  File "/opt/anaconda3/envs/mseer/lib/python3.9/multiprocessing/spawn.py", line 287, in _fixup_main_from_path
    main_content = runpy.run_path(main_path,
  File "/opt/anaconda3/envs/mseer/lib/python3.9/runpy.py", line 288, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "/opt/anaconda3/envs/mseer/lib/python3.9/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/opt/anaconda3/envs/mseer/lib/python3.9/runpy.py", line 87, in _run_code
    main_content = runpy.run_path(main_path,
  File "/opt/anaconda3/envs/mseer/lib/python3.9/runpy.py", line 288, in run_path
    exec(code, run_globals)
  File "/Users/alhigaylan/Desktop/massseer/massseer/gui.py", line 54, in <module>
    if st.session_state.clicked['load_toy_dataset']:
  File "/opt/anaconda3/envs/mseer/lib/python3.9/site-packages/streamlit/runtime/state/session_state_proxy.py", line 121, in __getattr__
    raise AttributeError(_missing_attr_error_message(key))
AttributeError: st.session_state has no attribute "clicked". Did you forget to initialize it? More info: https://docs.streamlit.io/library/advanced-features/session-state#initialization
    return _run_module_code(code, init_globals, run_name,
  File "/opt/anaconda3/envs/mseer/lib/python3.9/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/opt/anaconda3/envs/mseer/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/alhigaylan/Desktop/massseer/massseer/gui.py", line 54, in <module>
    if st.session_state.clicked['load_toy_dataset']:
  File "/opt/anaconda3/envs/mseer/lib/python3.9/site-packages/streamlit/runtime/state/session_state_proxy.py", line 121, in __getattr__
    raise AttributeError(_missing_attr_error_message(key))
AttributeError: st.session_state has no attribute "clicked". Did you forget to initialize it? More info: https://docs.streamlit.io/library/advanced-features/session-state#initialization
Traceback (most recent call last):
  File "/opt/anaconda3/envs/mseer/lib/python3.9/site-packages/streamlit/runtime/state/session_state.py", line 394, in __getitem__
    return self._getitem(widget_id, key)
  File "/opt/anaconda3/envs/mseer/lib/python3.9/site-packages/streamlit/runtime/state/session_state.py", line 439, in _getitem
    raise KeyError
KeyError

Picking on displayed chromatogram

It seems that toggling on/off the MS2 traces does not change peak picking with the test example is that correct? It seems toggling on/off MS1 traces changes peak picking

image

image

[BUG] Conformer Peak Picking Incorrect Dimensions

Describe the bug
When selecting conformer peak picking, depending on the selected peptide it throws a value error about incorrect dimensions.

ValueError: all the input array dimensions except for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 175 and the array at index 1 has size 1

To Reproduce
Steps to reproduce the behavior:

  1. Start the GUI
  2. Load example data in the XIC workflow
  3. Turn on conformer peak picking

Expected behavior
Perform peaking picking without error

Screenshots

image

Desktop (please complete the following information):

  • Linux
  • Firefox
  • Version: dev branch

sqlite error when using streamlit caching

The following error occurs when using an OSW file and streamlit caching

File "/media/justincsing/ExtraDrive1/Documents2/Roest_Lab/Github/MassSeer/massseer/loaders/access/OSWDataAccess.py", line 118, in _getFeaturesFromPrecursorIdAndRunDf
    if check_sqlite_table(self.conn, "SCORE_MS2"):
  File "/media/justincsing/ExtraDrive1/Documents2/Roest_Lab/Github/MassSeer/massseer/util.py", line 205, in check_sqlite_table
    c = con.cursor()
sqlite3.ProgrammingError: SQLite objects created in a thread can only be used in that same thread. The object was created in thread id 140391240152640 and this is thread id 140391248545344.

[BUG] Conformer model not in Raw targeted extraction workflow

When conformer peak picking is selected in the raw targeted extraction workflow of the GUI, it doesn't actually do anything, because it's not implemented.

The code to perform peak picking with conformer is here massdash/server/ExtractedIonChromatogramAnalysisServer.py#L158-L171

And needs to be copied to massdash/server/PeakPickingServer.py

NOTE: I don't think PeakPickingServer is even used in RawTargetedExtractionAnalysisServer anymore. It was initially used in the initial implementation, but it was not added in the refactored version. I may have forgot to add it... ๐Ÿคฆ

Catching cases when there is no data for TransitionGroup

For raw data extraction, there might be times when there is no spectra/chromatogram data found in the raw data for a precursor. The current extraction pipeline returns a dataframe with mz,rt,im, and rt etc, which in this case would be an empty data frame since no data was found.

I want to catch these cases and return a TransitionGroup like object, but want to return an object that indicates the data was not found. I want to catch these cases so that it doesn't just run into an error because theres no data for plotting, but instead prints a message instead of a plot to say that there was no data found etc.

I'm not sure what the best way would be to handle this. Currently I return the TransitionGroup object, and the underlying Chromatogram/Mobilogram objects just get initialized with empty np.arrays.

I could use this and just get the length and say if it's 0, then display some informative message, otherwise print the plot if there is data.

But I would have to iterate through all the objects in TransitioGroup and get all their lengths etc, so I was thinking maybe just creating a dummy class to represent an empty TransitionGroup, and then do a type check to check if the class if TransitionGroup or TransitionGroupEmpty or something like that.

What do you think @jcharkow , or if you know of a better way of handling this?

[BUG?] pyPeakPickerMRM

I think there might be something wrong with the pyPeakPickerMRM implementation, it's not even picking peaks that would be considered peaks?

image

On the other hand, the MRMTransitionGroupPicker seems to work nicely

image

But there still is some issue with the area from the TransitionGroupFeature objects. I use the area value to set the hight of the peak boundary bar, but it seems the intensity is greater than the peaks itself

st.dataframe cannot handle large dataframes

Streamlist's dataframe cannot handle large dataframes, which is a known issue because of how they send data. See: streamlit/streamlit#517

ValueError: Message ForwardMsg exceeds maximum protobuf size of 2GB: 2763555001

Will need to add a widget in the sidebar to optionally download the full data, and only maximally show N rows of data when using st.dataframe to visually show data.

Plotting Issues

I am testing out the plotting module and running into difficulty with getting the plotting functions to work.

Here is my code

from massseer.loaders.SqMassLoader import SqMassLoader
import os
from massseer.plotting.InteractivePlotter import InteractivePlotter
from massseer.plotting.GenericPlotter import PlotConfig

pep = "NKESPT(UniMod:21)KAIVR(UniMod:267)"
charge = 3
pwd = "../tests/test_data/"
loader = SqMassLoader([os.path.join(pwd + "xics/test_chrom_1.sqMass")], os.path.join(pwd + "osw/test_data.osw"))
transitionGroup = list(loader.loadTransitionGroups(pep, charge).values())[0]


pc = PlotConfig()

plotter = InteractivePlotter(pc)

plotter.plot(transitionGroup)

I am running into several errors regarding the title and if I remove the title also getting errors later on, possibly because the methods are not in use anymore.

SQL Speedup

Look to see if SQL queries could be sped up or if this is a rate limiting factor

Refactor of codebase

Make codebase more "class based" including abstract class based so that it can be more easily extendable. Also this should allow for a friendlier UI for those working directly with the python package.

Several Classes will add include:

Chromatogram - store np arrays of rt and im as well as meta information (e.g. label)

TransitionGroup - an object contaning both the MS1 and the MS2 chromatograms
- possibly some meta information as well

 - getMedian() - returns a median chromatogram object 

GenericPeakPicker - abstract class containing functions which all peakPickers should implement
- contains pick() function which requires a transition group and returns a list of PeakFeatures

- Current Classes Inhereting from this include:
      - pyMRMPeakPicker - Justin's python implementation of MRMPeakPicker
      - MRMPeakPicker - Official OpenMS implementation of MRMPeakPicker (from pyopenms)
      - Leon's PeakPicker  

PeakFeatures - metainformation about a peak feature including rt apex intensity, left width, right width, area intensity etc. These objects created by all peak pickers

ExternalFileLoader - abstract class containing functions to load chromatogram objects
- loadChromatogram() function which takes a peptide sequence as a string and returns a List of TransitionGroup objects (each run)
- loadFeatures() which takes a peptide and loads the features of that peptide into a list of PeakFeatues
- Classes inhereting from this include:
SQMassLoader - inherits from ExternalFileLoader requires osw and list of sqMass files

MzMLLoader - inherits from ExternalFileLoader requires osw/diann results and mzML file 

timsLoader - inherits from ExternalFileLoader requires osw/diann results and mzML file

Plotter abstract class for plotting chromatograms
plotTransitionGroup() requires transition group outputs plot
plotPeakFeatures() requires list of peak features and places them on plot

Current Classes Inhereting from this include:
    StaticPlot()
    InteractivePlot()

streamlit functions hopefully should not change too much.

@singjc Please let me know your thoughts

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.