nexus

package
v6.1.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2018 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alignment

type Alignment []string

Alignment is a collection of equal length sequences

func (Alignment) Column

func (aln Alignment) Column(p uint) []byte

Column is the letters from each internal sequence at position p

func (Alignment) Count

func (aln Alignment) Count(bases []byte) map[byte]int

Count returns the number of times each base in a set is found

func (Alignment) Frequency

func (aln Alignment) Frequency(bases []byte) map[byte]float64

Frequency returns the normalized frequency of each base in a set Note that bases that exist in the Alignment, but not in the set are ignored

func (Alignment) Len

func (aln Alignment) Len() (length int)

Len is the length of the alignment Note that len(alignment) != alignment.Len(), the former equals alignment.NSeq()

func (Alignment) NSeq

func (aln Alignment) NSeq() uint

NSeq is the number of sequences in the alignment Note: len(alignment) == alignment.NSeq()

func (Alignment) Seq

func (aln Alignment) Seq(i uint) string

Seq returns the i-th sequence in the alignment

func (Alignment) String

func (aln Alignment) String() string

String is al sequences with a newline after each sequence

func (Alignment) Subseq

func (aln Alignment) Subseq(s, e int) Alignment

Subseq creates a slice from the original alignment An argument out of bounds is interpreted as ultimate start or end of alignment, relatively

type Nexus

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

Nexus only understands two blocks: DATA and SETS Note: meant for exclusive use in swsc

func New

func New() *Nexus

New creates a new empty Nexus with registered handlers and deferred block creation

func Read

func Read(file io.Reader) *Nexus

Read reads a Nexus file from a reader returning the filled Nexus

func (*Nexus) Alignment

func (nex *Nexus) Alignment() Alignment

Alignment returns a copy of the internal alignment

func (*Nexus) Charsets

func (nex *Nexus) Charsets() map[string][]Pair

Charsets returns a copy of the internal character sets

func (*Nexus) DataType

func (nex *Nexus) DataType() string

DataType is the type of data (e.g. DNA, RNA, Nucleotide, Protein)

func (*Nexus) FillFrom

func (nex *Nexus) FillFrom(file io.Reader)

FillFrom fills in the Nexus with data from a file It overwrites existing values, but does not clear all values

func (*Nexus) Gap

func (nex *Nexus) Gap() byte

Gap is the character used to represent a gap

func (*Nexus) Letters

func (nex *Nexus) Letters() []byte

Letters is the known (capital) characters allowed by DataType Missing and Gap characters are NOT appended.

func (*Nexus) Missing

func (nex *Nexus) Missing() byte

Missing is the character used to represent a missing element

func (*Nexus) NChar

func (nex *Nexus) NChar() int

NChar is the number of characters

func (*Nexus) NTax

func (nex *Nexus) NTax() int

NTax is the number of taxa

type Pair

type Pair [2]int

Pair is a pair of integer values (typically represents a range)

func NewPair

func NewPair(start, stop int) Pair

NewPair enforces that start is less than stop

func (*Pair) First

func (p *Pair) First() int

First is the first value of the Pair

func (*Pair) Second

func (p *Pair) Second() int

Second is the second value of the Pair

Jump to

Keyboard shortcuts

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