tabix

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: 8 Imported by: 6

Documentation

Overview

Package tabix implements tabix coordinate sorted indexing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteTo

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

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

Types

type Index

type Index struct {
	Format    byte
	ZeroBased bool

	NameColumn  int32
	BeginColumn int32
	EndColumn   int32

	MetaChar rune
	Skip     int32
	// contains filtered or unexported fields
}

Index is a tabix index.

func New

func New() *Index

New returns a new tabix index.

func ReadFrom

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

ReadFrom reads the tabix index from the given io.Reader. Note that the tabix 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, placed, mapped bool) error

Add records the SAM record as having being located at the given chunk.

func (*Index) Chunks

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

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

func (*Index) IDs

func (i *Index) IDs() map[string]int

IDs returns a map of strings to integer IDs. The returned map should not be altered.

func (*Index) MergeChunks

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

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

func (*Index) Names

func (i *Index) Names() []string

Names returns the reference names in the index. The returned slice should not be altered.

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 {
	RefName() string
	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