pub enum Format {
Fasta,
Fastq,
}Expand description
A sequence file format.
Deliberately not #[non_exhaustive]: FASTA and FASTQ are the whole domain
of this crate, so matching on both arms exhaustively is meant to be pleasant
and is a promise we intend to keep.
Variants§
Fasta
FASTA: >id description followed by one or more sequence lines.
Fastq
FASTQ: @id description, sequence, +, quality.
Implementations§
Source§impl Format
impl Format
Sourcepub const FASTA_EXTENSIONS: &'static [&'static str]
pub const FASTA_EXTENSIONS: &'static [&'static str]
Recognised FASTA extensions (without the leading dot).
Sourcepub const FASTQ_EXTENSIONS: &'static [&'static str]
pub const FASTQ_EXTENSIONS: &'static [&'static str]
Recognised FASTQ extensions (without the leading dot).
Sourcepub fn from_path<P: AsRef<Path>>(path: P) -> Option<Format>
pub fn from_path<P: AsRef<Path>>(path: P) -> Option<Format>
Infer the format from a file extension, ignoring a trailing .gz/.bgz/.z.
use fastx::Format;
assert_eq!(Format::from_path("reads.fq.gz"), Some(Format::Fastq));
assert_eq!(Format::from_path("genome.fna"), Some(Format::Fasta));
assert_eq!(Format::from_path("notes.txt"), None);Sourcepub fn from_extension(ext: &str) -> Option<Format>
pub fn from_extension(ext: &str) -> Option<Format>
Infer the format from a bare extension such as "fasta".
Sourcepub fn from_first_byte(byte: u8) -> Option<Format>
pub fn from_first_byte(byte: u8) -> Option<Format>
Infer the format from the first meaningful byte of a stream.
use fastx::Format;
assert_eq!(Format::from_first_byte(b'>'), Some(Format::Fasta));
assert_eq!(Format::from_first_byte(b'@'), Some(Format::Fastq));Sourcepub const fn header_byte(self) -> u8
pub const fn header_byte(self) -> u8
The byte that starts a record header in this format.
Sourcepub const fn has_quality(self) -> bool
pub const fn has_quality(self) -> bool
Whether records in this format carry per-base quality scores.
Trait Implementations§
impl Copy for Format
impl Eq for Format
impl StructuralPartialEq for Format
Auto Trait Implementations§
impl Freeze for Format
impl RefUnwindSafe for Format
impl Send for Format
impl Sync for Format
impl Unpin for Format
impl UnsafeUnpin for Format
impl UnwindSafe for Format
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
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> ⓘ
Converts
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> ⓘ
Converts
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