/// Creates a HashMap containing all the k-mers in the sequence. FxHasher is used
/// as the hash function instead of the inbuilt one. A good rolling hash function
/// should speed up the code.
Creates a HashMap containing all the k-mers in the sequence. FxHasher is used
as the hash function instead of the inbuilt one. A good rolling hash function
should speed up the code.
Creates a HashMap containing all the k - mers in the sequence . FxHasher is used as the hash function instead of the inbuilt one . A good rolling hash function should speed up the code .
pub fn hash_kmers(seq: &[u8], k: usize) -> HashMapFx<&[u8], Vec<u32>> {
    let slc = seq;
    let mut set: HashMapFx<&[u8], Vec<u32>> = HashMapFx::default();
    for i in 0..(slc.len() + 1).saturating_sub(k) {
        set.entry(&slc[i..i + k])
            .or_insert_with(Vec::new)
            .push(i as u32);
    }
    set
}
pub fn hash_kmers ( seq : & [ u8 ] , k : usize ) -> HashMapFx < & [ u8 ] , Vec < u32 > > { let slc = seq ; let mut set : HashMapFx < & [ u8 ] , Vec < u32 > > = HashMapFx :: default ( ) ; for i in 0 .. ( slc . len ( ) + 1 ) . saturating_sub ( k ) { set . entry ( & slc [ i .. i + k ] ) . or_insert_with ( Vec :: new ) . push ( i as u32 ) ; } set }
Creates a HashMap containing all the k-mers in the sequence.
Creates a HashMap containing all the k - mers in the sequence .
seq
&[u8]
k
usize