pub struct Writer { /* private fields */ }
Expand description
A BAM writer.
Implementations§
Source§impl Writer
impl Writer
Sourcepub fn from_path<P: AsRef<Path>>(
path: P,
header: &Header,
format: Format,
) -> Result<Self>
pub fn from_path<P: AsRef<Path>>( path: P, header: &Header, format: Format, ) -> Result<Self>
Create a new SAM/BAM/CRAM file.
§Arguments
path
- the path.header
- header definition to useformat
- the format to use (SAM/BAM/CRAM)
Sourcepub fn from_stdout(header: &Header, format: Format) -> Result<Self>
pub fn from_stdout(header: &Header, format: Format) -> Result<Self>
Create a new SAM/BAM/CRAM file at STDOUT.
§Arguments
header
- header definition to useformat
- the format to use (SAM/BAM/CRAM)
Sourcepub fn set_threads(&mut self, n_threads: usize) -> Result<()>
pub fn set_threads(&mut self, n_threads: usize) -> Result<()>
Activate multi-threaded BAM write support in htslib. This should permit faster writing of large BAM files.
§Arguments
n_threads
- number of extra background writer threads to use, must be> 0
.
Sourcepub fn set_thread_pool(&mut self, tpool: &ThreadPool) -> Result<()>
pub fn set_thread_pool(&mut self, tpool: &ThreadPool) -> Result<()>
Use a shared thread-pool for writing. This permits controlling the total
thread count when multiple readers and writers are working simultaneously.
A thread pool can be created with crate::tpool::ThreadPool::new(n_threads)
§Arguments
tpool
- thread pool to use for compression work.
Sourcepub fn header(&self) -> &HeaderView
pub fn header(&self) -> &HeaderView
Return the header.
Sourcepub fn set_compression_level(
&mut self,
compression_level: CompressionLevel,
) -> Result<()>
pub fn set_compression_level( &mut self, compression_level: CompressionLevel, ) -> Result<()>
Set the compression level for writing BAM/CRAM files.
§Arguments
compression_level
-CompressionLevel
enum variant
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Writer
impl !RefUnwindSafe for Writer
impl !Sync for Writer
impl Unpin for Writer
impl !UnwindSafe for Writer
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