Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add new tool: msp_split #234

Merged
merged 19 commits into from
Mar 25, 2022
Merged

add new tool: msp_split #234

merged 19 commits into from
Mar 25, 2022

Conversation

wverastegui
Copy link
Contributor

@wverastegui wverastegui commented Mar 17, 2022

No description provided.

@martenson martenson changed the title pull request new tool add new tool: msp_split Mar 17, 2022
@wverastegui wverastegui linked an issue Mar 18, 2022 that may be closed by this pull request
@hechth
Copy link
Member

hechth commented Mar 18, 2022

When testing the tool with the file available here, it fails with the following error:

Traceback (most recent call last):
  File "/m2b/home/hechth/git/recetox/galaxytools/tools/msp_split/splitMSP.py", line 43, in <module>
    split_spectra(filename, outdir)
  File "/m2b/home/hechth/git/recetox/galaxytools/tools/msp_split/splitMSP.py", line 31, in split_spectra
    return write_spectra(filename, outdir)
  File "/m2b/home/hechth/git/recetox/galaxytools/tools/msp_split/splitMSP.py", line 26, in write_spectra
    save_as_msp(spectra[i], outpath)
  File "/home/hechth/miniconda3/envs/__matchms@0.14.0/lib/python3.9/site-packages/matchms/exporting/save_as_msp.py", line 56, in save_as_msp
    with open(filename, "w", encoding="utf-8") as outfile:
FileNotFoundError: [Errno 2] No such file or directory: 'output/Benzanthracene/Benzophenanthrene.msp'

This is due to the name of a specific spectrum having a / character in the filename:

NAME: Benzanthracene/Benzophenanthrene
SCANNUMBER: -1
RETENTIONTIME: -1
RETENTIONINDEX: 2470
PRECURSORMZ: 228.09334
PRECURSORTYPE: [M]+
IONMODE: Positive
...

This could be fixed by replacing illegal characters from the compound name (such as / or other characters) with _ or so to avoid these errors. The tool test should also be extended by a case which covers this.

Copy link
Member

@hechth hechth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, just please address the mentioned points.

tools/msp_split/.shed.yml Outdated Show resolved Hide resolved
tools/msp_split/.shed.yml Outdated Show resolved Hide resolved
tools/msp_split/splitMSP.py Outdated Show resolved Hide resolved
tools/msp_split/splitMSP.py Outdated Show resolved Hide resolved
tools/msp_split/splitMSP.xml Outdated Show resolved Hide resolved
tools/msp_split/splitMSP.xml Outdated Show resolved Hide resolved
tools/msp_split/splitMSP.xml Outdated Show resolved Hide resolved
wverastegui and others added 9 commits March 18, 2022 14:58
Co-authored-by: Helge Hecht <helge.hecht@recetox.muni.cz>
Co-authored-by: Helge Hecht <helge.hecht@recetox.muni.cz>
tools/msp_split/splitMSP.xml Outdated Show resolved Hide resolved
tools/msp_split/splitMSP.py Outdated Show resolved Hide resolved
@martenson martenson merged commit 0d9dfea into RECETOX:master Mar 25, 2022
@martenson
Copy link
Member

Thanks @wverastegui !

@wverastegui wverastegui deleted the Utils_msp branch May 5, 2022 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Split MSP into collection of individual spectra
3 participants