Struct rust_htslib::bam::Writer
source · 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 !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