pub struct ReaderBuilder { /* private fields */ }Expand description
Configuration for a FastxReader.
use fastx::{Format, ReaderBuilder};
let data = b">a\nACGT\n";
let mut reader = ReaderBuilder::new()
.format(Format::Fasta)
.buffer_size(64 * 1024)
.build(&data[..]);
assert_eq!(reader.next().unwrap()?.id, "a");Implementations§
Source§impl ReaderBuilder
impl ReaderBuilder
Sourcepub fn new() -> ReaderBuilder
pub fn new() -> ReaderBuilder
A builder with default settings.
Sourcepub fn buffer_size(self, bytes: usize) -> Self
pub fn buffer_size(self, bytes: usize) -> Self
Size of the internal read buffer, in bytes.
Sourcepub fn quality_encoding(self, encoding: QualityEncoding) -> Self
pub fn quality_encoding(self, encoding: QualityEncoding) -> Self
The quality encoding of the input.
Old Illumina 1.3–1.7 files are Phred+64. Set this and the reader will
convert quality strings to Phred+33 as it parses, so every Sequence
this crate produces uses one encoding.
use fastx::{qual::QualityEncoding, ReaderBuilder};
// 'h' is Q40 in Phred+64.
let data = b"@old\nACGT\n+\nhhhh\n";
let record = ReaderBuilder::new()
.quality_encoding(QualityEncoding::Phred64)
.build(&data[..])
.read_record()?
.unwrap();
assert_eq!(record.quality.as_deref(), Some(&b"IIII"[..])); // now Phred+33
assert_eq!(record.mean_quality(), Some(40.0));Sourcepub fn max_line_length(self, bytes: usize) -> Self
pub fn max_line_length(self, bytes: usize) -> Self
Refuse lines longer than bytes instead of growing the buffer.
Unlimited by default, because a chromosome legitimately arrives on a single line. Set it when reading files you do not control: without a limit, one unterminated line can grow the buffer until the process is killed.
Sourcepub fn max_record_length(self, bytes: usize) -> Self
pub fn max_record_length(self, bytes: usize) -> Self
Refuse records whose sequence exceeds bytes.
Unlimited by default. This bounds a record assembled from many short
lines, which max_line_length alone does not catch.
Trait Implementations§
Source§impl Clone for ReaderBuilder
impl Clone for ReaderBuilder
Source§fn clone(&self) -> ReaderBuilder
fn clone(&self) -> ReaderBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ReaderBuilder
impl Debug for ReaderBuilder
Auto Trait Implementations§
impl Freeze for ReaderBuilder
impl RefUnwindSafe for ReaderBuilder
impl Send for ReaderBuilder
impl Sync for ReaderBuilder
impl Unpin for ReaderBuilder
impl UnsafeUnpin for ReaderBuilder
impl UnwindSafe for ReaderBuilder
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more