Version: v0.1.17 Latest Latest

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

Go to latest
Published: Nov 18, 2021 License: MIT Imports: 6 Imported by: 0



Package bed parses BED files.

This package uses the format described in:


Currently only tab delimiters are supported.

Currently BED headers are not supported.



View Source
const (
	PlusStrand  = "+"
	MinusStrand = "-"
	NoStrand    = "."

Valid values for the strand field.


This section is empty.


This section is empty.


type BED added in v0.1.2

type BED struct {
	Chrom       string
	ChromStart  int // 0-based
	ChromEnd    int // 0-based exclusive
	Name        string
	Score       int
	Strand      string
	ThickStart  int
	ThickEnd    int
	ItemRGB     [3]byte
	BlockCount  int
	BlockSizes  []int // Length should match BlockCount
	BlockStarts []int // Length should match BlockCount

BED is a single line in a BED file.

func (*BED) Text added in v0.1.10

func (b *BED) Text(n int) []byte

Text returns the textual representation of b in BED format. Encodes the first n fields, where n is between 3 and 12. Includes a trailing new line.

type Reader added in v0.1.3

type Reader struct {
	// contains filtered or unexported fields

A Reader reads and parses BED lines.

func NewReader added in v0.1.3

func NewReader(r io.Reader) *Reader

NewReader returns a new BED reader that reads from r.

func (*Reader) Read added in v0.1.10

func (r *Reader) Read() (b *BED, n int, err error)

Read returns the next BED line, and n as the number of fields that were found. The first n fields will be populated in the result BED, the rest will have zero values. n is always between 3 and 12.

For example if n=5, then the populated fields are Chrom, ChromStart, ChromEnd, Name and Score.

Source Files

Jump to

Keyboard shortcuts

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