Rust API docs Crates.io

bam-builder

A library for easily building bams for testing.

Example

```rust use bambuilder::{bamorder::BamSortOrder, BamBuilder};

fn main() { // Create a builder with all defaults except the readlen is 100 let mut builder = BamBuilder::new( 100, 30, "Pair".toowned(), None, BamSortOrder::Unsorted, None, None, );

// Create a builder for read pair spec
let records = builder
    .pair_builder()
    .contig(0)
    .start1(0)
    .start2(200)
    .unmapped1(false)
    .unmapped2(false)
    .bases1("A".repeat(100))
    .bases2("C".repeat(100))
    .build()
    .unwrap();
println!("{:?}", records);

// Add the pair to bam builder
builder.add_pair(records);
println!("{:?}", builder);
// Write records to a file
builder
    .to_path(std::path::Path::new(&String::from("./test.bam")))
    .unwrap();

} ```