Struct noodles::bcf::Writer[][src]

pub struct Writer<W> where
    W: Write
{ /* fields omitted */ }
Expand description

A BCF writer.

Implementations

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());

Returns a reference to the underlying writer.

Examples

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

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()?;

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 VCF record.

Examples

use noodles_bcf::{self as bcf, header::StringMap};
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_map = StringMap::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_map, &record)?;

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.

Performs the conversion.

Should always be Self

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.