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

Inconsistent exit codes #79

Open
alephreish opened this issue Jan 13, 2025 · 4 comments
Open

Inconsistent exit codes #79

alephreish opened this issue Jan 13, 2025 · 4 comments

Comments

@alephreish
Copy link

Hello, I noticed that SNPGenie's successful runs exit with what seems to me to be inconsistent exit codes: 0 or 25. From my experience, runs with warnings exit with code 0 and runs w/o warnings exit with code 25 which is particularly counterintuitive. Any code other than 0 means a failure. In practical terms, this breaks e.g. snakemake rules or stuff like snpgenie.pl && mv results to_some_other_dir. I'm using snpgenie 1.0 via bioconda.

@alephreish
Copy link
Author

At first I thought that snpgenie.pl || [ $? -eq 25 ] would be a valid workaround but the exit codes of failed calls are even less consistent and some of them return status 25 or even 0 as well:

  • Results directory already exists => 255
  • Problem creating results directory => 0
  • There must be only one reference genome. => 25
  • XXXX.gtf does not contain any sense (+) strand products. => 25
  • The SNP Report XXXX.vcf has no header. => 9
  • User must specify the specific SNP report format => 255

This means that it is impossible to tell if the run was successful or not w/o checking the output files.

@singing-scientist
Copy link
Contributor

Dear @alephreish, thank you for flagging this problem. Indeed the program was written purely (and poorly) as a standalone tool, with the expectation that the output files would be examined by a human, well before I understood or anticipated usage and conventions in pipelines like this. I really apologize and wish I had time and support for addressing this and myriad other inefficiencies. I do hope to undertake a complete rewrite in the future if I can find support to do so. In the meantime, please do let me know if there are any π or analysis questions I can help with. Thanks for your understanding!

@alephreish
Copy link
Author

alephreish commented Jan 14, 2025

@singing-scientist As long as the behaviour of a piece of software is predictable, it is in principle possible to integrate it in a pipeline. SNPGenie is not a very hard case in this respect: e.g. snpgenie.pl --outdir={output} &> {log} ||:&& grep 'completed successfully' {log} would ignore the exit status entirely and instead check whether SNPGenie reported to have completed successfully in the log, but a clean solution would be to fix the exit codes.

If I find the time for this, do you accept pull requests?

@singing-scientist
Copy link
Contributor

@alephreish thanks so much for your understanding and your generous proposal! I think if the changes are incredibly simple, say only employing die and exit in straightforward ways, I could find the time to evaluate the changes you might propose and run the necessary tests. (I'm sure you've already noticed the script is incredibly brittle and inelegant — the maiden coding voyage of yours truly.) But I really do apologize for my lack of bandwidth, as I would have no time to do this until at least February. Thanks again and let me know your thoughts.

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