pub struct FastaIndex { /* private fields */ }Expand description
A parsed or freshly built FASTA index.
Implementations§
Source§impl FastaIndex
impl FastaIndex
Sourcepub fn build<R: Read>(reader: R) -> Result<FastaIndex>
pub fn build<R: Read>(reader: R) -> Result<FastaIndex>
Build an index by scanning an uncompressed FASTA stream.
Fails with Error::Index when a record has ragged line lengths, since
such a file cannot be indexed by arithmetic — exactly as samtools faidx
reports it.
Sourcepub fn build_from_path<P: AsRef<Path>>(path: P) -> Result<FastaIndex>
pub fn build_from_path<P: AsRef<Path>>(path: P) -> Result<FastaIndex>
Build an index for a FASTA file on disk.
The offsets are always positions in the uncompressed data, so the same
.fai describes a file whether or not it is BGZF-compressed — which is
exactly how samtools faidx behaves. A BGZF file additionally needs a
.gzi to be seekable; IndexedFasta::open takes care of that.
Plain gzip (a single deflate stream, as gzip produces) cannot be
randomly accessed at all, and is rejected.
Sourcepub fn parse<R: Read>(reader: R) -> Result<FastaIndex>
pub fn parse<R: Read>(reader: R) -> Result<FastaIndex>
Parse an existing .fai file.
Sourcepub fn write_to_path<P: AsRef<Path>>(&self, fasta_path: P) -> Result<PathBuf>
pub fn write_to_path<P: AsRef<Path>>(&self, fasta_path: P) -> Result<PathBuf>
Write the index next to the FASTA file as <path>.fai.
Sourcepub fn total_length(&self) -> u64
pub fn total_length(&self) -> u64
Sum of all sequence lengths.
Trait Implementations§
Source§impl Clone for FastaIndex
impl Clone for FastaIndex
Source§fn clone(&self) -> FastaIndex
fn clone(&self) -> FastaIndex
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 FastaIndex
impl Debug for FastaIndex
Source§impl Default for FastaIndex
impl Default for FastaIndex
Source§fn default() -> FastaIndex
fn default() -> FastaIndex
Auto Trait Implementations§
impl Freeze for FastaIndex
impl RefUnwindSafe for FastaIndex
impl Send for FastaIndex
impl Sync for FastaIndex
impl Unpin for FastaIndex
impl UnsafeUnpin for FastaIndex
impl UnwindSafe for FastaIndex
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