Struct bam::sam::SamWriter[][src]

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

Writes records in SAM format.

Can be created as

let writer = SamWriter::from_path("out.sam", header).unwrap();

or using a builder

let writer = SamWriter::build()
    .write_header(false)
    .from_path("out.sam", header).unwrap();

You can clone a header from SAM/BAM reader or create one yourself.

You need to import RecordWriter to write records:

use bam::RecordWriter;
let mut writer = bam::SamWriter::from_path("out.sam", header).unwrap();
let mut record = bam::Record::new();
// Filling the record.
writer.write(&record).unwrap();

Implementations

Create a builder.

Creates a SAM writer from a path and a header.

Creates a SAM writer from a stream and a header. Preferably the stream should be wrapped in a buffer writer, such as BufWriter.

Returns header.

Flushes contents to output.

Consumes the writer and returns inner stream.

Trait Implementations

Writes a single record in SAM format.

Finishes the stream, same as std::mem::drop(writer), but can return an error.

Flushes contents.

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.

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.