pub struct ReadPairSpecBuilder { /* private fields */ }
Expand description
Builder for ReadPairSpec
.
Implementations§
Source§impl ReadPairSpecBuilder
impl ReadPairSpecBuilder
Sourcepub fn name(&mut self, value: String) -> &mut Self
pub fn name(&mut self, value: String) -> &mut Self
Name of the reads, will be filled in by BamBuilder::next_name
by default.
Sourcepub fn bases1(&mut self, value: String) -> &mut Self
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?
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}
Sourcepub fn bases2(&mut self, value: String) -> &mut Self
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?
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}
Sourcepub fn quals1(&mut self, value: String) -> &mut Self
pub fn quals1(&mut self, value: String) -> &mut Self
Quality string, will be based on the BamBuilder::base_quality
by default.
Sourcepub fn quals2(&mut self, value: String) -> &mut Self
pub fn quals2(&mut self, value: String) -> &mut Self
Quality string, will be based on the BamBuilder::base_quality
by default.
Sourcepub fn contig(&mut self, value: i32) -> &mut Self
pub fn contig(&mut self, value: i32) -> &mut Self
Reference contig if mapped, defaults to unmapped.
Examples found in repository?
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}
Sourcepub fn start1(&mut self, value: i64) -> &mut Self
pub fn start1(&mut self, value: i64) -> &mut Self
0-based location on reference contig if mapped. defaults to unmapped.
Examples found in repository?
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}
Sourcepub fn start2(&mut self, value: i64) -> &mut Self
pub fn start2(&mut self, value: i64) -> &mut Self
0-based location on reference contig if mapped. defaults to unmapped.
Examples found in repository?
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}
Sourcepub fn unmapped1(&mut self, value: bool) -> &mut Self
pub fn unmapped1(&mut self, value: bool) -> &mut Self
true
if unmapped, defaults to true
.
Examples found in repository?
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}
Sourcepub fn unmapped2(&mut self, value: bool) -> &mut Self
pub fn unmapped2(&mut self, value: bool) -> &mut Self
true
if unmapped, defaults to true
.
Examples found in repository?
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}
Sourcepub fn cigar1(&mut self, value: String) -> &mut Self
pub fn cigar1(&mut self, value: String) -> &mut Self
Alignment, defaults to all M
if mapped or *
if unmapped.
Sourcepub fn cigar2(&mut self, value: String) -> &mut Self
pub fn cigar2(&mut self, value: String) -> &mut Self
Alignment, defaults to all M
if mapped or *
if unmapped.
Sourcepub fn mapq1(&mut self, value: u8) -> &mut Self
pub fn mapq1(&mut self, value: u8) -> &mut Self
map quality of the read, defaults to 60 if mapped, *
if unmapped.
Sourcepub fn mapq2(&mut self, value: u8) -> &mut Self
pub fn mapq2(&mut self, value: u8) -> &mut Self
map quality of the read, defaults to 60 if mapped, *
if unmapped.
Sourcepub fn strand1(&mut self, value: Strand) -> &mut Self
pub fn strand1(&mut self, value: Strand) -> &mut Self
Strand the read maps to, defaults to wrappers::Strand::Plus
.
Sourcepub fn strand2(&mut self, value: Strand) -> &mut Self
pub fn strand2(&mut self, value: Strand) -> &mut Self
Strand the read maps to, defaults to wrappers::Strand::Minus
.
Sourcepub fn attrs(&mut self, value: HashMap<String, AuxType>) -> &mut Self
pub fn attrs(&mut self, value: HashMap<String, AuxType>) -> &mut Self
Tags for the reads, mate tags will be filled in by default.
Sourcepub fn build(&self) -> Result<ReadPairSpec, ReadPairSpecBuilderError>
pub fn build(&self) -> Result<ReadPairSpec, ReadPairSpecBuilderError>
Examples found in repository?
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
impl Clone for ReadPairSpecBuilder
Source§fn clone(&self) -> ReadPairSpecBuilder
fn clone(&self) -> ReadPairSpecBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more