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)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
fn main() {
    // Create a builder with all defaults except the read_len is 100
    let mut builder = BamBuilder::new(
        100,
        30,
        "Pair".to_owned(),
        None,
        BamSortOrder::Unsorted,
        None,
        None,
    );

    // Create a builder for read pair spec
    let records = builder
        .pair_builder()
        .contig(0)
        .start1(0)
        .start2(200)
        .unmapped1(false)
        .unmapped2(false)
        .bases1("A".repeat(100))
        .bases2("C".repeat(100))
        .build()
        .unwrap();
    println!("{:?}", records);

    // Add the pair to bam builder
    builder.add_pair(records);
    println!("{:?}", builder);
    // Write records to a file
    builder
        .to_path(std::path::Path::new(&String::from("./test.bam")))
        .unwrap();
}
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)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
fn main() {
    // Create a builder with all defaults except the read_len is 100
    let mut builder = BamBuilder::new(
        100,
        30,
        "Pair".to_owned(),
        None,
        BamSortOrder::Unsorted,
        None,
        None,
    );

    // Create a builder for read pair spec
    let records = builder
        .pair_builder()
        .contig(0)
        .start1(0)
        .start2(200)
        .unmapped1(false)
        .unmapped2(false)
        .bases1("A".repeat(100))
        .bases2("C".repeat(100))
        .build()
        .unwrap();
    println!("{:?}", records);

    // Add the pair to bam builder
    builder.add_pair(records);
    println!("{:?}", builder);
    // Write records to a file
    builder
        .to_path(std::path::Path::new(&String::from("./test.bam")))
        .unwrap();
}
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)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
fn main() {
    // Create a builder with all defaults except the read_len is 100
    let mut builder = BamBuilder::new(
        100,
        30,
        "Pair".to_owned(),
        None,
        BamSortOrder::Unsorted,
        None,
        None,
    );

    // Create a builder for read pair spec
    let records = builder
        .pair_builder()
        .contig(0)
        .start1(0)
        .start2(200)
        .unmapped1(false)
        .unmapped2(false)
        .bases1("A".repeat(100))
        .bases2("C".repeat(100))
        .build()
        .unwrap();
    println!("{:?}", records);

    // Add the pair to bam builder
    builder.add_pair(records);
    println!("{:?}", builder);
    // Write records to a file
    builder
        .to_path(std::path::Path::new(&String::from("./test.bam")))
        .unwrap();
}
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)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
fn main() {
    // Create a builder with all defaults except the read_len is 100
    let mut builder = BamBuilder::new(
        100,
        30,
        "Pair".to_owned(),
        None,
        BamSortOrder::Unsorted,
        None,
        None,
    );

    // Create a builder for read pair spec
    let records = builder
        .pair_builder()
        .contig(0)
        .start1(0)
        .start2(200)
        .unmapped1(false)
        .unmapped2(false)
        .bases1("A".repeat(100))
        .bases2("C".repeat(100))
        .build()
        .unwrap();
    println!("{:?}", records);

    // Add the pair to bam builder
    builder.add_pair(records);
    println!("{:?}", builder);
    // Write records to a file
    builder
        .to_path(std::path::Path::new(&String::from("./test.bam")))
        .unwrap();
}
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)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
fn main() {
    // Create a builder with all defaults except the read_len is 100
    let mut builder = BamBuilder::new(
        100,
        30,
        "Pair".to_owned(),
        None,
        BamSortOrder::Unsorted,
        None,
        None,
    );

    // Create a builder for read pair spec
    let records = builder
        .pair_builder()
        .contig(0)
        .start1(0)
        .start2(200)
        .unmapped1(false)
        .unmapped2(false)
        .bases1("A".repeat(100))
        .bases2("C".repeat(100))
        .build()
        .unwrap();
    println!("{:?}", records);

    // Add the pair to bam builder
    builder.add_pair(records);
    println!("{:?}", builder);
    // Write records to a file
    builder
        .to_path(std::path::Path::new(&String::from("./test.bam")))
        .unwrap();
}
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)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
fn main() {
    // Create a builder with all defaults except the read_len is 100
    let mut builder = BamBuilder::new(
        100,
        30,
        "Pair".to_owned(),
        None,
        BamSortOrder::Unsorted,
        None,
        None,
    );

    // Create a builder for read pair spec
    let records = builder
        .pair_builder()
        .contig(0)
        .start1(0)
        .start2(200)
        .unmapped1(false)
        .unmapped2(false)
        .bases1("A".repeat(100))
        .bases2("C".repeat(100))
        .build()
        .unwrap();
    println!("{:?}", records);

    // Add the pair to bam builder
    builder.add_pair(records);
    println!("{:?}", builder);
    // Write records to a file
    builder
        .to_path(std::path::Path::new(&String::from("./test.bam")))
        .unwrap();
}
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)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
fn main() {
    // Create a builder with all defaults except the read_len is 100
    let mut builder = BamBuilder::new(
        100,
        30,
        "Pair".to_owned(),
        None,
        BamSortOrder::Unsorted,
        None,
        None,
    );

    // Create a builder for read pair spec
    let records = builder
        .pair_builder()
        .contig(0)
        .start1(0)
        .start2(200)
        .unmapped1(false)
        .unmapped2(false)
        .bases1("A".repeat(100))
        .bases2("C".repeat(100))
        .build()
        .unwrap();
    println!("{:?}", records);

    // Add the pair to bam builder
    builder.add_pair(records);
    println!("{:?}", builder);
    // Write records to a file
    builder
        .to_path(std::path::Path::new(&String::from("./test.bam")))
        .unwrap();
}
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)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
fn main() {
    // Create a builder with all defaults except the read_len is 100
    let mut builder = BamBuilder::new(
        100,
        30,
        "Pair".to_owned(),
        None,
        BamSortOrder::Unsorted,
        None,
        None,
    );

    // Create a builder for read pair spec
    let records = builder
        .pair_builder()
        .contig(0)
        .start1(0)
        .start2(200)
        .unmapped1(false)
        .unmapped2(false)
        .bases1("A".repeat(100))
        .bases2("C".repeat(100))
        .build()
        .unwrap();
    println!("{:?}", records);

    // Add the pair to bam builder
    builder.add_pair(records);
    println!("{:?}", builder);
    // Write records to a file
    builder
        .to_path(std::path::Path::new(&String::from("./test.bam")))
        .unwrap();
}

Trait Implementations§

source§

impl Clone for ReadPairSpecBuilder

source§

fn clone(&self) -> ReadPairSpecBuilder

Returns a copy 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> 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,

§

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>,

§

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>,

§

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.
§

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

§

fn vzip(self) -> V