compomics / ms2rescore

Modular and user-friendly platform for AI-assisted rescoring of peptide identifications
https://ms2rescore.readthedocs.io
Apache License 2.0
39 stars 14 forks source link

Persistent warning about OPENMS_DATA_PATH #129

Closed vrkosk closed 3 months ago

vrkosk commented 3 months ago

I'm getting a persistent warning about OPENMS_DATA_PATH when I use ms2rescore.feature_generators.ms2pip.MS2PIPFeatureGenerator from a Python script.

Here's how I create the environment:

C:\python\python309\python.exe -m venv venv_309_ms2rescore
venv_309_ms2rescore\Scripts\pip3 install ms2rescore==3.0.2

The script is the same as in issue #128. When I use the workaround (only output deltas in ProForma strings), there's a warning every time I run MS2PIPFeatureGenerator:

Calculating features... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━   0% -:--:--Warning: OPENMS_DATA_PATH environment variable already exists. pyOpenMS will use it (C:\Users\villek\tmp\venv_309_ms2rescore\lib\site-packages\pyopenms\share/OpenMS) to locate data in the OpenMS share folder (e.g., the unimod database), instead of the default (C:\Users\villek\tmp\venv_309_ms2rescore\lib\site-packages\pyopenms\share/OpenMS).

The directory paths are identical so I'm assuming the warning is harmless. But how and where do I suppress this warning?

RalfG commented 3 months ago

Hi @vrkosk,

There is indeed no issue with the paths that are set, but I agree that the wall of warnings are reasonably annoying. Unfortunately, pyOpenMS uses print to write this warning, so there is currently no clean way to suppress it. There has been some discussion on this issue (https://github.com/OpenMS/OpenMS/pull/6979), but no actions were taken. I'll see if the pyOpenMS maintainers would consider reopening the PR.

Best, Ralf

RalfG commented 3 months ago

I proposed changes to OpenMS to fix the issue (openms/openms#7418). If accepted, I can filter the warnings upstream in psm_utils (compomics/psm_utils#74).

vrkosk commented 3 months ago

That's great, thanks!

RalfG commented 3 months ago

OpenMS/OpenMS#7418 has been merged, so a fix should be part of the next pyOpenMS version. Filtering of the warnings is now also implemented at the level of psm_utils (compomics/psm_utils#74).