libblini

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package libblini provides reusable code for the blini algorithm.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateSketchFile

func CreateSketchFile[T constraints.Unsigned](
	inFile, outFile string, scale uint64, ignoreShort bool) error

CreateSketchFile sketches a fasta file and outputs the sketches into a file.

Types

type Dataset

type Dataset[T constraints.Unsigned] struct {
	// contains filtered or unexported fields
}

Dataset holds sketches, metadata and index.

func ReadDataset

func ReadDataset[T constraints.Unsigned](
	file string, scale uint64, index bool, ignoreShort bool) (*Dataset[T], error)

ReadDataset reads a sketch dataset from a file. Reads pre-sketched data if the file ends with .blini, otherwise treats the data as fasta and sketches it.

func (*Dataset[T]) Cluster

func (d *Dataset[T]) Cluster(minSim float64, contn bool) [][]int

Cluster clusters this dataset's sketches, with minSim as the minimal similarity between each element and the cluster's representative. contn is whether containment should be checked rather than full match.

func (*Dataset[T]) IsIgnored

func (d *Dataset[T]) IsIgnored(i int) bool

IsIgnored returns whether the i'th sequence was ignored when building this dataset.

func (*Dataset[T]) Len

func (d *Dataset[T]) Len() int

Len returns the number of sketches in the dataset.

func (*Dataset[T]) Search

func (d *Dataset[T]) Search(seq []byte, contn bool) iter.Seq[SearchResult]

Search sketches seq and and looks it up in the dataset.

func (*Dataset[T]) SearchSketch

func (d *Dataset[T]) SearchSketch(s *Sketch[T], contn bool) iter.Seq[SearchResult]

SearchSketch looks up a sketch in the dataset.

func (*Dataset[T]) Sketch

func (d *Dataset[T]) Sketch(i int) *Sketch[T]

Sketch returns a clone of the i'th sketch.

type SearchResult

type SearchResult struct {
	I          int     // Reference serial number, 0-based.
	Name       string  // Reference name.
	Similarity float64 // Between 0-1.
}

SearchResult is a single match between a query and a reference sequence.

type Sketch

type Sketch[T constraints.Unsigned] struct {
	// contains filtered or unexported fields
}

Sketch represents a single sequence that has been sketched.

func (*Sketch[T]) Hashes

func (s *Sketch[T]) Hashes() iter.Seq[T]

Hashes returns an iterator of this sketch's elements.

func (*Sketch[T]) Len

func (s *Sketch[T]) Len() int

Len returns the length of the original sequence.

func (*Sketch[T]) Name

func (s *Sketch[T]) Name() string

Name returns the name of the original sequence.

func (*Sketch[T]) Scale

func (s *Sketch[T]) Scale() uint64

Scale returns the sketch's scale (one out of how many hashes are used).

func (*Sketch[T]) Similarity

func (s *Sketch[T]) Similarity(other *Sketch[T], contn bool) float64

Similarity returns an estimation of average nucleotide identity (ANI) between the sequence represented by this sketch and the other.

Jump to

Keyboard shortcuts

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