pub struct ReferenceGenome { /* private fields */ }Expand description
Wrapper structure for a reference genome
Implementations§
Source§impl ReferenceGenome
impl ReferenceGenome
Sourcepub fn empty_reference() -> Self
pub fn empty_reference() -> Self
Creates an empty reference genome, which we can be populated through add_contig(...)
Sourcepub fn from_fasta(fasta_fn: &Path) -> Result<ReferenceGenome>
pub fn from_fasta(fasta_fn: &Path) -> Result<ReferenceGenome>
Sourcepub fn add_contig_string(
&mut self,
contig_key: String,
contig_sequence: String,
) -> Result<()>
pub fn add_contig_string( &mut self, contig_key: String, contig_sequence: String, ) -> Result<()>
Adds a new contig from a UTF-8 string by converting it to bytes and calling Self::add_contig.
§Arguments
contig_key- the name of the contigcontig_sequence- the sequence to add; all sequence is automatically upper-cased
§Errors
- if
contig_keyis already in the reference genome
Sourcepub fn contig_keys(&self) -> impl Iterator<Item = &String>
pub fn contig_keys(&self) -> impl Iterator<Item = &String>
Returns an iterator over the contig keys in the reference genome. The order of the contig keys is guaranteed to be the same as the order as they were added to the reference genome.
Sourcepub fn get_slice(
&self,
chromosome: &str,
start: usize,
end: usize,
) -> Result<&[u8]>
pub fn get_slice( &self, chromosome: &str, start: usize, end: usize, ) -> Result<&[u8]>
Retrieves a reference slice from a given 0-based coordinates.
If start or end goes past the full contig length, it will be truncated to the full contig length.
§Arguments
chromosome- the chromosome to slice fromstart- the 0-based start index (included)end- the 0-based end index (excluded)
§Errors
- if
chromosomewas not in the FASTA file - if
start>end
Auto Trait Implementations§
impl Freeze for ReferenceGenome
impl RefUnwindSafe for ReferenceGenome
impl Send for ReferenceGenome
impl Sync for ReferenceGenome
impl Unpin for ReferenceGenome
impl UnsafeUnpin for ReferenceGenome
impl UnwindSafe for ReferenceGenome
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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 moreimpl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.