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, Box<dyn Error>>
pub fn from_fasta(fasta_fn: &Path) -> Result<ReferenceGenome, Box<dyn Error>>
Sourcepub fn add_contig(
&mut self,
contig_key: String,
contig_sequence: &str,
) -> Result<(), SimpleError>
pub fn add_contig( &mut self, contig_key: String, contig_sequence: &str, ) -> Result<(), SimpleError>
Adds a new contig to the reference genome
§Arguments
contig_key- the name of the contigcontig_sequence- the sequence to add; all sequence is automatically upper-cased
pub fn filename(&self) -> &Path
pub fn contig_keys(&self) -> &[String]
Sourcepub fn get_slice(&self, chromosome: &str, start: usize, end: usize) -> &[u8] ⓘ
pub fn get_slice(&self, chromosome: &str, start: usize, end: usize) -> &[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)
§Panics
- 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
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 moreSource§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.