sketching

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package sketching provides sequence sketching and distance calculation functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Containment

func Containment(a, b []uint64) float64

Containment returns a Jaccard-like similarity for the containment of a in b.

func Jaccard

func Jaccard(a, b []uint64) float64

Jaccard returns the Jaccard similarity between a and b.

func MyDist

func MyDist(a, b []uint64, alen, blen int, k int) float64

MyDist returns a Mash distance with compensation for length difference.

func Sketch

func Sketch(seq []byte, k int, scale uint64) []uint64

Sketch returns a sketch with 1/scale kmer hashes/

Types

type Index

type Index struct {
	// contains filtered or unexported fields
}

Index allows quick lookups for sketches.

func NewIndex

func NewIndex(scale uint64) *Index

NewIndex returns a new index that stores 1/scale of hashes.

func (*Index) Add

func (idx *Index) Add(s []uint64, i int)

Add adds the given sketch with the given serial number.

func (*Index) Clean

func (idx *Index) Clean()

Clean removes keys with only one element. Use only for clustering.

func (*Index) Search

func (idx *Index) Search(s []uint64) []int

Search returns serial numbers of sketches that share hashes with the given sketch.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL