annotation

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2019 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckBytes

func CheckBytes(b *bufio.Reader, buf []byte) (bool, error)

CheckBytes peeks at a buffered stream and checks if the first read bytes match.

func QueryIndex

func QueryIndex(index *rtreego.Rtree, begin, end float64) []rtreego.Spatial

QueryIndex perform a SearchIntersect on the specified index given a start and end position.

func QueryIndexByElement

func QueryIndexByElement(index *rtreego.Rtree, begin, end float64, element string) []rtreego.Spatial

QueryIndexByElement perform a SearchIntersect on the specified index given a start and end position and an element.

Types

type Feature

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

Feature represents an annotated element.

func NewFeature

func NewFeature(chr []byte, element []byte, rect *rtreego.Rect) *Feature

NewFeature returns a new instance of a Feature

func (*Feature) Bounds

func (f *Feature) Bounds() *rtreego.Rect

Bounds returns the location of the feature. It is used within the Rtree.

func (*Feature) Chr

func (f *Feature) Chr() string

Chr returns the chromosome of the feature

func (*Feature) Clone

func (f *Feature) Clone() *Feature

Clone returns a clone of f

func (*Feature) Element

func (f *Feature) Element() string

Element returns the element of the feature

func (*Feature) End

func (f *Feature) End() float64

End returns the end position of the feature

func (*Feature) Out

func (f *Feature) Out() string

Out returns the string representation of a Feature

func (*Feature) SetBounds

func (f *Feature) SetBounds(newLocation *rtreego.Rect)

SetBounds set a new location of the feature

func (*Feature) SetTags

func (f *Feature) SetTags(tags map[string][]byte)

SetTags set feture tags

func (*Feature) Start

func (f *Feature) Start() float64

Start returns the start position of the feature

func (*Feature) String

func (f *Feature) String() string

String returns the string representation of a Feature

func (*Feature) Tag

func (f *Feature) Tag(key string) string

Tag get a tag value from f

type FeatureReader

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

FeatureReader is a struct for readinf features

func NewFeatureReader

func NewFeatureReader(r io.Reader, chrs map[string]int) *FeatureReader

NewFeatureReader returns a new instance of FeatureReader

func (*FeatureReader) Read

func (r *FeatureReader) Read() (f *Feature, err error)

type FeatureSlice

type FeatureSlice []*Feature

FeatureSlice represents a slice of Feature, sortable by start position

func NewFeatureSlice

func NewFeatureSlice(intervals []rtreego.Spatial) FeatureSlice

NewFeatureSlice returns a new FeatureSlice instance from a slice of rtreego.Spatial

func (FeatureSlice) Len

func (s FeatureSlice) Len() int

func (FeatureSlice) Less

func (s FeatureSlice) Less(i, j int) bool

func (FeatureSlice) Swap

func (s FeatureSlice) Swap(i, j int)

type Format

type Format int

Format type

const (
	UNDEF Format = iota - 1
	BED
	GTF
)

exported formats

func (Format) String

func (f Format) String() string

String return the string representation of a Format

type Location

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

Location represents a genomic region

func NewLocation

func NewLocation(chrom string, start, end int) *Location

NewLocation returns a new Location instance

func (*Location) Chrom

func (loc *Location) Chrom() string

Chrom returns the location chromosome

func (*Location) End

func (loc *Location) End() float64

End returns the location end position

func (*Location) GetElements

func (loc *Location) GetElements(buf []rtreego.Spatial, elems map[string]uint8, tags ...string)

GetElements returns all elements overlapping with buf

func (*Location) Start

func (loc *Location) Start() float64

Start returns the locations start position

func (*Location) String

func (loc *Location) String() string

type RtreeMap

type RtreeMap map[string]*rtreego.Rtree

RtreeMap is a map of pointers to Rtree with string keys. type RtreeMap map[string]*rtreego.Rtree

func CreateIndex

func CreateIndex(annoFile string, chrLens map[string]int) *RtreeMap

CreateIndex creates the Rtree indices for the specified annotation file. It builds a Rtree for each chromosome and returns a RtreeMap having the chromosome names as keys.

func (RtreeMap) Get

func (t RtreeMap) Get(chr string) *rtreego.Rtree

Get returns the pointer to an Rtree for the specified chromosome and create a new Rtree if not present.

func (RtreeMap) Len

func (t RtreeMap) Len() int

Len returns the number of elements in the map.

type Scanner

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

Scanner represent a scanner of features

func NewScanner

func NewScanner(r io.Reader, chrs map[string]int) *Scanner

NewScanner returns a new instance of a Scanner

func (*Scanner) Error

func (s *Scanner) Error() error

Error returns the first non-EOF error that was encountered by the Scanner.

func (*Scanner) Feat

func (s *Scanner) Feat() *Feature

Feat returns the current read feature

func (*Scanner) Next

func (s *Scanner) Next() bool

Next reads the next feature

Jump to

Keyboard shortcuts

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