bix

package module
v0.0.0-...-6c14ab6 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2022 License: MIT Imports: 21 Imported by: 2

README

bix

Tabix files in go.

GoDoc

Bixis a pure go tabix reader. Tabix has a minimum resolution of 16K bases. So, for dense annotations like ExAC, repeated queries will have to re-parse the same intervals. To mitigate this, Bix caches all annotations for the blocks from each query and re-uses them for later querires to the same block. In practice, this results in 10X-100X speedup for any type of data.

tbx, err := bix.New(f)

// Query returns an io.Reader
ph := true // print header ?
rdr, err := tbx.Query(chrom, start, end, ph)
buf := bufio.NewReader(rdr)
for {
	line, err := bufr.ReadString('\n')
	if err == io.EOF {
		break
	}
	fmt.Println(line)
}
// or

intervals := tbx.Get(chrom, start, end)


where intervals will be either a vcfgo.Variant or an Interval object with a Chrom(), Start(), and End() method.

Documentation

Overview

Tabix queries for go

Tabix queries for go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCSI

func NewCSI(r io.Reader) (cIndex, error)

Types

type Bix

type Bix struct {
	Index

	VReader *vcfgo.Reader
	// contains filtered or unexported fields
}

Bix provides read access to tabix files.

func New

func New(path string, workers ...int) (*Bix, error)

New returns a &Bix from on-disk files.

func NewGCP

func NewGCP(path string, client *storage.Client, workers ...int) (*Bix, error)

NewGCP returns a &Bix from either on-disk files or, if a GCP client is specified and the .vcf file begins with 'gs://', from a Google Storage object connection that simulates seeking capabilities.

func (*Bix) AddInfoToHeader

func (tbx *Bix) AddInfoToHeader(id, number, vtype, desc string)

func (*Bix) ChunkedReader

func (tbx *Bix) ChunkedReader(chrom string, start, end int) (io.ReadCloser, error)

func (*Bix) Close

func (b *Bix) Close() error

func (*Bix) FastQuery

func (tbx *Bix) FastQuery(region interfaces.IPosition) (interfaces.RelatableIterator, error)

FastQuery allows extracting intervals from an indexed file. Use this function if concurrency is *not* required, otherwise use Query

func (*Bix) GetHeaderDescription

func (tbx *Bix) GetHeaderDescription(field string) string

func (*Bix) GetHeaderNumber

func (tbx *Bix) GetHeaderNumber(field string) string

func (*Bix) GetHeaderType

func (tbx *Bix) GetHeaderType(field string) string

func (*Bix) Query

func (tbx *Bix) Query(region interfaces.IPosition) (interfaces.RelatableIterator, error)

Query allows extracting intervals from an indexed file. Use this function if concurrency is required, otherwise use FastQuery

type Index

type Index interface {
	Chunks(string, int, int) ([]bgzf.Chunk, error)
	NameColumn() int
	BeginColumn() int
	EndColumn() int
	ZeroBased() bool
	MetaChar() rune
	Skip() int
}

Index unifies CSI and tabix.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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