mwang87 / MassQueryLanguage

The Mass Spec Query Language (MassQL) is a domain specific language meant to be a succinct way to express a query in a mass spectrometry centric fashion.
https://mwang87.github.io/MassQueryLanguage_Documentation/
MIT License
38 stars 8 forks source link

Error on MALDI (maybe LC) if no MS2 #110

Closed chasemc closed 3 years ago

chasemc commented 3 years ago

File: https://massive.ucsd.edu/ProteoSAFe/DownloadResultFile?file=f.MSV000083461/ccms_peak/mzXML/119A-24.mzML

 python3  workflow/bin/msql_cmd.py     "/home/chase/Downloads/119A-24.mzML"     "QUERY scaninfo(MS2DATA)" 
Namespace(cache='YES', extract_json=None, extract_mzML=None, filename='/home/chase/Downloads/119A-24.mzML', original_path=None, output_file=None, parallel_query='NO', query='QUERY scaninfo(MS2DATA)')
{
    "querytype": {
        "function": "functionscaninfo",
        "datatype": "datams2data"
    },
    "conditions": [],
    "query": "QUERY scaninfo(MS2DATA)"
}
TOTAL QUERIES 1
  0%|                                                                      | 0/1 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "workflow/bin/msql_cmd.py", line 115, in <module>
    main()
  File "workflow/bin/msql_cmd.py", line 44, in main
    results_df = msql_engine.process_query(query, 
  File "/home/chase/Documents/github/MassQueryLanguage/msql_engine.py", line 176, in process_query
    return _evalute_variable_query(parsed_dict, input_filename, cache=cache, parallel=parallel)
  File "/home/chase/Documents/github/MassQueryLanguage/msql_engine.py", line 390, in _evalute_variable_query
    collated_df = _executecollate_query(parsed_dict, results_ms1_df, results_ms2_df)
  File "/home/chase/Documents/github/MassQueryLanguage/msql_engine.py", line 750, in _executecollate_query
    result_df = ms2_df.groupby(groupby_columns).first().reset_index()
  File "/home/chase/.local/lib/python3.8/site-packages/pandas/core/frame.py", line 6714, in groupby
    return DataFrameGroupBy(
  File "/home/chase/.local/lib/python3.8/site-packages/pandas/core/groupby/groupby.py", line 560, in __init__
    grouper, exclusions, obj = get_grouper(
  File "/home/chase/.local/lib/python3.8/site-packages/pandas/core/groupby/grouper.py", line 811, in get_grouper
    raise KeyError(gpr)
KeyError: 'scan'
mwang87 commented 3 years ago

Yes, if there aren't any MS2s, we shoudl catch this but you'll also just end up with no results.