[−][src]Struct bam_builder::BamBuilder
Builder for BAM records.
Sets up defaults for reads that are added as well as the BAM header information. Use BamBuilder::new to generate
a BamBuilder with appropriately populated fields.
The pattern of interaction with BamBuilder is to use the BamBuilder::frag_builder and BamBuilder::pair_builder
methods to create a respective ReadFragSpecBuilder and ReadPairSpecBuilder. The *SpecBuilder
is creates a record with its .build() method, and the result can be added to the builder with BamBuilder::add_pair
or BamBuilder::add_frag.
Fields
read_length: usizeLength of reads to generate
base_quality: u8Default base quality to use across all qualities
sample_name: SampleNameName of the sample
read_group_id: ReadGroupIdThe read group to include in tags
sort_order: BamSortOrderThe sort order of the generated reads
header: HeaderThe BAM header
rng: StdRngRandom number generator
records: Vec<Record>The collection of records being accumulated
default_quals: StringThe default string o qualities to use
counter: usizeCounter for helping to increment the name
Implementations
impl BamBuilder[src]
pub fn new(
read_length: usize,
base_quality: u8,
sample_name: String,
read_group_id: Option<String>,
sort: BamSortOrder,
pseudo_sd: Option<SequenceDict>,
seed: Option<usize>
) -> BamBuilder[src]
read_length: usize,
base_quality: u8,
sample_name: String,
read_group_id: Option<String>,
sort: BamSortOrder,
pseudo_sd: Option<SequenceDict>,
seed: Option<usize>
) -> BamBuilder
Create a BamBuilder that fills in defaults based on the passed in options.
Example
use bam_builder::{bam_order::BamSortOrder, BamBuilder}; let mut builder = BamBuilder::new( 100, // default read_length 30, // default base_quality "Pair".to_owned(), // name of samples None, // optional read group id BamSortOrder::Unsorted, // how to sort reads when `.sort` is called None, // optional sequence_dict None, // seed used for generating random bases ); assert_eq!(builder.read_group_id.0, String::from("A")); assert_eq!(builder.sample_name.0, String::from("Pair")); assert_eq!(builder.records.len(), 0);
pub fn frag_builder(&mut self) -> ReadFragSpecBuilder[src]
Create a ReadFragSpecBuilder with defaults filled in based on BamBuilder.
pub fn add_frag(&mut self, frag_spec: ReadFragSpec)[src]
Add a single fragment to the builder.
pub fn pair_builder(&mut self) -> ReadPairSpecBuilder[src]
Create a ReadPairSpecBuilder with defaults filled in based on the BamBuilder.
pub fn add_pair(&mut self, pair_spec: ReadPairSpec)[src]
Add a read pair to the builder.
pub fn to_path(&self, path: &Path) -> Result<(), Error>[src]
Writes BAM records to specified path.
Note that BamBuilder::sort should be called ahead of writing to ensure records
are sorted.
pub fn to_tmp(&self) -> Result<NamedTempFile, Error>[src]
Write records to a tempfile. Tempfile will be deleted when NamedTempFile goes out of scope.
Note that BamBuilder::sort should be called ahead of writing to ensure records
are sorted.
pub fn sort(&mut self)[src]
Sort the records added thus far by whichever BamSortOrder was specified.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for BamBuilder[src]
impl Send for BamBuilder[src]
impl Sync for BamBuilder[src]
impl Unpin for BamBuilder[src]
impl UnwindSafe for BamBuilder[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,