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

Error running bcftools plugin #1287

Open
awgymer opened this issue May 7, 2024 · 5 comments
Open

Error running bcftools plugin #1287

awgymer opened this issue May 7, 2024 · 5 comments

Comments

@awgymer
Copy link

awgymer commented May 7, 2024

Trying to run bcftools plugin via the pysam.bcftools API results in the following error:

pysam.bcftools.plugin('-l')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/me/.pyenv/versions/venv/lib/python3.10/site-packages/pysam/utils.py", line 83, in __call__
    raise SamtoolsError(
pysam.utils.SamtoolsError: "bcftools returned with error 1: stdout=, stderr=[E::bcftools_main] unrecognized command 'plugin'\n"

I am running pysam==0.21.0

@jmarshall
Copy link
Member

Thanks for the report. We would have to arrange for the bcftools code within pysam to be built with ENABLE_BCF_PLUGINS to include this code.

Also the bcftools plugins are not being built — in fact, their source code is currently omitted from the pysam repository. It might be best to leave it that way and use a separate bcftools installation's plugins via $BCFTOOLS_PLUGINS etc.

@awgymer
Copy link
Author

awgymer commented May 7, 2024

I see. That feels like a somewhat odd choice given that the plugins usually come with the default distribution of bcftools?

If using $BCFTOOLS_PLUGINS to point to another install's plugins I think at that point it's may be cleaner to install with an external htslib as documented here? (although I am not sure on how tricky the issues of pointing to the correct libhts.so can be, having not done that before)

@jmarshall
Copy link
Member

I don't see it as an odd choice. The goal of pysam is to provide convenient Python facilities, which has traditionally (and somewhat unfortunately!) included providing access to some samtools and bcftools commands. Providing built-in access to commands implemented as bcftools plugins is fairly far down the priority list… 🤷 the clue is in both parts of the name bcftools plugin… but enabling access to existing bcftools plugins installed from elsewhere would be more feasible.

Bundling and distributing bcftools plugins would bring its own problems, so might be best avoided.

Re your second paragraph, note that bcftools plugins (which provide additional commands) are a separate matter from htslib plugins (which at present provide remote file access).

@awgymer
Copy link
Author

awgymer commented May 7, 2024

It's not so much that I have a problem with the choice to not support plugin as default, but rather it seemed unintuitive to me, yes they are plugins but they are also part of the default bcftools distribution whenever I have installed them. From your comment I think perhaps you see access to samtools/bcftools as more of a side effect than a core functionality and from that perspective the choice makes more sense.

bcftools plugins are separate from htslib plugins but it was more me thinking if I am pointing to some plugin dir it's just easiest to ensure that all the libraries are on the same version if I use the whole external libs. But I may be misunderstanding how that works 🥲

@jmarshall
Copy link
Member

Building the bundled subset of the bcftools source code without defining ENABLE_BCF_PLUGINS, which is what causes the “unrecognized command 'plugin'” error, was an unintentional oversight and will be fixed.

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