LBPFunctions

package
v0.0.0-...-d914eef Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SeqColToDense

func SeqColToDense(sc SequenceCollection) *Dense

func TruncatedSVD

func TruncatedSVD(data Matrix, k int) *Dense

Types

type ReducedSequence

type ReducedSequence struct {
	Header string    //contig id from fasta file
	Hist   []float64 // Un-normalized LBP histogram
	Svd    []float64 // SVD reduced dimension vector
	Kmers  string
}

func NewReducedSequence

func NewReducedSequence() *ReducedSequence

type Sequence

type Sequence struct {
	Header   string    //contig id from fasta file
	Seq      string    // contig sequence
	NRep     []float64 // numerical representation of sequence (Integer representation)
	LbpCodes []float64 //  lbp intermediate slice
	Hist     []float64 // Un-normalized LBP histogram
	Kmers    string
}

func NewSequence

func NewSequence() *Sequence

Create a new sequence. All slices are instantiated as nil slices and speciesID is default zero.

func ReadFasta

func ReadFasta(fname string) []Sequence

Read in a fasta file saving each sequence and header to a unique Sequence type. Store sequences in a slice https://www.socketloop.com/tutorials/golang-bufio-newreader-readline-to-read-file-line-by-line

func (*Sequence) FindLBP

func (seq *Sequence) FindLBP(wind int)

Threshold using signbit function and sliding window of size wind. Wind should be odd and > 0.

func (*Sequence) IntRep

func (seq *Sequence) IntRep()

Create integer representation for a sequence

func (*Sequence) NewHistogram

func (seq *Sequence) NewHistogram(wind int) []float64

Calculate the LBP histogram

type SequenceCollection

type SequenceCollection struct {
	sync.RWMutex
	Items []ReducedSequence
}

http://dnaeon.github.io/concurrent-maps-and-slices-in-go/

func (*SequenceCollection) AddSVD

func (sc *SequenceCollection) AddSVD(svd *Dense)

func (*SequenceCollection) Append

func (cs *SequenceCollection) Append(item ReducedSequence)

func (*SequenceCollection) ToCSV

func (sc *SequenceCollection) ToCSV(fname string)

func (*SequenceCollection) ToParquet

func (sc *SequenceCollection) ToParquet(fname string)

Write results to parquet file. This is the recommended output format.

Jump to

Keyboard shortcuts

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