-
Notifications
You must be signed in to change notification settings - Fork 277
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
bcftools annotate method missing #958
Comments
Samtools and bcftools commands are added in pysam/samtools.py and pysam/bcftools.py, however they differ in small ways and in particular pysam/__init__.py imports from samtools but not bcftools. Hence: import pysam.bcftools
pysam.bcftools.annotate(…) However this then proceeds to not work. So there is something to fix here for all bcftools commands. |
Is this the same for tools like tabix and bgzip? I'm managing to call them without specifically importing pysam.samtools. i.e. they are available as long as I import pysam. |
What python invocations are you using for tabix and bgzip? |
The problem is that bcftools calls This isn't really practical to fix. When invoking bcftools commands, make very sure to get your arguments correct and avoid causing error messages 😄 |
Isn't the whole problem here that pysam is calling a program as if it was a function, rather than running it in a sub-process? I think it would come under the "courageous decision" moniker. Certainly we shouldn't be exiting from a library, but I think it's fair enough for application developers to consider exiting on error and to not be assuming they're being turned into a library by some magic of linking. |
it comes under the “one of the older parts of pysam, there because people have found it useful” moniker. |
I'm not doubting the functionality, just the implementation. :) Even if it's still calling it via a function, it could fork first so exit doesn't kill the main thread. |
Indeed. I'm sure patches are welcome! |
It looks like some comments are missing in this thread but I think I am experience a related problem. BCFtools commands that I guess throw errors exit without showing the error. To me the commands seem correct and work on the command line, but do not work using pysam. For example, this command does nothing. But the equivalent command on the command line works fine.
I'm also not able to write files with vcftools even when the commands do seem to work. This command does not write test_view.vcf
Am I misunderstanding how to run bcftools commands with pysam or is something wrong? Thanks |
I figured out that the output is being returned as a variable. Is it possible to have bcftools redirect this to a file? |
@gregmcinnes: You want |
- this wasn't explicitly stated in the documentation. I was using the notes described in [github issue 958][0] as a guide. [0]: pysam-developers#958
- this wasn't explicitly stated in the documentation. I was using the notes described in [github issue 958][0] as a guide. - in the changes also put updated links to the bcftools and htslib.org pages [0]: pysam-developers#958
Currently assuming this is the only method missing. Most methods for bcftools are present, I can't for the life of me, figure out how to call bcftools annotate though. It results in:
Have also looked using dir, i.e.
I can't see anything in there that would suggest an annotate method. That said, there is a file in this repo that suggests that it has been at least partially implemented?
The text was updated successfully, but these errors were encountered: