Struct ReadPairSpecBuilder

Source
pub struct ReadPairSpecBuilder { /* private fields */ }
Expand description

Builder for ReadPairSpec.

Implementations§

Source§

impl ReadPairSpecBuilder

Source

pub fn name(&mut self, value: String) -> &mut Self

Name of the reads, will be filled in by BamBuilder::next_name by default.

Source

pub fn bases1(&mut self, value: String) -> &mut Self

Sequence bases, will be filled in by BamBuilder::random_bases by default.

Examples found in repository?
examples/ex1.rs (line 23)
3fn main() {
4    // Create a builder with all defaults except the read_len is 100
5    let mut builder = BamBuilder::new(
6        100,
7        30,
8        "Pair".to_owned(),
9        None,
10        BamSortOrder::Unsorted,
11        None,
12        None,
13    );
14
15    // Create a builder for read pair spec
16    let records = builder
17        .pair_builder()
18        .contig(0)
19        .start1(0)
20        .start2(200)
21        .unmapped1(false)
22        .unmapped2(false)
23        .bases1("A".repeat(100))
24        .bases2("C".repeat(100))
25        .build()
26        .unwrap();
27    println!("{:?}", records);
28
29    // Add the pair to bam builder
30    builder.add_pair(records);
31    println!("{:?}", builder);
32    // Write records to a file
33    builder
34        .to_path(std::path::Path::new(&String::from("./test.bam")))
35        .unwrap();
36}
Source

pub fn bases2(&mut self, value: String) -> &mut Self

Sequence bases, will be filled in by BamBuilder::random_bases by default.

Examples found in repository?
examples/ex1.rs (line 24)
3fn main() {
4    // Create a builder with all defaults except the read_len is 100
5    let mut builder = BamBuilder::new(
6        100,
7        30,
8        "Pair".to_owned(),
9        None,
10        BamSortOrder::Unsorted,
11        None,
12        None,
13    );
14
15    // Create a builder for read pair spec
16    let records = builder
17        .pair_builder()
18        .contig(0)
19        .start1(0)
20        .start2(200)
21        .unmapped1(false)
22        .unmapped2(false)
23        .bases1("A".repeat(100))
24        .bases2("C".repeat(100))
25        .build()
26        .unwrap();
27    println!("{:?}", records);
28
29    // Add the pair to bam builder
30    builder.add_pair(records);
31    println!("{:?}", builder);
32    // Write records to a file
33    builder
34        .to_path(std::path::Path::new(&String::from("./test.bam")))
35        .unwrap();
36}
Source

pub fn quals1(&mut self, value: String) -> &mut Self

Quality string, will be based on the BamBuilder::base_quality by default.

Source

pub fn quals2(&mut self, value: String) -> &mut Self

Quality string, will be based on the BamBuilder::base_quality by default.

Source

pub fn contig(&mut self, value: i32) -> &mut Self

Reference contig if mapped, defaults to unmapped.

Examples found in repository?
examples/ex1.rs (line 18)
3fn main() {
4    // Create a builder with all defaults except the read_len is 100
5    let mut builder = BamBuilder::new(
6        100,
7        30,
8        "Pair".to_owned(),
9        None,
10        BamSortOrder::Unsorted,
11        None,
12        None,
13    );
14
15    // Create a builder for read pair spec
16    let records = builder
17        .pair_builder()
18        .contig(0)
19        .start1(0)
20        .start2(200)
21        .unmapped1(false)
22        .unmapped2(false)
23        .bases1("A".repeat(100))
24        .bases2("C".repeat(100))
25        .build()
26        .unwrap();
27    println!("{:?}", records);
28
29    // Add the pair to bam builder
30    builder.add_pair(records);
31    println!("{:?}", builder);
32    // Write records to a file
33    builder
34        .to_path(std::path::Path::new(&String::from("./test.bam")))
35        .unwrap();
36}
Source

pub fn start1(&mut self, value: i64) -> &mut Self

0-based location on reference contig if mapped. defaults to unmapped.

Examples found in repository?
examples/ex1.rs (line 19)
3fn main() {
4    // Create a builder with all defaults except the read_len is 100
5    let mut builder = BamBuilder::new(
6        100,
7        30,
8        "Pair".to_owned(),
9        None,
10        BamSortOrder::Unsorted,
11        None,
12        None,
13    );
14
15    // Create a builder for read pair spec
16    let records = builder
17        .pair_builder()
18        .contig(0)
19        .start1(0)
20        .start2(200)
21        .unmapped1(false)
22        .unmapped2(false)
23        .bases1("A".repeat(100))
24        .bases2("C".repeat(100))
25        .build()
26        .unwrap();
27    println!("{:?}", records);
28
29    // Add the pair to bam builder
30    builder.add_pair(records);
31    println!("{:?}", builder);
32    // Write records to a file
33    builder
34        .to_path(std::path::Path::new(&String::from("./test.bam")))
35        .unwrap();
36}
Source

pub fn start2(&mut self, value: i64) -> &mut Self

0-based location on reference contig if mapped. defaults to unmapped.

Examples found in repository?
examples/ex1.rs (line 20)
3fn main() {
4    // Create a builder with all defaults except the read_len is 100
5    let mut builder = BamBuilder::new(
6        100,
7        30,
8        "Pair".to_owned(),
9        None,
10        BamSortOrder::Unsorted,
11        None,
12        None,
13    );
14
15    // Create a builder for read pair spec
16    let records = builder
17        .pair_builder()
18        .contig(0)
19        .start1(0)
20        .start2(200)
21        .unmapped1(false)
22        .unmapped2(false)
23        .bases1("A".repeat(100))
24        .bases2("C".repeat(100))
25        .build()
26        .unwrap();
27    println!("{:?}", records);
28
29    // Add the pair to bam builder
30    builder.add_pair(records);
31    println!("{:?}", builder);
32    // Write records to a file
33    builder
34        .to_path(std::path::Path::new(&String::from("./test.bam")))
35        .unwrap();
36}
Source

pub fn unmapped1(&mut self, value: bool) -> &mut Self

true if unmapped, defaults to true.

Examples found in repository?
examples/ex1.rs (line 21)
3fn main() {
4    // Create a builder with all defaults except the read_len is 100
5    let mut builder = BamBuilder::new(
6        100,
7        30,
8        "Pair".to_owned(),
9        None,
10        BamSortOrder::Unsorted,
11        None,
12        None,
13    );
14
15    // Create a builder for read pair spec
16    let records = builder
17        .pair_builder()
18        .contig(0)
19        .start1(0)
20        .start2(200)
21        .unmapped1(false)
22        .unmapped2(false)
23        .bases1("A".repeat(100))
24        .bases2("C".repeat(100))
25        .build()
26        .unwrap();
27    println!("{:?}", records);
28
29    // Add the pair to bam builder
30    builder.add_pair(records);
31    println!("{:?}", builder);
32    // Write records to a file
33    builder
34        .to_path(std::path::Path::new(&String::from("./test.bam")))
35        .unwrap();
36}
Source

pub fn unmapped2(&mut self, value: bool) -> &mut Self

true if unmapped, defaults to true.

Examples found in repository?
examples/ex1.rs (line 22)
3fn main() {
4    // Create a builder with all defaults except the read_len is 100
5    let mut builder = BamBuilder::new(
6        100,
7        30,
8        "Pair".to_owned(),
9        None,
10        BamSortOrder::Unsorted,
11        None,
12        None,
13    );
14
15    // Create a builder for read pair spec
16    let records = builder
17        .pair_builder()
18        .contig(0)
19        .start1(0)
20        .start2(200)
21        .unmapped1(false)
22        .unmapped2(false)
23        .bases1("A".repeat(100))
24        .bases2("C".repeat(100))
25        .build()
26        .unwrap();
27    println!("{:?}", records);
28
29    // Add the pair to bam builder
30    builder.add_pair(records);
31    println!("{:?}", builder);
32    // Write records to a file
33    builder
34        .to_path(std::path::Path::new(&String::from("./test.bam")))
35        .unwrap();
36}
Source

pub fn cigar1(&mut self, value: String) -> &mut Self

Alignment, defaults to all M if mapped or * if unmapped.

Source

pub fn cigar2(&mut self, value: String) -> &mut Self

Alignment, defaults to all M if mapped or * if unmapped.

Source

pub fn mapq1(&mut self, value: u8) -> &mut Self

map quality of the read, defaults to 60 if mapped, * if unmapped.

Source

pub fn mapq2(&mut self, value: u8) -> &mut Self

map quality of the read, defaults to 60 if mapped, * if unmapped.

Source

pub fn strand1(&mut self, value: Strand) -> &mut Self

Strand the read maps to, defaults to wrappers::Strand::Plus.

Source

pub fn strand2(&mut self, value: Strand) -> &mut Self

Strand the read maps to, defaults to wrappers::Strand::Minus.

Source

pub fn attrs(&mut self, value: HashMap<String, AuxType>) -> &mut Self

Tags for the reads, mate tags will be filled in by default.

Source

pub fn build(&self) -> Result<ReadPairSpec, ReadPairSpecBuilderError>

Builds a new ReadPairSpec.

§Errors

If a required field has not been initialized.

Examples found in repository?
examples/ex1.rs (line 25)
3fn main() {
4    // Create a builder with all defaults except the read_len is 100
5    let mut builder = BamBuilder::new(
6        100,
7        30,
8        "Pair".to_owned(),
9        None,
10        BamSortOrder::Unsorted,
11        None,
12        None,
13    );
14
15    // Create a builder for read pair spec
16    let records = builder
17        .pair_builder()
18        .contig(0)
19        .start1(0)
20        .start2(200)
21        .unmapped1(false)
22        .unmapped2(false)
23        .bases1("A".repeat(100))
24        .bases2("C".repeat(100))
25        .build()
26        .unwrap();
27    println!("{:?}", records);
28
29    // Add the pair to bam builder
30    builder.add_pair(records);
31    println!("{:?}", builder);
32    // Write records to a file
33    builder
34        .to_path(std::path::Path::new(&String::from("./test.bam")))
35        .unwrap();
36}

Trait Implementations§

Source§

impl Clone for ReadPairSpecBuilder

Source§

fn clone(&self) -> ReadPairSpecBuilder

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for ReadPairSpecBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> ErasedDestructor for T
where T: 'static,