bed

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Handles bed file representation and parsing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bed

type Bed struct {
	Chr   string
	Start int
	End   int
}

A simple genomic region notation.

func Parse

func Parse(s string) (*Bed, []string, error)

Parses a single bed line. Keeps chromosome, start and end in the bed object. All other fields are returned in a string array. Returns a non-nil error if couldn't parse.

func (*Bed) String

func (b *Bed) String() string

Returns a string representation of the bed entry. Mainly for debugging.

type Scanner

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

Scans bed entries from a stream. Ignores header if exists.

func NewScanner

func NewScanner(r io.Reader) *Scanner

Returns a new scanner that reads from the given stream.

func (*Scanner) Bed

func (s *Scanner) Bed() *Bed

Returns the last entry parsed by Scan().

func (*Scanner) Err

func (s *Scanner) Err() error

Last error that was encountered.

func (*Scanner) Fields

func (s *Scanner) Fields() []string

Returns the rest of the fields after the mandatory bed fields.

func (*Scanner) Scan

func (s *Scanner) Scan() bool

Scans the next line from a bed file. The parsed object can be retreived by calling Bed(). Returns true if and only if a line was successfully parsed. After returning false, the Err() method will return the relevant error, except in EOF where the error will be nil.

func (*Scanner) Text

func (s *Scanner) Text() string

Returns the parsed line as is.

Directories

Path Synopsis
Handles bed-graph file representation and parsing.
Handles bed-graph file representation and parsing.

Jump to

Keyboard shortcuts

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