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

Save empty spectrum list as empty file #586

Open
niekdejonge opened this issue Dec 4, 2023 · 3 comments
Open

Save empty spectrum list as empty file #586

niekdejonge opened this issue Dec 4, 2023 · 3 comments

Comments

@niekdejonge
Copy link
Collaborator

Currently, empty lists of spectra are just not saved (at least for mgf).

This is unexpected behavior to me, I would expect an empty file to be generated that when opened results in an empty list again.

So this would mean just adding a line like:

open(file_name, 'w').close()

to each save_spectra function.

This would only make sense if loading empty spectra files results in empty lists (or generators), which I am not sure of.

@hechth
Copy link
Collaborator

hechth commented Feb 14, 2024

I think it would make sense to either raise an exception or write it to the logger - just silently writing an empty file sounds like a source for errors.
I agree that creating an empty file makes sense for pipelines which for example always expect an output - so I'd go with the logging version and write it to the WARNING level.

@niekdejonge
Copy link
Collaborator Author

Adding a warning would make sense to me as well

@niekdejonge
Copy link
Collaborator Author

If we add this, the load_from_mgf() function should also return an empty list if an empty file is given (this should reduce the risk for errors)

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

No branches or pull requests

2 participants