bcf

package module
v0.0.0-...-982d4bf Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2016 License: MIT Imports: 9 Imported by: 0

README

bcf

Build Status ![GoDoc] (https://godoc.org/github.com/brentp/bcf?status.png)

bcf is a bcf parser for the go programming language.

import "github.com/brentp/bcf"

func main() {
    rdr, _ := os.Open("some.bcf")
    brdr, _ := bcf.NewReader(rdr, 2)
    for {
        variant, err := brdr.Read()
        if err == io.EOF {
            break
        }
        fmt.Println(variant.Chrom, variant.Id, variant.Pos)
    }
}

TODO

The library is currently working, but some things remain to be done:

  • parse header into proper structure
  • fix parsing of FILTER
  • finalize parsing of FORMAT fields. This is done, but we don't currently replace the missing tokens with NaN or whatever is appropriate.
  • benchmark the current INFO and FORMAT parsing (which is lazy) that saves a slice (3 uint32's) to the underlying data to compare to just saving the offsets and having each entry in the INFO pull from the same underlying slice.
  • docs

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BCF

type BCF struct {
	Header Header
	// contains filtered or unexported fields
}

BCF contains the methods for reading a BCF

func NewReader

func NewReader(r io.Reader, rd int) (*BCF, error)

NewReader returns a BCF reader with the number of decompression threads.

func (*BCF) Read

func (b *BCF) Read() (*Variant, error)

Read returns the next variant.

type Format

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

Format contains the BCF format/sample entries.

type Header struct {
	Text    []byte
	Entries []HeaderEntry
	// contains filtered or unexported fields
}

Header contains the type info about the BCF

type HeaderEntry

type HeaderEntry struct {
	Id          string
	Description string
	Number      string // A G R . ”
	Type        string // STRING INTEGER FLOAT FLAG CHARACTER UNKONWN
	// contains filtered or unexported fields
}

HeaderEntry holds the header Info and Format fields

type HeaderError

type HeaderError struct {
	Line int
	Msg  string
}

func (HeaderError) Error

func (h HeaderError) Error() string

type Info

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

Info contains the entries from the INFO field for a given Record

func (Info) Get

func (f Info) Get(key string) interface{}

Get the value assocated with key from the INFO field

type Variant

type Variant struct {
	Chrom   uint32 // CHROM
	Pos     uint32
	Alleles [][]byte

	Id   []byte
	Qual float32
	// contains filtered or unexported fields
}

Variant represents a single variant object from the BCF.

func (*Variant) Info

func (v *Variant) Info() *Info

Info returns the struct containing the INFO fields.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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