seedposition

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BufferSize = 65536 // os.Getpagesize()

BufferSize is size of reading and writing buffer

View Source
var ErrBrokenFile = errors.New("seed position data: broken file")

ErrBrokenFile means the file is not complete.

View Source
var ErrInvalidFileFormat = errors.New("seed position data: invalid binary format")

ErrInvalidFileFormat means invalid file format.

View Source
var ErrVersionMismatch = errors.New("seed position data: version mismatch")

ErrVersionMismatch means version mismatch between files and program

View Source
var Magic = [8]byte{'.', 's', 'e', 'e', 'd', 'l', 'o', 'c'}

Magic number for checking file format

View Source
var MagicIdx = [8]byte{'.', 'l', 'o', 'c', 'i', 'd', 'e', 'x'}

Magic number for the index file

View Source
var MainVersion uint8 = 0

MainVersion is use for checking compatibility

View Source
var MinorVersion uint8 = 1

MinorVersion is less important

View Source
var PositionsIndexFileExt = ".idx"

PositionsIndexFileExt is the file extension of seed position index file.

Functions

This section is empty.

Types

type Reader

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

Reader is for reading the seed position of a genome

func NewReader

func NewReader(file string) (*Reader, error)

NewReader returns a reader from a seed position file. The reader is recycled after calling Close().

func (*Reader) Close

func (r *Reader) Close() error

Close closes and recycles the reader.

func (*Reader) SeedPositions

func (r *Reader) SeedPositions(idx int, locs *[]uint32) error

SeedPositions returns the seed positions with an index of idx (0-based).

type Writer

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

Writer saves a list of seed positions to a file.

func NewWriter

func NewWriter(file string, batch uint32) (*Writer, error)

NewWriter creates a new Writer. Batch is the batch id for this data file.

func (*Writer) Close

func (w *Writer) Close() error

Close writes the index file and finishes the writing.

func (*Writer) Write

func (w *Writer) Write(locs []uint32) error

Write writes a list of SORTED uint32s. The data should be sorted, because writing is seriallized, while sorting can be asynchronous.

Jump to

Keyboard shortcuts

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