interfaces

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2018 License: MIT Imports: 1 Imported by: 38

Documentation

Overview

interfaces for genomic relations irelate operates on "Relatable"s which keep a slice of related intervals.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OverlapsPosition

func OverlapsPosition(a, b IPosition) bool

SamePosition tests if 2 IPositions overlap

func Same

func Same(a, b IPosition, strict bool) bool

Same tests the identity of 2 IPositions and attempts to cast to IRefAlts for more stringent checking.

func SameChrom

func SameChrom(a, b string) bool

SameChrom returns true if the strings are the same chromosome. Adjust for "chr" prefix.

func SamePosition

func SamePosition(a, b IPosition) bool

SamePosition tests if 2 IPositions are the same

func SameVariant

func SameVariant(a, b IRefAlt) bool

SameVariant tests if 2 IRefAlts share the same position and ref and alt.

func StripChr

func StripChr(c string) string

StripChr removes the "chr" prefix if it is present

Types

type CIFace

type CIFace interface {
	CIPos() (uint32, uint32, bool)
	CIEnd() (uint32, uint32, bool)
}

Interface to get the CIPos and CIEND from a VCF. Returns start, end, ok.

type IPosition

type IPosition interface {
	Chrom() string
	Start() uint32
	End() uint32
}

IPosition allows accessing positional interface for genomic types.

func AsIPosition

func AsIPosition(chrom string, start int, end int) IPosition

AsIPosition take chrom, start, end and returns an struct that meets the IPosition interface

type IRefAlt

type IRefAlt interface {
	IPosition
	Ref() string
	Alt() []string
}

IRefAlt will force matching on the Ref and Alt fields when they are present.

type IVariant

type IVariant interface {
	IRefAlt
	CIFace
	Info() Info
	Id() string
	String() string
}

IVariant must implement IPosition, Ref, Alt, and Info() methods for genetic variants

type Info

type Info interface {
	Get(key string) (interface{}, error)
	Set(key string, val interface{}) error
	Delete(key string)
	Keys() []string
	String() string
	Bytes() []byte
}

Info must implement stuff to get info out of a variant info field.

type PosWrap

type PosWrap struct {
	SIPosition
	*RelWrap
}

type Queryable

type Queryable interface {
	Query(region IPosition) (RelatableIterator, error)
}

Queryable allows querying by genomic position. Anything that meets this interface can be used in irelate.

type RAWrap

type RAWrap struct {
	IRefAlt
	*RelWrap
}

type RelWrap

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

trun an IPosition into an IRelatalbe

func (*RelWrap) AddRelated

func (w *RelWrap) AddRelated(r Relatable)

func (*RelWrap) Related

func (w *RelWrap) Related() []Relatable

func (*RelWrap) SetSource

func (w *RelWrap) SetSource(s uint32)

func (*RelWrap) Source

func (w *RelWrap) Source() uint32

type Relatable

type Relatable interface {
	IPosition
	Related() []Relatable // A slice of related Relatable's filled by IRelate
	AddRelated(Relatable) // Adds to the slice of relatables
	Source() uint32
	SetSource(source uint32)
}

Relatable provides all the methods for irelate to function. See Interval in parsers/interval.go for a class that satisfies this interface. Related() likely returns and AddRelated() likely appends to a slice of relatables. Note that for performance reasons, Relatable should be implemented as a pointer to your data-structure (see Interval).

func AsRelatable

func AsRelatable(p SIPosition) Relatable

turn a position thingy into a Relatable

type RelatableChannel

type RelatableChannel chan Relatable

RelatableChannel

type RelatableIterator

type RelatableIterator interface {
	Next() (Relatable, error)
	Close() error
}

RelatableIterator provides a method to iterate over Relatables

type SIPosition

type SIPosition interface {
	IPosition
	String() string
}

type VarWrap

type VarWrap struct {
	IVariant
	*RelWrap
}

Jump to

Keyboard shortcuts

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