index

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CANONICAL = 1 << iota
	COMPACT
)
View Source
const Version uint8 = 4

Version is the version of index format

Variables

View Source
var ErrInvalidIndexFileFormat = errors.New("kmcp: invalid index format")

ErrInvalidIndexFileFormat means invalid index format.

View Source
var ErrNameAndIndexMismatch = errors.New("kmcp: size of names and indices unequal")

ErrNameAndIndexMismatch means size of names and sizes are not equal.

View Source
var ErrNameAndSizeMismatch = errors.New("kmcp: size of names and sizes unequal")

ErrNameAndSizeMismatch means size of names and sizes are not equal.

View Source
var ErrTruncateIndexFile = errors.New("kmcp: truncated index file")

ErrTruncateIndexFile means the file is truncated

View Source
var ErrUnfishedWrite = errors.New("kmcp: index not fished writing")

ErrUnfishedWrite means writing not finished

View Source
var ErrVersionMismatch = errors.New("kmcp: version mismatch")

ErrVersionMismatch means version mismatch between files and program

View Source
var ErrWrongWriteDataSize = errors.New("kmcp: write data with wrong size")

ErrWrongWriteDataSize means the size of data to write is invalid

View Source
var Magic = [8]byte{'.', 'k', 'm', 'c', 'p', 'i', 'd', 'x'}

Magic number of index file.

Functions

This section is empty.

Types

type Header struct {
	Version uint8 // uint8
	K       int   // uint8

	Canonical bool
	Compact   bool
	NumHashes uint8 // uint8
	NumSigs   uint64

	Names  [][]string // one bloom filter contains union of multiple sets
	GSizes [][]uint64 // genome sizes
	// Kmers   [][]uint64 // kmer numbers
	Indices [][]uint32 // coresponding chunk indices of all sets.
	Sizes   []uint64

	NumRowBytes int // length of bytes for storing one row of signiture for n names
	// contains filtered or unexported fields
}

Header contains metadata

func (Header) Compatible

func (h Header) Compatible(b Header) bool

Compatible checks compatibility

func (Header) String

func (h Header) String() string

type Reader

type Reader struct {
	Header
	// contains filtered or unexported fields
}

Reader is for reading signatures.

func NewReader

func NewReader(r io.Reader) (reader *Reader, err error)

NewReader returns a Reader.

func (*Reader) Read

func (reader *Reader) Read() ([]byte, error)

Read reads one code.

type Writer

type Writer struct {
	Header
	// contains filtered or unexported fields
}

Writer writes KmerCode.

func NewWriter

func NewWriter(w io.Writer, k int, canonical bool, compact bool, numHashes uint8, numSigs uint64,
	names [][]string, gsizes [][]uint64, indices [][]uint32, sizes []uint64) (*Writer, error)

NewWriter creates a Writer. func NewWriter(w io.Writer, k int, canonical bool, compact bool, numHashes uint8, numSigs uint64,

names [][]string, gsizes [][]uint64, kmers [][]uint64, indices [][]uint32, sizes []uint64) (*Writer, error) {

func (*Writer) Flush

func (writer *Writer) Flush() (err error)

Flush check completeness

func (*Writer) Write

func (writer *Writer) Write(data []byte) (err error)

Write writes one row of signitures

func (*Writer) WriteBatch

func (writer *Writer) WriteBatch(data []byte, n int) (err error)

WriteBatch writes a batch of data

func (*Writer) WriteHeader

func (writer *Writer) WriteHeader() (err error)

WriteHeader writes file header

Jump to

Keyboard shortcuts

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