pub struct SamWriter<W: Write> { /* private fields */ }
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§
Source§impl<W: Write> SamWriter<W>
impl<W: Write> SamWriter<W>
Sourcepub fn from_stream(stream: W, header: Header) -> Result<Self>
pub fn from_stream(stream: W, header: Header) -> Result<Self>
Creates a SAM writer from a stream and a header. Preferably the stream should be wrapped
in a buffer writer, such as BufWriter
.
Sourcepub fn take_stream(self) -> W
pub fn take_stream(self) -> W
Consumes the writer and returns inner stream.
Trait Implementations§
Source§impl<W: Write> RecordWriter for SamWriter<W>
impl<W: Write> RecordWriter for SamWriter<W>
Auto Trait Implementations§
impl<W> Freeze for SamWriter<W>where
W: Freeze,
impl<W> RefUnwindSafe for SamWriter<W>where
W: RefUnwindSafe,
impl<W> Send for SamWriter<W>where
W: Send,
impl<W> Sync for SamWriter<W>where
W: Sync,
impl<W> Unpin for SamWriter<W>where
W: Unpin,
impl<W> UnwindSafe for SamWriter<W>where
W: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more