csi

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2017 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package csi implements CSIv1 and CSIv2 coordinate sorted indexing.

Index

Constants

View Source
const (
	// DefaultShift is the default minimum shift setting for a CSI.
	DefaultShift = 14

	// DefaultDepth is the default index depth for a CSI.
	DefaultDepth = 5
)

Variables

This section is empty.

Functions

func MinimumDepthFor

func MinimumDepthFor(max int64, shift uint32) (uint32, bool)

MinimumDepthFor returns the lowest depth value that can be used to index the given maximum position with the given index minimum shift.

func MinimumShiftFor

func MinimumShiftFor(max int64, depth uint32) (uint32, bool)

MinimumShiftFor returns the lowest minimum shift value that can be used to index the given maximum position with the given index depth.

func WriteTo

func WriteTo(w io.Writer, idx *Index) error

WriteTo writes the CSI index to the given io.Writer. Note that the csi specification states that the index is stored as BGZF, but WriteTo does not perform compression.

Types

type Index

type Index struct {
	Auxilliary []byte
	Version    byte
	// contains filtered or unexported fields
}

Index implements coordinate sorted indexing.

func New

func New(minShift, depth int) *Index

New returns a CSI index with the given minimum shift and depth. The returned index defaults to CSI version 2.

func ReadFrom

func ReadFrom(r io.Reader) (*Index, error)

ReadFrom reads the CSI index from the given io.Reader. Note that the csi specification states that the index is stored as BGZF, but ReadFrom does not perform decompression.

func (*Index) Add

func (i *Index) Add(r Record, c bgzf.Chunk, mapped, placed bool) error

Add records the Record as having being located at the given chunk with the given mapping and placement status.

func (*Index) Chunks

func (i *Index) Chunks(rid int, beg, end int) []bgzf.Chunk

Chunks returns a []bgzf.Chunk that corresponds to the given interval.

func (*Index) MergeChunks

func (i *Index) MergeChunks(s index.MergeStrategy)

MergeChunks applies the given MergeStrategy to all bins in the Index.

func (*Index) NumRefs

func (i *Index) NumRefs() int

NumRefs returns the number of references in the index.

func (*Index) ReferenceStats

func (i *Index) ReferenceStats(id int) (stats index.ReferenceStats, ok bool)

ReferenceStats returns the index statistics for the given reference and true if the statistics are valid.

func (*Index) Unmapped

func (i *Index) Unmapped() (n uint64, ok bool)

Unmapped returns the number of unmapped reads and true if the count is valid.

type Record

type Record interface {
	RefID() int
	Start() int
	End() int
}

Record wraps types that may be indexed by an Index.

Jump to

Keyboard shortcuts

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