Skip to content

Could I get RecordBuf instead of Record from Query? #261

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

You must be logged in to vote

To read into an existing RecordBuf, I would recommend manually composing a query reader with a BAM reader, e.g.,

main.rs
// cargo add [email protected] --features bam,core,csi,sam
// cargo add [email protected] --features libdeflate

use std::{env, io};

use noodles::{
    bam,
    core::{region::Interval, Region},
    csi,
    sam::{
        self,
        alignment::{io::Write, RecordBuf},
    },
};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut args = env::args();

    let src = args.nth(1).expect("missing src");
    let region: Region = args.next().expect("missing region").parse()?;

    let mut reader = bam::io::indexed_reader::Builder::default().build_from_path(src)?;

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Crispy13
Comment options

@zaeleus
Comment options

Answer selected by Crispy13
@Crispy13
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants