pub fn dist(temp: &Read, other: &Read, params: &Params) -> f64 {
    let s1_set: HashSet<_> = HashSet::from_iter(temp.transformed.iter());
    let s2_set: HashSet<_> = HashSet::from_iter(other.transformed.iter());
    let inter: HashSet<_> = s1_set.intersection(&s2_set).collect();
    let union: HashSet<_> = s1_set.union(&s2_set).collect();
    let distance = params.distance;
    match distance {
        0 => {1.0 - ((inter.len() as f64) / (union.len() as f64))}
        1 => {1.0 - ((inter.len() as f64) / (s1_set.len() as f64))}
        2 => {
            let jaccard = (inter.len() as f64) / (union.len() as f64);
            let mash : f64 = -1.0 * ((2.0 * jaccard) / (1.0 + jaccard)).ln() / params.l as f64;
            mash
        }
        _ => {
            let jaccard = (inter.len() as f64) / (union.len() as f64);
            let mash : f64 = (-1.0 / params.k as f64) * ((2.0 * jaccard) / (1.0 + jaccard)).ln();
            mash
        }
    }
}
// Computes the distance between two reads which are already in minimizer-space.
Computes the distance between two reads which are already in minimizer-space.
Computes the distance between two reads which are already in minimizer - space .
pub fn dist(temp: &Read, other: &Read, params: &Params) -> f64 {
    let s1_set: HashSet<_> = HashSet::from_iter(temp.transformed.iter());
    let s2_set: HashSet<_> = HashSet::from_iter(other.transformed.iter());
    let inter: HashSet<_> = s1_set.intersection(&s2_set).collect();
    let union: HashSet<_> = s1_set.union(&s2_set).collect();
    let distance = params.distance;
    match distance {
        0 => {1.0 - ((inter.len() as f64) / (union.len() as f64))}
        1 => {1.0 - ((inter.len() as f64) / (s1_set.len() as f64))}
        2 => {
            let jaccard = (inter.len() as f64) / (union.len() as f64);
            let mash : f64 = -1.0 * ((2.0 * jaccard) / (1.0 + jaccard)).ln() / params.l as f64;
            mash
        }
        _ => {
            let jaccard = (inter.len() as f64) / (union.len() as f64);
            let mash : f64 = (-1.0 / params.k as f64) * ((2.0 * jaccard) / (1.0 + jaccard)).ln();
            mash
        }
    }
}
pub fn dist ( temp : & Read , other : & Read , params : & Params ) -> f64 { let s1_set : HashSet < _ > = HashSet :: from_iter ( temp . transformed . iter ( ) ) ; let s2_set : HashSet < _ > = HashSet :: from_iter ( other . transformed . iter ( ) ) ; let inter : HashSet < _ > = s1_set . intersection ( & s2_set ) . collect ( ) ; let union : HashSet < _ > = s1_set . union ( & s2_set ) . collect ( ) ; let distance = params . distance ; match distance { 0 => { 1.0 - ( ( inter . len ( ) as f64 ) / ( union . len ( ) as f64 ) ) } 1 => { 1.0 - ( ( inter . len ( ) as f64 ) / ( s1_set . len ( ) as f64 ) ) } 2 => { let jaccard = ( inter . len ( ) as f64 ) / ( union . len ( ) as f64 ) ; let mash : f64 = - 1.0 * ( ( 2.0 * jaccard ) / ( 1.0 + jaccard ) ) . ln ( ) / params . l as f64 ; mash } _ => { let jaccard = ( inter . len ( ) as f64 ) / ( union . len ( ) as f64 ) ; let mash : f64 = ( - 1.0 / params . k as f64 ) * ( ( 2.0 * jaccard ) / ( 1.0 + jaccard ) ) . ln ( ) ; mash } } }
Computes the distance between two reads which are already in minimizer-space.
Computes the distance between two reads which are already in minimizer - space .
temp
&Read
other
&Read
params
&Params
temp
&Read
other
&Read
params
&Params