File tree Expand file tree Collapse file tree 2 files changed +15
-13
lines changed
Expand file tree Collapse file tree 2 files changed +15
-13
lines changed Original file line number Diff line number Diff line change 11[package ]
22name = " trio_binning"
3- version = " 0.1.0 "
4- authors = [" Edward S. Rice <esrice@ucsc .edu>" ]
3+ version = " 0.2.3 "
4+ authors = [" Edward S. Rice <edward.rice@missouri .edu>" ]
55
66[dependencies ]
77flate2 = " 1.0.2"
Original file line number Diff line number Diff line change @@ -29,18 +29,20 @@ pub fn count_kmers_in_read(hap_a_kmers: &kmer::KmerSet,
2929 let mut hap_a_count: u32 = 0 ;
3030 let mut hap_b_count: u32 = 0 ;
3131
32- for i in 0 ..( read. seq . len ( ) - k + 1 ) {
33- let bits = kmer:: get_canonical_repr ( & read. seq [ i..i+k] )
34- . and_then ( |kmer| kmer:: kmer_to_bits ( & kmer) ) ?;
32+ if read. seq . len ( ) >= k {
33+ for i in 0 ..( read. seq . len ( ) - k + 1 ) {
34+ let bits = kmer:: get_canonical_repr ( & read. seq [ i..i+k] )
35+ . and_then ( |kmer| kmer:: kmer_to_bits ( & kmer) ) ?;
3536
36- if hap_a_kmers. contains ( & bits) {
37- hap_a_count += 1 ;
38- }
39- // hap_a_kmers and hap_b_kmers *should* be mutually exclusive sets, so
40- // it shouldn't matter whether this is if or else if, but I'm doing it
41- // this way so that the answer is still correct even if they aren't.
42- if hap_b_kmers. contains ( & bits) {
43- hap_b_count += 1 ;
37+ if hap_a_kmers. contains ( & bits) {
38+ hap_a_count += 1 ;
39+ }
40+ // hap_a_kmers and hap_b_kmers *should* be mutually exclusive sets, so
41+ // it shouldn't matter whether this is if or else if, but I'm doing it
42+ // this way so that the answer is still correct even if they aren't.
43+ if hap_b_kmers. contains ( & bits) {
44+ hap_b_count += 1 ;
45+ }
4446 }
4547 }
4648
You can’t perform that action at this time.
0 commit comments