lshe

package
v0.0.0-...-1be76fa Latest Latest
Warning

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

Go to latest
Published: May 11, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package lshe is used to index the graphs. It wraps the LSH ensemble library: https://github.com/ekzhu/lshensemble

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainmentIndex

type ContainmentIndex struct {
	NumPart        int            // NumPart is the number of partitions
	MaxK           int            // MaxK is the number of hash funcs per band
	NumWindowKmers int            // NumWindowKmers is the number of k-mers in the graph windows
	SketchSize     int            // SketchSize is the size of the sketches being indexed (num hash funcs)
	WindowLookup   map[string]Key // WindowLookup is a map linking windows to a their sketch in the LSH Ensemble
	// contains filtered or unexported fields
}

ContainmentIndex is a wrapper for the LSH Ensemble data structure

func InitIndex

func InitIndex(numPart, maxK, numWindowKmers, sketchSize int) *ContainmentIndex

InitIndex will get a containment index struct ready

func (*ContainmentIndex) AddWindow

func (ContainmentIndex *ContainmentIndex) AddWindow(windowLookup string, window Key) error

AddWindow will add a window to a ContainmentIndex

func (*ContainmentIndex) Dump

func (ContainmentIndex *ContainmentIndex) Dump(filePath string) error

Dump is a method to write a containment index to disk

func (*ContainmentIndex) Load

func (ContainmentIndex *ContainmentIndex) Load(filePath string) error

Load is a method to load a containment index from disk and populate the LSH Ensemble

func (*ContainmentIndex) LoadFromBytes

func (ContainmentIndex *ContainmentIndex) LoadFromBytes(data []byte) error

LoadFromBytes is a method to load the containment index from a byte array

func (*ContainmentIndex) Query

func (ContainmentIndex *ContainmentIndex) Query(querySig []uint64, querySize int, containmentThreshold float64) (map[uint32]Keys, error)

Query wraps the LSH ensemble query method query sig is the sketch query size is the number of k-mers in the query sequence containment threshold is the containment threshold...

type Key

type Key struct {
	GraphID        uint32             // identifies the graph
	Node           uint64             // identifies the first node in the graph window
	OffSet         uint32             // identifies the offset of a window within the first node
	ContainedNodes map[uint64]float64 // describes the traversal through the graph for the window
	Ref            []uint32           // the IDs for the reference sequences that contains this window
	RC             bool               // identifies if the read has been reverse complemented (NOT USED)
	Sketch         []uint64           // the sketch of this graph window
	Freq           float64            // records the number of k-mers this graph window has received during read mapping
	MergeSpan      uint32             // indicates maximum distance between graph windows this key represents (used in window merging if sketches identical)
	WindowSize     uint32             // the size of the window that was sketched (prior to merging)
}

Key relates sketches of reads and graph traversals to specific windows of a graph

type Keys

type Keys []Key

Keys is used to hold multiple keys (and satisfies the sort interface)

func (Keys) Len

func (k Keys) Len() int

func (Keys) Less

func (k Keys) Less(i, j int) bool

func (Keys) Swap

func (k Keys) Swap(i, j int)

Jump to

Keyboard shortcuts

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