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

Are there filter options available for pileup? #400

Open
Crispy13 opened this issue Jul 8, 2023 · 4 comments
Open

Are there filter options available for pileup? #400

Crispy13 opened this issue Jul 8, 2023 · 4 comments

Comments

@Crispy13
Copy link

Crispy13 commented Jul 8, 2023

In pysam, there are some options for filtering, min base quality, stepper, mapping quality, ignore overlaps .. etc.

Are there any options available for pileup function?

Thanks.

@dlaehnemann
Copy link
Member

From how this sounds (I am not familiar with the functions in pysam), there are no such convenience functions in rust-htslib. But you should be able to achieve any kind of filtering that you want by digging into the docs:

Are you aware of the general docs right here, which provide some examples of how to filter alignments in a pileup (a bit further down):
https://docs.rs/rust-htslib/0.44.1/rust_htslib/#

Otherwise, there are infos on Alignments and Pileup(s) here:
https://docs.rs/rust-htslib/0.44.1/rust_htslib/bam/pileup/index.html

And finally, all the stuff you can do on a Record will probably help you filtering them (probably even before putting them into a pileup):
https://docs.rs/rust-htslib/0.44.1/rust_htslib/bam/record/struct.Record.html

@Crispy13
Copy link
Author

Could you give a tiny example for the last part?

@davidmasp
Copy link

davidmasp commented Apr 5, 2024

I am not super well versed in neither rust or C so excuse my ignorance if I am missing smth obvious.

Just to update a bit more the context from @Crispy13's question. The pileup function in pysam does have multiple options (see here). One of them is for instance ignore_overlaps that mimics the -x option in samtools.

pysam feels more like samtools so I understand there's no feature parity with rust_htslib. However, as far as I can tell from the pysam code and the samtools code, this functionality exists in htslib (see here) not in either library.

So my broader question is, can we access such functionality (i.e. ignoring overlaps) within rust_htslib? or what is the easiest path to do so?

@davidmasp
Copy link

Digging a bit more there seems to be bindings to the function that they use in samtools, here. I think it's a bit over my skill level though.

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

3 participants