pub fn hamming_dist(&self, other: &DnaStringSlice) -> u32 {
        use crate::kmer::Kmer32;
        assert_eq!(self.len(), other.len());

        let mut ndiffs = 0;

        let whole_blocks = self.len() >> 5;

        // iterate over the whole K=32 blocks
        for block in (0..whole_blocks).step_by(32) {
            let b1: Kmer32 = self.get_kmer(block);
            let b2: Kmer32 = self.get_kmer(block);
            ndiffs += count_diff_2_bit_packed(b1.to_u64(), b2.to_u64());
        }

        // iterate over trailing bases
        for pos in (whole_blocks >> 5)..self.len() {
            if self.get(pos) != other.get(pos) {
                ndiffs += 1;
            }
        }

        ndiffs
    }
/// Compute the Hamming distance between this DNA string and another
Compute the Hamming distance between this DNA string and another
Compute the Hamming distance between this DNA string and another
pub fn hamming_dist(&self, other: &DnaStringSlice) -> u32 {
        use crate::kmer::Kmer32;
        assert_eq!(self.len(), other.len());
        let mut ndiffs = 0;
        let whole_blocks = self.len() >> 5;
        // iterate over the whole K=32 blocks
        for block in (0..whole_blocks).step_by(32) {
            let b1: Kmer32 = self.get_kmer(block);
            let b2: Kmer32 = self.get_kmer(block);
            ndiffs += count_diff_2_bit_packed(b1.to_u64(), b2.to_u64());
        }
        // iterate over trailing bases
        for pos in (whole_blocks >> 5)..self.len() {
            if self.get(pos) != other.get(pos) {
                ndiffs += 1;
            }
        }
        ndiffs
    }
pub fn hamming_dist ( & self , other : & DnaStringSlice ) -> u32 { use crate :: kmer :: Kmer32 ; assert_eq ! ( self len ( ) other len ( ) ) ; let mut ndiffs = 0 ; let whole_blocks = self . len ( ) >> 5 ; // iterate over the whole K=32 blocks for block in ( 0 .. whole_blocks ) . step_by ( 32 ) { let b1 : Kmer32 = self . get_kmer ( block ) ; let b2 : Kmer32 = self . get_kmer ( block ) ; ndiffs += count_diff_2_bit_packed ( b1 . to_u64 ( ) , b2 . to_u64 ( ) ) ; } // iterate over trailing bases for pos in ( whole_blocks >> 5 ) .. self . len ( ) { if self . get ( pos ) != other . get ( pos ) { ndiffs += 1 ; } } ndiffs }
Compute the Hamming distance between this DNA string and another
Compute the Hamming distance between this DNA string and another
&self
other
&DnaStringSlice
&self
other
&DnaStringSlice