index

package
v1.4.5 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: BSD-3-Clause Imports: 3 Imported by: 12

Documentation

Overview

Package index provides common code for CSI and tabix BGZF indexing.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoReference = errors.New("index: no reference")
	ErrInvalid     = errors.New("index: invalid interval")
)

Functions

This section is empty.

Types

type ChunkReader

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

Reader wraps a bgzf.Reader to provide a mechanism to read a selection of BGZF chunks.

func NewChunkReader

func NewChunkReader(r *bgzf.Reader, chunks []bgzf.Chunk) (*ChunkReader, error)

NewChunkReader returns a ChunkReader to read from r, limiting the reads to the provided chunks. The provided bgzf.Reader will be put into Blocked mode.

func (*ChunkReader) Close

func (r *ChunkReader) Close() error

Close returns the bgzf.Reader to its original blocking mode and releases it. The bgzf.Reader is not closed.

func (*ChunkReader) Read

func (r *ChunkReader) Read(p []byte) (int, error)

Read satisfies the io.Reader interface.

type MergeStrategy

type MergeStrategy func([]bgzf.Chunk) []bgzf.Chunk

MergeStrategy represents a chunk compression strategy.

var (
	// Identity leaves the []bgzf.Chunk unaltered.
	Identity MergeStrategy = identity

	// Adjacent merges contiguous bgzf.Chunks.
	Adjacent MergeStrategy = adjacent

	// Squash merges all bgzf.Chunks into a single bgzf.Chunk.
	Squash MergeStrategy = squash
)

func CompressorStrategy

func CompressorStrategy(near int64) MergeStrategy

CompressorStrategy returns a MergeStrategy that will merge bgzf.Chunks that have a distance between BGZF block starts less than or equal to near.

type ReferenceStats

type ReferenceStats struct {
	// Chunk is the span of the indexed BGZF
	// holding alignments to the reference.
	Chunk bgzf.Chunk

	// Mapped is the count of mapped reads.
	Mapped uint64

	// Unmapped is the count of unmapped reads.
	Unmapped uint64
}

ReferenceStats holds mapping statistics for a genomic reference.

Jump to

Keyboard shortcuts

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