#[non_exhaustive]pub struct FastqChunkStats {
pub first_record_index: u64,
pub records: u64,
pub bases: u64,
}Expand description
Summary for one chunk emitted by FastqReader::next_chunk_with_sink.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.first_record_index: u64Zero-based index of the first record in this chunk.
records: u64Number of records emitted into the sink.
bases: u64Number of sequence bases emitted into the sink.
Implementations§
Source§impl FastqChunkStats
impl FastqChunkStats
Sourcepub fn first_record_index(self) -> u64
pub fn first_record_index(self) -> u64
Zero-based index of the first record in this chunk.
Examples found in repository?
examples/fastq_chunk_sink.rs (line 60)
45fn main() -> Result<()> {
46 let stdin = io::stdin();
47 let mut reader = FastqReader::new(stdin.lock());
48 let config = FastqChunkConfig::new(10_000_000).min_records(40_000);
49 let mut sink = ReadBuffer::default();
50
51 sink.reserve_records(config.estimated_records(150));
52 while let Some(stats) = reader.next_chunk_with_sink(config, &mut sink)? {
53 let checksum: usize = sink
54 .reads
55 .iter()
56 .map(|read| read.name.len() ^ read.seq.len() ^ read.qual.len())
57 .sum();
58 eprintln!(
59 "chunk first_record={} records={} bases={} checksum={}",
60 stats.first_record_index(),
61 stats.records(),
62 stats.bases(),
63 checksum
64 );
65
66 // Downstream tools typically hand `sink.reads` to alignment or another
67 // processing stage here, then reuse the allocation for the next chunk.
68 sink.clear();
69 sink.reserve_records(config.estimated_records(150));
70 }
71
72 Ok(())
73}Sourcepub fn records(self) -> u64
pub fn records(self) -> u64
Number of records emitted into the sink.
Examples found in repository?
examples/fastq_chunk_sink.rs (line 61)
45fn main() -> Result<()> {
46 let stdin = io::stdin();
47 let mut reader = FastqReader::new(stdin.lock());
48 let config = FastqChunkConfig::new(10_000_000).min_records(40_000);
49 let mut sink = ReadBuffer::default();
50
51 sink.reserve_records(config.estimated_records(150));
52 while let Some(stats) = reader.next_chunk_with_sink(config, &mut sink)? {
53 let checksum: usize = sink
54 .reads
55 .iter()
56 .map(|read| read.name.len() ^ read.seq.len() ^ read.qual.len())
57 .sum();
58 eprintln!(
59 "chunk first_record={} records={} bases={} checksum={}",
60 stats.first_record_index(),
61 stats.records(),
62 stats.bases(),
63 checksum
64 );
65
66 // Downstream tools typically hand `sink.reads` to alignment or another
67 // processing stage here, then reuse the allocation for the next chunk.
68 sink.clear();
69 sink.reserve_records(config.estimated_records(150));
70 }
71
72 Ok(())
73}Sourcepub fn bases(self) -> u64
pub fn bases(self) -> u64
Number of sequence bases emitted into the sink.
Examples found in repository?
examples/fastq_chunk_sink.rs (line 62)
45fn main() -> Result<()> {
46 let stdin = io::stdin();
47 let mut reader = FastqReader::new(stdin.lock());
48 let config = FastqChunkConfig::new(10_000_000).min_records(40_000);
49 let mut sink = ReadBuffer::default();
50
51 sink.reserve_records(config.estimated_records(150));
52 while let Some(stats) = reader.next_chunk_with_sink(config, &mut sink)? {
53 let checksum: usize = sink
54 .reads
55 .iter()
56 .map(|read| read.name.len() ^ read.seq.len() ^ read.qual.len())
57 .sum();
58 eprintln!(
59 "chunk first_record={} records={} bases={} checksum={}",
60 stats.first_record_index(),
61 stats.records(),
62 stats.bases(),
63 checksum
64 );
65
66 // Downstream tools typically hand `sink.reads` to alignment or another
67 // processing stage here, then reuse the allocation for the next chunk.
68 sink.clear();
69 sink.reserve_records(config.estimated_records(150));
70 }
71
72 Ok(())
73}Trait Implementations§
Source§impl Clone for FastqChunkStats
impl Clone for FastqChunkStats
Source§fn clone(&self) -> FastqChunkStats
fn clone(&self) -> FastqChunkStats
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for FastqChunkStats
Source§impl Debug for FastqChunkStats
impl Debug for FastqChunkStats
impl Eq for FastqChunkStats
Source§impl PartialEq for FastqChunkStats
impl PartialEq for FastqChunkStats
Source§fn eq(&self, other: &FastqChunkStats) -> bool
fn eq(&self, other: &FastqChunkStats) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for FastqChunkStats
Auto Trait Implementations§
impl Freeze for FastqChunkStats
impl RefUnwindSafe for FastqChunkStats
impl Send for FastqChunkStats
impl Sync for FastqChunkStats
impl Unpin for FastqChunkStats
impl UnsafeUnpin for FastqChunkStats
impl UnwindSafe for FastqChunkStats
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more