align

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2018 License: GPL-2.0 Imports: 10 Imported by: 8

Documentation

Index

Constants

View Source
const (
	AMINOACIDS = 0 // Amino acid sequence alphabet
	NUCLEOTIDS = 1 // Nucleotid sequence alphabet
	UNKNOWN    = 2 // Unkown alphabet

	GAP   = '-'
	POINT = '.'
	OTHER = '*'

	PSSM_NORM_NONE = 0 // No normalization
	PSSM_NORM_FREQ = 1 // Normalization by freq in the site
	PSSM_NORM_DATA = 2 // Normalization by aa/nt frequency in data
	PSSM_NORM_UNIF = 3 // Normalization by uniform frequency

	FORMAT_FASTA  = 0
	FORMAT_PHYLIP = 1
	FORMAT_NEXUS  = 2
)

Variables

This section is empty.

Functions

func AlphabetFromString added in v0.2.3

func AlphabetFromString(alphabet string) int

func DetectAlphabet

func DetectAlphabet(seq string) int

func NewAlign

func NewAlign(alphabet int) *align

func NewSequence

func NewSequence(name string, sequence []rune, comment string) *seq

func RandomSequence added in v0.1.3

func RandomSequence(alphabet, length int) ([]rune, error)

Types

type AlignChannel added in v0.2.4

type AlignChannel struct {
	Achan chan Alignment
	Err   error
}

type Alignment

type Alignment interface {
	AddSequence(name string, sequence string, comment string) error
	AddSequenceChar(name string, sequence []rune, comment string) error
	GetSequence(name string) (string, bool)
	GetSequenceById(ith int) (string, bool)
	GetSequenceChar(name string) ([]rune, bool)
	GetSequenceCharById(ith int) ([]rune, bool)
	GetSequenceNameById(ith int) (string, bool)
	SetSequenceChar(ithAlign, ithSite int, char rune) error
	Iterate(it func(name string, sequence string))
	IterateChar(it func(name string, sequence []rune))
	IterateAll(it func(name string, sequence []rune, comment string))
	NbSequences() int
	NbVariableSites() int
	Length() int
	Mutate(rate float64) // Adds uniform substitutions in the alignment (~sequencing errors)
	ShuffleSequences()
	ShuffleSites(rate float64, roguerate float64, randroguefirst bool) []string
	SimulateRogue(prop float64, proplen float64) ([]string, []string)
	Sort()                         // Sorts the alignment by sequence name
	RemoveGapSites(cutoff float64) // Removes sites having >= cutoff gaps
	RemoveGapSeqs(cutoff float64)  // Removes sequences having >= cutoff gaps
	Sample(nb int) (Alignment, error)
	Rarefy(nb int, counts map[string]int) (Alignment, error) // Take a new rarefied sample taking into accounts weights
	BuildBootstrap() Alignment
	Entropy(site int, removegaps bool) (float64, error) // Entropy of the given site
	Swap(rate float64)
	Concat(Alignment) error // concatenates the given alignment with this alignment
	Recombine(rate float64, lenprop float64)
	AddGaps(rate, lenprop float64)
	Rename(namemap map[string]string)
	Pssm(log bool, pseudocount float64, normalization int) (pssm map[rune][]float64, err error) // Normalization: PSSM_NORM_NONE, PSSM_NORM_UNIF, PSSM_NORM_DATA
	TrimNames(size int) (map[string]string, error)
	TrimNamesAuto() (map[string]string, error)
	CleanNames() // Removes spaces and tabs at beginning and end of sequence names and replaces others by "_"
	TrimSequences(trimsize int, fromStart bool) error
	AppendSeqIdentifier(identifier string, right bool)
	AvgAllelesPerSite() float64
	CharStats() map[rune]int64
	Alphabet() int
	AlphabetCharacters() []rune
	SubAlign(start, length int) (Alignment, error) // Extract a subalignment from this alignment
	RandSubAlign(length int) (Alignment, error)    // Extract a random subalignment with given length from this alignment
	Clone() (Alignment, error)
}

func RandomAlignment added in v0.1.3

func RandomAlignment(alphabet, length, nbseq int) (Alignment, error)

type Sequence

type Sequence interface {
	Sequence() string
	SequenceChar() []rune
	Name() string
	Comment() string
}

Jump to

Keyboard shortcuts

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