pub fn remove_censored_exts_sharded<K: Kmer, D>(
    stranded: bool,
    valid_kmers: &mut Vec<(K, (Exts, D))>,
    all_kmers: &Vec<K>,
) {
    for idx in 0..valid_kmers.len() {
        let mut new_exts = Exts::empty();
        let kmer = valid_kmers[idx].0;
        let exts = (valid_kmers[idx].1).0;

        for dir in [Dir::Left, Dir::Right].iter() {
            for i in 0..4 {
                if exts.has_ext(*dir, i) {
                    let _ext_kmer = kmer.extend(i, *dir);

                    let ext_kmer = if stranded {
                        _ext_kmer
                    } else {
                        _ext_kmer.min_rc()
                    };

                    let censored = if valid_kmers.binary_search_by_key(&ext_kmer, |d| d.0).is_ok() {
                        // ext_kmer is valid. not censored
                        false
                    } else {
                        // ext_kmer is not valid. if it was in this shard, then we censor it
                        all_kmers.binary_search(&ext_kmer).is_ok()
                    };

                    if !censored {
                        new_exts = new_exts.set(*dir, i);
                    }
                }
            }
        }

        (valid_kmers[idx].1).0 = new_exts;
    }
}
/// Remove extensions in valid_kmers that point to censored kmers. A censored kmer
/// exists in all_kmers but not valid_kmers. Since the kmer exists in this partition,
/// but was censored, we know that we can delete extensions to it.
/// In sharded kmer processing, we will have extensions to kmers in other shards. We don't
/// know whether these are censored until later, so we retain these extension.
Remove extensions in valid_kmers that point to censored kmers. A censored kmer
exists in all_kmers but not valid_kmers. Since the kmer exists in this partition,
but was censored, we know that we can delete extensions to it.
In sharded kmer processing, we will have extensions to kmers in other shards. We don't
know whether these are censored until later, so we retain these extension.
Remove extensions in valid_kmers that point to censored kmers . A censored kmer exists in all_kmers but not valid_kmers . Since the kmer exists in this partition but was censored we know that we can delete extensions to it . In sharded kmer processing we will have extensions to kmers in other shards . We don ' t know whether these are censored until later so we retain these extension .
pub fn remove_censored_exts_sharded<K: Kmer, D>(
    stranded: bool,
    valid_kmers: &mut Vec<(K, (Exts, D))>,
    all_kmers: &Vec<K>,
) {
    for idx in 0..valid_kmers.len() {
        let mut new_exts = Exts::empty();
        let kmer = valid_kmers[idx].0;
        let exts = (valid_kmers[idx].1).0;
        for dir in [Dir::Left, Dir::Right].iter() {
            for i in 0..4 {
                if exts.has_ext(*dir, i) {
                    let _ext_kmer = kmer.extend(i, *dir);
                    let ext_kmer = if stranded {
                        _ext_kmer
                    } else {
                        _ext_kmer.min_rc()
                    };
                    let censored = if valid_kmers.binary_search_by_key(&ext_kmer, |d| d.0).is_ok() {
                        // ext_kmer is valid. not censored
                        false
                    } else {
                        // ext_kmer is not valid. if it was in this shard, then we censor it
                        all_kmers.binary_search(&ext_kmer).is_ok()
                    };
                    if !censored {
                        new_exts = new_exts.set(*dir, i);
                    }
                }
            }
        }
        (valid_kmers[idx].1).0 = new_exts;
    }
}
pub fn remove_censored_exts_sharded < K : Kmer , D > ( stranded : bool , valid_kmers : & mut Vec < ( K , ( Exts , D ) ) > , all_kmers : & Vec < K > , ) { for idx in 0 .. valid_kmers . len ( ) { let mut new_exts = Exts :: empty ( ) ; let kmer = valid_kmers [ idx ] . 0 ; let exts = ( valid_kmers [ idx ] . 1 ) . 0 ; for dir in [ Dir :: Left , Dir :: Right ] . iter ( ) { for i in 0 .. 4 { if exts . has_ext ( * dir , i ) { let _ext_kmer = kmer . extend ( i , * dir ) ; let ext_kmer = if stranded { _ext_kmer } else { _ext_kmer . min_rc ( ) } ; let censored = if valid_kmers . binary_search_by_key ( & ext_kmer , | d | d . 0 ) . is_ok ( ) { // ext_kmer is valid. not censored false } else { // ext_kmer is not valid. if it was in this shard, then we censor it all_kmers . binary_search ( & ext_kmer ) . is_ok ( ) } ; if ! censored { new_exts = new_exts . set ( * dir , i ) ; } } } } ( valid_kmers [ idx ] . 1 ) . 0 = new_exts ; } }
Remove extensions in valid_kmers that point to censored kmers.
Remove extensions in valid_kmers that point to censored kmers .
stranded
bool
valid_kmers
&mut Vec<(K, (Exts, D))>
all_kmers
&Vec<K>
stranded
bool
valid_kmers
&mut Vec<(K, (Exts, D))>
all_kmers
&Vec<K>