zaeleus / noodles

Bioinformatics I/O libraries in Rust
MIT License
515 stars 53 forks source link

util feature #248

Closed larryns closed 8 months ago

larryns commented 8 months ago

Hi,

I'm relatively new to using noodles, so sorry if I'm overlooking something here. But I don't see the "util" feature listed in the noodles crate (in the Cargo.toml for noodles). Is this intentional?

Thanks a lot for your help, Larry.

zaeleus commented 8 months ago

Yes, this is intentional. noodles-util has no features enabled by default, requiring you to add it as a dependency regardless to define them.

larryns commented 8 months ago

Thanks for the fast response. So if I wanted to write a RecordBuf variable to a SAM record, I would use the write_record method from noodles_util:::alignment::io::writer::builder::Builder. Is that correct?

Thanks so much.

zaeleus commented 8 months ago

If you only want to write out as SAM, use noodles::sam::io::Writer, e.g, https://github.com/zaeleus/noodles/blob/4f7254271f3dad76bae9994a866caa06511aaad7/noodles-sam/examples/sam_write.rs#L48-L49

If you want to dynamically select the output format (SAM, BAM, or CRAM), use noodles_util::alignment::io::Writer, e.g., https://github.com/zaeleus/noodles/blob/4f7254271f3dad76bae9994a866caa06511aaad7/noodles-util/examples/util_alignment_rewrite.rs#L36-L39

larryns commented 8 months ago

Thank you!