pub struct Writer<W> { /* private fields */ }
Expand description

A BCF writer.

Implementations

Returns a reference to the underlying writer.

Examples
use noodles_bcf as bcf;
let writer = bcf::Writer::from(Vec::new());
assert!(writer.get_ref().is_empty());

Returns a mutable reference to the underlying writer.

Examples
use noodles_bcf as bcf;
let mut writer = bcf::Writer::from(Vec::new());
assert!(writer.get_mut().is_empty());

Returns the underlying writer.

Examples
use noodles_bcf as bcf;
let mut writer = bcf::Writer::from(Vec::new());
assert!(writer.into_inner().is_empty());

Writes a BCF file format.

Examples
use noodles_bcf as bcf;
let mut writer = bcf::Writer::new(Vec::new());
writer.write_file_format()?;

Writes a VCF header.

Examples
use noodles_bcf as bcf;
use noodles_vcf as vcf;

let mut writer = bcf::Writer::new(Vec::new());

let header = vcf::Header::default();
writer.write_header(&header)?;

Writes a record.

Examples
use noodles_bcf as bcf;
let mut writer = bcf::Writer::new(Vec::new());
let record = bcf::Record::default();
writer.write_record(&record)?;

Writes a VCF record.

Examples
use noodles_bcf::{self as bcf, header::StringMaps};
use noodles_vcf::{self as vcf, header::Contig, record::Position};

let mut writer = bcf::Writer::new(Vec::new());

let header = vcf::Header::builder()
    .add_contig(Contig::new("sq0"))
    .build();

writer.write_header(&header)?;

let string_maps = StringMaps::from(&header);

let record = vcf::Record::builder()
    .set_chromosome("sq0".parse()?)
    .set_position(Position::try_from(8)?)
    .set_reference_bases("A".parse()?)
    .build()?;

writer.write_vcf_record(&header, &string_maps, &record)?;

Creates a BCF writer with a default compression level.

The given stream is wrapped in a BGZF encoder.

Examples
use noodles_bcf as bcf;
let writer = bcf::Writer::new(Vec::new());

Attempts to finish the output stream.

This is typically only manually called if the underlying stream is needed before the writer is dropped.

Examples
use noodles_bcf as bcf;
let mut writer = bcf::Writer::new(Vec::new());
writer.try_finish()?;

Trait Implementations

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.