Skip to main content

bed_write/
bed_write.rs

1//! Creates a new BED3 file.
2//!
3//! This writes a single BED3 record to stdout.
4
5use std::io;
6
7use noodles_bed::{self as bed, feature::RecordBuf};
8use noodles_core::Position;
9
10fn main() -> Result<(), Box<dyn std::error::Error>> {
11    let stdout = io::stdout().lock();
12    let mut writer = bed::io::Writer::<3, _>::new(stdout);
13
14    let record = RecordBuf::<3>::builder()
15        .set_reference_sequence_name("sq0")
16        .set_feature_start(Position::try_from(8)?)
17        .set_feature_end(Position::try_from(13)?)
18        .build();
19
20    writer.write_feature_record(&record)?;
21
22    Ok(())
23}