emdepth

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2020 License: MIT Imports: 4 Imported by: 0

README

![GoDoc] (https://godoc.org/github.com/brentp/goleft/emdepth?status.png)

emdepth

-- import "github.com/brentp/goleft/emdepth"

emdepth uses a simplified EM algorithm to assign copy-number given a set of depths. it is based off the implementation in cn.mops. Like cn.mops, it works best with more samples and it assumes that most samples will have copy-number 2. emdepth consists of a single function EMDepth that iteratively assigns depths to copy-numbers, adjusts the center of each copy-number bin. and re-assigns... This package does no normalization and therefore expects incoming data to be normalized.

Documentation

Overview

Package emdepth uses a simplified EM algorithm to assign copy-number given a set of depths. it is based off the implementation in cn.mops. Like cn.mops, it works best with more samples and it assumes that most samples will have copy-number 2. emdepth consists of a single function EMDepth that iteratively assigns depths to copy-numbers, adjusts the center of each copy-number bin. and re-assigns... This package does no normalization and therefore expects incoming data to be normalized.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CNV

type CNV struct {
	SampleI  int
	Depth    []float32
	Position []Position
	Log2FC   []float32
	CN       []int
	PSize    int
}

CNV holds the information for a CNV for a single sample.

func (*CNV) String added in v0.1.14

func (c *CNV) String() string

type Cache

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

Cache is a way to track depth states.eps As new items are added to the cache, the value from EMD.Same is compared. Each time an EMD is added, a slice of Regions that have ended is returned.

func (*Cache) Add

func (c *Cache) Add(e *EMD) []*CNV

func (*Cache) Clear

func (c *Cache) Clear(p *Position) []*CNV

type EMD

type EMD struct {
	Lambda   []float64
	Depths   []float32
	Position Position
	// contains filtered or unexported fields
}

EMD holds the posterior maximum depth for each copy-number

func EMDepth

func EMDepth(depths []float32, p Position) *EMD

EMDepth returns a slice of integer copy-numbers (CNs) corresponding to the given normalized depths. It uses a simple EM to assign depths to copy-numbers bins with a preference for CN 2. And to adjust the mean depth of each bin after each iteration. I is a unique identifier for the depths that can be use to assiciate the returned struct with position info.

func (*EMD) CN

func (e *EMD) CN() []int

CN finds the posterior maximum CN for each sample.

func (*EMD) Log2FC

func (e *EMD) Log2FC() []float64

Log2FC is the fold-change relative to copy-number 2.

func (*EMD) Same

func (e *EMD) Same(o *EMD) (non2 []int, changed []int, pct float64)

func (*EMD) Type

func (e *EMD) Type(d float32) int

Type returns the copy-number for the given depth

type Position

type Position struct {
	Start uint32
	End   uint32
}

func (*Position) String added in v0.1.14

func (p *Position) String() string

Directories

Path Synopsis
Package mops implements the EM algorithm described in the cn.mops paper.
Package mops implements the EM algorithm described in the cn.mops paper.

Jump to

Keyboard shortcuts

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