pub struct SparseDistanceMatrix<'a> {
pub n_distances: usize,
pub knn: usize,
/* private fields */
}Expand description
A sparse distance matrix with a maximum of knn distances for each sample.
In self-query mode (one database), query_names is None and ref_names is
used for both row iteration and column index lookup.
In cross-query mode (two databases), query_names holds the query genome names
(one per row) and ref_names holds the reference genome names (indexed by
the stored neighbour index inside each distance item).
Fields§
§n_distances: usizeTotal number of distances
knn: usizeMaximum number of distances kept per sample: k smallest distances
Implementations§
Source§impl<'a> SparseDistanceMatrix<'a>
impl<'a> SparseDistanceMatrix<'a>
Sourcepub fn new(ref_sketches: &'a MultiSketch, knn: usize, jaccard: DistType) -> Self
pub fn new(ref_sketches: &'a MultiSketch, knn: usize, jaccard: DistType) -> Self
Self-query constructor: one database, rows and columns are the same set.
Sourcepub fn new_cross_query(
ref_sketches: &'a MultiSketch,
query_sketches: &'a MultiSketch,
knn: usize,
jaccard: DistType,
) -> Self
pub fn new_cross_query( ref_sketches: &'a MultiSketch, query_sketches: &'a MultiSketch, knn: usize, jaccard: DistType, ) -> Self
Cross-query constructor: two databases. Rows are query genomes; column indices index into the reference genome list.
Sourcepub fn dists_as_ref(&self) -> &DistVec
pub fn dists_as_ref(&self) -> &DistVec
Reference/borrow of underlying distance storage
Trait Implementations§
Source§impl Display for SparseDistanceMatrix<'_>
impl Display for SparseDistanceMatrix<'_>
Source§impl<'a> Distances<'a> for SparseDistanceMatrix<'a>
impl<'a> Distances<'a> for SparseDistanceMatrix<'a>
Source§fn n_samples(&self) -> (usize, Option<usize>)
fn n_samples(&self) -> (usize, Option<usize>)
The number of reference and query (if set) samples
Source§fn shape(&self) -> (usize, usize)
fn shape(&self) -> (usize, usize)
The (rows, columns) of the underlying data (C-order/row-major)
Source§fn k_vals(&self) -> Option<(usize, f64)>
fn k_vals(&self) -> Option<(usize, f64)>
If calcualting Jaccard distances, the index of the k-mer, and the k-mer as a float
Source§fn n_dist_cols(&self) -> usize
fn n_dist_cols(&self) -> usize
Number of distance columns in the output
Source§fn sketch_names(sketches: &'a MultiSketch) -> Vec<&'a str>
fn sketch_names(sketches: &'a MultiSketch) -> Vec<&'a str>
Names of the sketch files in the distance matrix
Auto Trait Implementations§
impl<'a> Freeze for SparseDistanceMatrix<'a>
impl<'a> RefUnwindSafe for SparseDistanceMatrix<'a>
impl<'a> Send for SparseDistanceMatrix<'a>
impl<'a> Sync for SparseDistanceMatrix<'a>
impl<'a> Unpin for SparseDistanceMatrix<'a>
impl<'a> UnsafeUnpin for SparseDistanceMatrix<'a>
impl<'a> UnwindSafe for SparseDistanceMatrix<'a>
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 more