sketchio

package
v0.0.0-...-cbd5ca3 Latest Latest
Warning

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

Go to latest
Published: May 25, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package sketchio is used to read and write HULK sketches

Index

Constants

This section is empty.

Variables

View Source
var AvailAlgorithms = []string{"histosketch", "kmv", "khf"}

AvailAlgorithms is a list of the sketching algorithms currently used by HULK

Functions

This section is empty.

Types

type HULKdata

type HULKdata struct {
	Class      string       `json:"class"`
	FileName   string       `json:"filename"`
	HashFunc   string       `json:"hash_function"`
	License    string       `json:"license"`
	Signatures []*Signature `json:"signatures"`
	Version    string       `json:"version"`
	Banner     string       `json:"banner_label"` // TODO: this entry is to store a label for BANNER (e.g. for training a classifier) - let's change it to a more generic metadata label
}

HULKdata holds the common information required by any sketching algorithm in this library

func LoadHULKdata

func LoadHULKdata(fileName string) (*HULKdata, error)

LoadHULKdata loads a JSON file from disk into a HULKdata

func NewHULKdata

func NewHULKdata() *HULKdata

NewHULKdata is the constructor function

func (*HULKdata) Add

func (HULKdata *HULKdata) Add(inputSketch SketchObject) error

Add is a method to add a sketch to the HULKdata

func (*HULKdata) FindSketch

func (HULKdata *HULKdata) FindSketch(kSize uint, algo string) (SketchObject, error)

FindSketch is a method to return a single sketch object from a HULKdata, derived from a specified kmer size and sketching algorithm

func (*HULKdata) GetDistance

func (HULKdata *HULKdata) GetDistance(query *HULKdata, metric string, kSize uint, algo string) (float64, error)

GetDistance is a method to calculate a distance metric for two sketch objects

func (*HULKdata) WriteJSON

func (HULKdata *HULKdata) WriteJSON(outfileName string) error

WriteJSON writes a HULKdata to a JSON file on disk

type Signature

type Signature struct {
	Algorithm string
	Sketch    SketchObject
}

Signature contains the sketch and the algorithm by which it was generated

type SketchObject

type SketchObject interface {
	GetAlgo() string
	GetSketch() []uint64
	GetMD5() string
	SetMD5()
}

SketchObject is an interface to process any of the sketches produced by HULK

Jump to

Keyboard shortcuts

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