-
Notifications
You must be signed in to change notification settings - Fork 66
Closed
Description
Dear developers,
When streaming chunks using noodles-htsget, is there a way to lazily parse CRAM records in memory?
In the noodles-htsget example, I've tried to replace:
noodles/noodles-htsget/examples/htsget_download_reads.rs
Lines 32 to 34 in 779500a
| while let Some(chunk) = chunks.try_next().await? { | |
| stdout.write_all(&chunk).await?; | |
| } |
with things like:
let first_chunk = &chunks
.try_next()
.await
.expect("can't load chunk")
.unwrap()[..];
let mut reader = Reader::new(first_chunk);
let header = reader
.read_header()
.unwrap();
while let Some(chunk) = chunks.try_next().await.expect("can't load chunk") {
let mut reader = Reader::new(&chunk[..]);
for result in reader.records(&header) {
let record = result.expect(&format!("{:?}", chunk));
println!("{:?}", record);
}
}But when trying to instantiate records, I keep getting:
Custom { kind: InvalidData, error: TryFromInt
Error(()) }
Would you have any advice to parsing these records without saving the actual file?
Reactions are currently unavailable