MannLabs / alphamap

An open-source Python package for the visual annotation of proteomics data with sequence specific knowledge.
https://mannlabs.github.io/alphamap/
Apache License 2.0
76 stars 18 forks source link

peptide.tsv file from FragPipe output fails to load #57

Open MiguelCos opened 1 year ago

MiguelCos commented 1 year ago

Dear alphamap team, First, thanks for mantaining such a useful tool!

I have noticed what I think is a bug when attempting to load Fragpipe outputs to AlphaMap.

After writing the file location in the corresponding area of the AlphaMap app, the loading gets stuck.

Accoriding to what I see in the command line, it is looking for the column Sequence, but as it is not part of this file, it is not able to process the file.

I created a new file in which I created a new Sequence column with the peptide sequences, and the loading then works.

The command line shows this error:

Using frozen version. Setting SSL context to unverified.
******************************
****** AlphaMap 0.1.10 *******
******************************
Launching server at http://localhost:63564
WARNING:tornado.access:404 GET /favicon.ico (::1) 1.00ms
pandas\io\parsers\c_parser_wrapper.py:404: DtypeWarning: Columns (2) have mixed types. Specify dtype option on import or set low_memory=False.
  warnings.warn(warning_message, DtypeWarning, stacklevel=find_stack_level())
ERROR:tornado.application:Exception in callback functools.partial(<bound method IOLoop._discard_future_result of <tornado.platform.asyncio.AsyncIOLoop object at 0x0000020261B2F910>>, <Task finished name='Task-286' coro=<_needs_document_lock.<locals>._needs_document_lock_wrapper() done, defined at bokeh\server\session.py:51> exception=KeyError(229.1629)>)
Traceback (most recent call last):
  File "alphamap\importing.py", line 602, in import_fragpipe_data
    data_sub = pd.read_csv(file, sep=sep, low_memory=False, usecols=combined_fragpipe_columns)
  File "pandas\util\_decorators.py", line 311, in wrapper
    return func(*args, **kwargs)
  File "pandas\io\parsers\readers.py", line 680, in read_csv
    return _read(filepath_or_buffer, kwds)
  File "pandas\io\parsers\readers.py", line 575, in _read
    parser = TextFileReader(filepath_or_buffer, **kwds)
  File "pandas\io\parsers\readers.py", line 933, in __init__
    self._engine = self._make_engine(f, self.engine)
  File "pandas\io\parsers\readers.py", line 1231, in _make_engine
    return mapping[engine](f, **self.options)
  File "pandas\io\parsers\c_parser_wrapper.py", line 131, in __init__
    self._validate_usecols_names(usecols, self.orig_names)
  File "pandas\io\parsers\base_parser.py", line 913, in _validate_usecols_names
    raise ValueError(
ValueError: Usecols do not match columns, columns expected but not found: ['Sequence']

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "tornado\ioloop.py", line 741, in _run_callback
    ret = callback()
  File "tornado\ioloop.py", line 765, in _discard_future_result
    future.result()
  File "bokeh\server\session.py", line 67, in _needs_document_lock_wrapper
    result = func(self, *args, **kwargs)
  File "bokeh\server\session.py", line 195, in with_document_locked
    return func(*args, **kwargs)
  File "bokeh\document\document.py", line 1183, in wrapper
    return doc._with_self_as_curdoc(invoke)
  File "bokeh\document\document.py", line 1169, in _with_self_as_curdoc
    return f()
  File "bokeh\document\document.py", line 1182, in invoke
    return f(*args, **kwargs)
  File "bokeh\document\document.py", line 972, in remove_then_invoke
    return callback(*args, **kwargs)
  File "panel\reactive.py", line 204, in _change_event
    self._process_events(events)
  File "panel\reactive.py", line 187, in _process_events
    self.param.set_param(**self._process_property_change(events))
  File "param\parameterized.py", line 1451, in set_param
    self_._batch_call_watchers()
  File "param\parameterized.py", line 1578, in _batch_call_watchers
    watcher.fn(*events)
  File "panel\param.py", line 739, in _replace_pane
    new_object = self.eval(self.object)
  File "panel\param.py", line 663, in eval
    return function(*args, **kwargs)
  File "param\parameterized.py", line 337, in _depends
    return func(*args,**kw)
  File "alphamap\gui.py", line 1453, in upload_data
    upload_experimental_data()
  File "alphamap\gui.py", line 1039, in upload_experimental_data
    df = import_data(
  File "alphamap\importing.py", line 692, in import_data
    data = import_fragpipe_data(input_info, sample=sample)
  File "alphamap\importing.py", line 613, in import_fragpipe_data
    modif_seq = data_sub.apply(lambda row: convert_fragpipe_mq_mod(row["Peptide"], row["Assigned Modifications"]), axis=1)
  File "pandas\core\frame.py", line 8827, in apply
    return op.apply().__finalize__(self, method="apply")
  File "pandas\core\apply.py", line 727, in apply
    return self.apply_standard()
  File "pandas\core\apply.py", line 851, in apply_standard
    results, res_index = self.apply_series_generator()
  File "pandas\core\apply.py", line 867, in apply_series_generator
    results[i] = self.f(v)
  File "alphamap\importing.py", line 613, in <lambda>
    modif_seq = data_sub.apply(lambda row: convert_fragpipe_mq_mod(row["Peptide"], row["Assigned Modifications"]), axis=1)
  File "alphamap\importing.py", line 545, in convert_fragpipe_mq_mod
    modifs_posit[posit] = modif_convers_dict[mod_mass].format(add_aa)
KeyError: 229.1629