Skip to content

deserializing records from htsget stream #318

Answered by zaeleus
cmdoret asked this question in Q&A
Discussion options

You must be logged in to vote

I would recommend converting the chunks stream to an async reader using tokio_util::io::StreamReader. This way, you can use cram::r#async::io::Reader as you normally would.

Since you're working with CRAM, note that it commonly requires a reference sequence. Also note that htsget responses may include records outside the requested region(s), which you must filter yourself.

Here's a full example showing all of this:

main.rs
// cargo add [email protected] --no-default-features --features std
// cargo add [email protected] --features async,core,cram,fasta,htsget,sam
// cargo add [email protected] --features io-std,macros,rt-multi-thread
// cargo add [email protected] --features io

use std::env;

use fu…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@cmdoret
Comment options

Answer selected by cmdoret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants
Converted from issue

This discussion was converted from issue #317 on January 13, 2025 19:18.