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

Accessing raw bitpacked sequences for writing? #7

Open
vsbuffalo opened this issue Dec 18, 2024 · 1 comment
Open

Accessing raw bitpacked sequences for writing? #7

vsbuffalo opened this issue Dec 18, 2024 · 1 comment

Comments

@vsbuffalo
Copy link

Hi,

Thank for writing this beautiful and powerful Rust library! I was curious if it would work well for what I want to do — bitpacking IUPAC nucleotide sequences, and then writing/reading them to a memory mapped file. But as far as I can tell, there isn't a way to take write/read the raw underlying u8 sequence to disk. Is there support for this? My apologies if I'm overlooking something.

Thanks,
Vince

@jeff-k
Copy link
Owner

jeff-k commented Dec 19, 2024

Hey Vince, thanks for the kind words!

There are two options:

I put together a little example here: https://github.com/jeff-k/bio-seq/blob/main/bio-seq/examples/seq2bin.rs

If you're using memory mapping to handle very large sequences please let me know if there are any issues, I haven't tried this. I'm wondering if you'll need to view the &[usize] as a &[u8] without any copying. It could be a very nice example to include!

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