code

package
v0.0.0-...-549aca6 Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package code describes biological sequence letters coded by bytes and sometimes encoded into hash int64s

Index

Constants

This section is empty.

Variables

View Source
var DnaArray []Dna = []Dna{A, C, G, T, N, MaskA, MaskC, MaskG, MaskT, MaskN, Gap}
View Source
var NoMaskDnaArray []Dna = []Dna{A, C, G, T, N}

Functions

func CountDnaBytes

func CountDnaBytes(seq []Dna, b Dna) int

CountBase returns the number of the designated base present in the input sequence.

func CountInterval

func CountInterval(seq []Dna, b Dna, start int, end int) int

CountBaseInterval returns the number of the designated base present in the input range of the sequence.

func DnaToByte

func DnaToByte(b Dna) byte

func DnaToByteNoMask

func DnaToByteNoMask(b Dna) byte

func ReverseComplement

func ReverseComplement(rc []Dna)

ReverseComplement reverses a sequence of bases and complements each base. Used to switch strands and maintain 5' -> 3' orientation.

func ToBytes

func ToBytes(bases []Dna) []byte

func ToString

func ToString(bases []Dna) string

Types

type Dna

type Dna byte
const (
	A     Dna = 'A'
	C     Dna = 'C'
	G     Dna = 'G'
	T     Dna = 'T'
	N     Dna = 'N'
	MaskA Dna = 'a'
	MaskC Dna = 'c'
	MaskG Dna = 'g'
	MaskT Dna = 't'
	MaskN Dna = 'n'
	Gap   Dna = '-'
)

func ByteToDna

func ByteToDna(b byte) Dna

func ByteToDnaNoMask

func ByteToDnaNoMask(b byte) Dna

ByteToDna converts a byte into a dna.Base if it matches one of the acceptable DNA characters. Notes: It will also mask the lower case values and return dna.Base as uppercase bases. Note: '*', used by VCF to denote deleted alleles, becomes a Gap in DNA.

func ComplementDna

func ComplementDna(b Dna) Dna

ComplementSingleBase returns the nucleotide complementary to the input base.

func ToDna

func ToDna(b []byte) []Dna

ToDna will convert a slice of bytes into a slice of Bases with no Maskcase bases.

type Slice

type Slice interface {
	Make(len, cap int) Slice
	Len() int
	Cap() int
	Slice(start, end int) Slice
	Append(src Slice) Slice
	Copy(src Slice) int
}

The Slice interface reflects the built-in slice type behavior.

Jump to

Keyboard shortcuts

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