Struct bam_builder::ReadPairSpecBuilder
source · 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?
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();
}
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?
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();
}
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?
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();
}
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?
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();
}
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?
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();
}
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?
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();
}
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?
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();
}
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?
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
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