#hamming #dna #constant #fn #time #u64 #encoding-library

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
Download history 69/week @ 2023-01-26 65/week @ 2023-02-02 54/week @ 2023-02-09 37/week @ 2023-02-16 6/week @ 2023-02-23 7/week @ 2023-03-02 20/week @ 2023-03-09 19/week @ 2023-03-16 7/week @ 2023-03-23 13/week @ 2023-03-30 35/week @ 2023-04-06 15/week @ 2023-04-13 10/week @ 2023-04-20 17/week @ 2023-04-27 26/week @ 2023-05-04 22/week @ 2023-05-11

76 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