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

2vcf.py exits with a non-zero exit code when executed by snakemake #28

Closed
aryarm opened this issue Apr 15, 2021 · 3 comments · Fixed by #31
Closed

2vcf.py exits with a non-zero exit code when executed by snakemake #28

aryarm opened this issue Apr 15, 2021 · 3 comments · Fixed by #31
Assignees
Labels
bug Something isn't working

Comments

@aryarm
Copy link
Owner

aryarm commented Apr 15, 2021

For some reason, the 2vcf.py script sometimes finishes with a non-zero exit code. It isn't clear what might be causing this. The usual warnings that I added are printed, but the warnings don't seem to be the cause of the non-zero exit code. No other information appears to explain why the exit code isn't 0. In fact, the VCF output looks correct.

This is a problem because the non-zero exit code causes Snakemake to remove the output after it is created.

@aryarm aryarm added the bug Something isn't working label Apr 15, 2021
@aryarm aryarm self-assigned this Apr 15, 2021
@aryarm aryarm changed the title 2vcf.py sometimes exits with non-zero exit code 2vcf.py sometimes exits with a non-zero exit code Apr 15, 2021
@aryarm
Copy link
Owner Author

aryarm commented Apr 16, 2021

Sources online say that PyQt can sometimes cause scripts to silently finish with a non-zero exit code. So I might look into that...
So far, I've only been able to reproduce the problem when running it on an entire dataset with Snakemake. I get an exit code of 0 when running locally.

@aryarm
Copy link
Owner Author

aryarm commented Apr 17, 2021

Ok, new idea: it's because I didn't put matplotlib.use('Agg') at the top of the script

import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt

Update
wait - no it's not that, either
it seems like the command only fails in bash strict mode with set -o pipefail. That's why it wasn't failing when I ran it but it was failing when Snakemake ran it

@aryarm aryarm changed the title 2vcf.py sometimes exits with a non-zero exit code 2vcf.py exits with a non-zero exit code in cluster mode Jul 1, 2021
@aryarm aryarm changed the title 2vcf.py exits with a non-zero exit code in cluster mode 2vcf.py exits with a non-zero exit code when executed by snakemake Jul 1, 2021
@aryarm
Copy link
Owner Author

aryarm commented Jul 2, 2021

ok so it seems like the underlying issue is that 2vcf.py is not consuming all of its stdin, so zcat is erroring with exit code 141 and the pipefail is propagating that. Don't ask me how I figured that out. It took like 30 re-tries and a bunch of guess and check

so instead of piping the file, let's just try to read it from the python side
pandas should be able to handle gzipped files, anyway
I'll just need to tell it to ignore a bunch of the columns in the file, and apparently you can do that by passing a lambda function to usecols

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant