sequence

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2019 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package sequence defines the abstract interface for a biological sequence.

Index

Constants

View Source
const TestableLength uint = 1000

TestableLength is a realistic, testable length for generating random sequences in tests

Variables

This section is empty.

Functions

func LetterCount

func LetterCount(s Interface) map[string]uint

LetterCount iterates over a sequence.Interface and counts how many times each letter has been seen.

func TestAlphabetIs

func TestAlphabetIs(s interface{}, exp interface{}) func(t *testing.T)

TestAlphabetIs is a test helper that wraps a check for expected alphabet

func TestLengthIs

func TestLengthIs(s Interface, exp uint) func(t *testing.T)

TestLengthIs is a test helper that wraps a check for known length

func TestPositionIs

func TestPositionIs(s Interface, p uint, exp string) func(t *testing.T)

TestPositionIs is a test helper that wraps a check for known position

func TestRangeIs

func TestRangeIs(s Interface, st, sp uint, exp string) func(t *testing.T)

TestRangeIs is a test helper that wraps a check for known range

Types

type Alphabeter

type Alphabeter interface {
	Alphabet() alphabet.Interface
}

Alphabeter s you what alphabet.Interface it uses

type Complementer

type Complementer interface {
	Complement() (Interface, error)
}

Complementer can complement the sequence

type Generator

type Generator func(string) (Interface, error)

Generator is any func that can create a sequence from its string

type Interface

type Interface interface {
	// Length is the number of elements in the Interface
	Length() uint

	// Position is the n-th element
	Position(n uint) (string, error)

	// Range returns elements from start (inclusive) to stop (exclusive)
	Range(start, stop uint) (string, error)
}

Interface is the basic functionality of any biological sequence (DNA, RNA, Protein, or other)

type LetterCounter

type LetterCounter interface {
	LetterCount() map[string]uint
}

LetterCounter counts the letters observed when reading the sequence

type RevComper

type RevComper interface {
	RevComp() (Interface, error)
}

RevComper can reverse-complement the sequence

type Reverser

type Reverser interface {
	Reverse() (Interface, error)
}

Reverser can reverse the sequence

type Transcriber

type Transcriber interface {
	Transcribe() (Interface, error)
}

Transcriber can transcribe the sequence

type Translater

type Translater interface {
	Translate(codon.Interface, byte) (Interface, error)
}

Translater can translate the sequence

type ValFunc

type ValFunc func(Interface) error

ValFunc is a function that validates a sequence

func AlphabetIs

func AlphabetIs(a alphabet.Interface) ValFunc

AlphabetIs specifies whether a sequence conforms to a given Alphabet

type Validator

type Validator interface {
	Validate() error
}

Validator provides a variadic method to validate the sequence

Directories

Path Synopsis
Package immutable is an implementation of biological sequences that have immutability.
Package immutable is an implementation of biological sequences that have immutability.
Package mutable is an implementation of biological sequences that mutate internally.
Package mutable is an implementation of biological sequences that mutate internally.

Jump to

Keyboard shortcuts

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