bedgraph

package
v0.1.2 Latest Latest
Warning

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

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

Documentation

Overview

Handles bed-graph file representation and parsing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BedGraph

type BedGraph struct {
	Chr   string
	Start int
	End   int
	Value float64
}

A simple genomic region notation.

func Parse

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

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

func (*BedGraph) String

func (b *BedGraph) String() string

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

type Scanner

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

Scans bed-graph 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() *BedGraph

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-graph fields.

func (*Scanner) Scan

func (s *Scanner) Scan() bool

Scans the next line from a bed-graph file. The parsed object can be retreived by calling BedGraph(). 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.

Jump to

Keyboard shortcuts

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