bacpop / sketchlib.rust

Rust reimplementation of pp-sketchlib
Apache License 2.0
2 stars 1 forks source link

Try reverse index for queries/linclust with bins #11

Closed johnlees closed 1 week ago

johnlees commented 5 months ago

Another way of storing the data would be to have each sketch bin stored as a dictionary, with the key as the 14-bits of the bin value (not transposed) and values as the samples which had that bin. Then I think you could do a fast distance query for a new sample by finding matching bins and adding the values from each match.

I think the efficiency of the 'adding the values from each match' would determine whether this is faster or slower than the default method here. Starting with sparse vectors of integers (i.e. just those samples where there is a match) probably makes sense.

johnlees commented 4 months ago

Linclust for sketchlib

Find group of queries which share k-mer in a bin Calculate dists of these to centre (longest) Cluster: 'Briefly, the file with the validated directed edges from center sequences to member sequences is read in and all reverse edges are added. The list of input sequences is sorted by decreasing length. While the list is not yet empty, the top sequence is removed from the list, together with all sequences still in the list that share an edge with it. These sequences form a new cluster with the top sequence as its representative.'

johnlees commented 4 months ago

roaringbitmap might be appropriate here to store the samples in which each hash is present https://docs.rs/roaring/latest/roaring/bitmap/struct.RoaringBitmap.html

johnlees commented 1 week ago

Tracking this in #21 now