#constant-time #dna #hamming #distance #calculations #u64 #encoding

basebits

A library for encoding DNA into u64 to allow for constant time hamming distance calculations

6 releases (stable)

1.2.0 Nov 6, 2019
1.1.0 Nov 4, 2019
1.0.1 Nov 4, 2019
0.2.1 Aug 12, 2019
0.2.0 Aug 12, 2019

#13 in #hamming

Download history 6/week @ 2024-07-20 20/week @ 2024-07-27 38/week @ 2024-08-03 15/week @ 2024-08-10 30/week @ 2024-08-17 14/week @ 2024-08-24 5/week @ 2024-08-31 9/week @ 2024-09-07 1/week @ 2024-09-14 33/week @ 2024-09-21 56/week @ 2024-09-28 16/week @ 2024-10-05 37/week @ 2024-10-12 17/week @ 2024-10-19 22/week @ 2024-10-26 45/week @ 2024-11-02

125 downloads per month
Used in rumi

MIT license

17KB
396 lines

docs crates.io

basebits

A library for memory efficient short DNA sequence encoding.

Synopsis

When to use this library? If you are comparing strings against each other more than 4 times, it becomes more efficient to pay the cost of encoding them.

Operations

Constant time hamming distance calculations.

Example

use basebits::{BaseBits, hamming_dist};

fn main() {
    let string1 = b"ACTGACTG";
    let string2 = b"ACTTACTG";

    let string1 = BaseBits::new(string1).unwrap();
    let string2 = BaseBits::new(string2).unwrap();

    assert_eq!(hamming_dist(&string1, &string2), 1);
}

Reference

See 'Constant Time Hamming Distance' section: https://www.biorxiv.org/content/10.1101/648683v1.full

Future directions

FFT stuff?

No runtime deps