QuantSysBio / inSPIRE

in silico Spectral Predictor Informed REscoring
GNU General Public License v2.0
20 stars 1 forks source link

modification key error #24

Closed colin986 closed 4 months ago

colin986 commented 1 year ago

Hello,

When I run inspire on MaxQuant data I am getting the following error

Traceback (most recent call last): File "/home/colin/miniconda3/envs/inspire/bin/inspire", line 8, in sys.exit(main()) File "/home/colin/miniconda3/envs/inspire/lib/python3.9/site-packages/inspire/run.py", line 114, in main prepare_for_spectral_prediction(config) File "/home/colin/miniconda3/envs/inspire/lib/python3.9/site-packages/inspire/prepare.py", line 157, in prepare_for_spectral_prediction target_df, mods_df = generic_read_df(config) File "/home/colin/miniconda3/envs/inspire/lib/python3.9/site-packages/inspire/input/search_results.py", line 55, in generic_read_df search_df, mods_df = read_mq_data(config.search_results) File "/home/colin/miniconda3/envs/inspire/lib/python3.9/site-packages/inspire/input/maxquant.py", line 252, in read_mq_data return read_single_mq_data(mq_data) File "/home/colin/miniconda3/envs/inspire/lib/python3.9/site-packages/inspire/input/maxquant.py", line 171, in read_single_mq_data mq_df[PTM_SEQ_KEY] = mq_df[MQ_MOD_SEQ_KEY].apply( File "/home/colin/miniconda3/envs/inspire/lib/python3.9/site-packages/pandas/core/series.py", line 4433, in apply return SeriesApply(self, func, convert_dtype, args, kwargs).apply() File "/home/colin/miniconda3/envs/inspire/lib/python3.9/site-packages/pandas/core/apply.py", line 1088, in apply return self.apply_standard() File "/home/colin/miniconda3/envs/inspire/lib/python3.9/site-packages/pandas/core/apply.py", line 1143, in apply_standard mapped = lib.map_infer( File "pandas/_libs/lib.pyx", line 2870, in pandas._libs.lib.map_infer File "/home/colin/miniconda3/envs/inspire/lib/python3.9/site-packages/inspire/input/maxquant.py", line 172, in lambda x : _create_ptm_seq_col(x, var_mod_dict) File "/home/colin/miniconda3/envs/inspire/lib/python3.9/site-packages/inspire/input/maxquant.py", line 138, in _create_ptm_seq_col ptm_seq += str(unqiue_mods[mod]) KeyError: 'ox)'

I was wondering if you could assist me in finding the problem.

Thank you Colin

jamc1996 commented 1 year ago

Hi Colin,

Thanks for using inSPIRE.

I haven't seen this problem before so I would guess it's some edge case we didn't see during development. It could also be a potential issue in MaxQuant versions. Which version are you using?

It would be very helpful if you could share an example MaxQuant output file so that we can reproduce this issue?

Best wishes, John.

colin986 commented 1 year ago

Thanks John,

Version MaxQuant 1.6.3.3 Inspire version 1.5 installed via Conda

First 1000 lines of msms.txt attached. Tested on my side and results in the error.

msms.txt

Best, Colin

jamc1996 commented 1 year ago

Hi Colin,

Thanks for getting back so quickly. Ok that is odd we also used MaxQuant 1.6 but there seem to be abbreviations used in your msms.txt that I haven't seen before.

I've added a fix to the code on Github which should work for you but it may be some time before this is on pypi as I'd like to understand the MaxQuant behaviour better.

You can install the updated code using the instructions below:

Uninstall your existing installation:

pip uninstall inspirems

Clone the GitHub repo:

git clone https://github.com/QuantSysBio/inSPIRE.git

Change directory into inSPIRE:

cd inSPIRE

Install the cloned repo:

python setup.py install

Thanks again and let me know if there are still any issues.

Best, John.

colin986 commented 1 year ago

Thanks a million John, I can now run Inspire on my data.

I'd also like to set the fixed modification to Carbamidomethylation - can you let me know how to do this in the config.yaml

Best, Colin

jamc1996 commented 1 year ago

Hi Colin,

That's great! Sorry yes you will need to add

fixedModifications:
  - Carbamidomethylation

to your inSPIRE config file.

All the best, John.

jamc1996 commented 4 months ago

The updates for this issue are now on pip in the pre-release version of inSPIRE 2.0 so I'll close this issue. There is another open issue now where we're dealing with a similar problem with different modifications featured.

Thanks for your help in improving inSPIRE.