hic

package
Version: v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2021 License: GPL-2.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MAGIC = "HIC"
)
View Source
const (
	MaxCells = 25000000 //5000*5000

)

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	NPositions int32
	XOffset    int32
	YOffset    int32
	Mat        *mat64.Dense //using dense now. todo sparse later.
}

func (*Block) At

func (b *Block) At(i int, j int) float64

func (*Block) Dims

func (b *Block) Dims() (int, int)

func (*Block) FreeMem

func (b *Block) FreeMem()

func (*Block) String

func (b *Block) String() string

func (*Block) T

func (b *Block) T() mat64.Matrix

func (*Block) View

func (b *Block) View(i int, j int, r int, c int) mat64.Matrix

type BlockIndex

type BlockIndex struct {
	Id       int32
	Position int64
	Size     int32
}

type BlockMatrix

type BlockMatrix struct {
	Unit      string
	ResIdx    int32
	SumCounts float32

	BinSize          int32
	BlockBinCount    int32
	BlockColumnCount int32
	BlockCount       int32
	BlockIndexes     map[int]BlockIndex
	// contains filtered or unexported fields
}

BlockMatrix : implement mat64.Matrix interface

func (*BlockMatrix) At

func (b *BlockMatrix) At(i int, j int) float64

func (*BlockMatrix) BufferSize

func (b *BlockMatrix) BufferSize() uintptr

func (*BlockMatrix) Dims

func (b *BlockMatrix) Dims() (int, int)

func (*BlockMatrix) Matrix

func (b *BlockMatrix) Matrix() mat64.Matrix

func (*BlockMatrix) SetUseBuffer

func (b *BlockMatrix) SetUseBuffer(a bool)

func (*BlockMatrix) String

func (b *BlockMatrix) String() string

func (*BlockMatrix) View

func (b *BlockMatrix) View(i int, j int, r int, c int) mat64.Matrix

type Body

type Body struct {
	Chr1Idx int32
	Chr2Idx int32
	NRes    int32
	Mats    []BlockMatrix //map resolution to blockmatrix
}

func (*Body) String

func (b *Body) String() string

type Chr

type Chr struct {
	Name   string
	Length int32
}

type ExpectedValueFunc

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

func NewExpectedValueFunc

func NewExpectedValueFunc(normType int, unit int, binSize int, expectedValues []float64, normFactors map[int32]float64) *ExpectedValueFunc

func (*ExpectedValueFunc) BinSize

func (e *ExpectedValueFunc) BinSize() int

func (*ExpectedValueFunc) ExpectedValue

func (e *ExpectedValueFunc) ExpectedValue(chrIdx int32, distance int) float64

ExpectedValue: get the expected value for {chromsome, distance}

func (*ExpectedValueFunc) ExpectedValues

func (e *ExpectedValueFunc) ExpectedValues() []float64

func (*ExpectedValueFunc) Key

func (e *ExpectedValueFunc) Key() string

func (*ExpectedValueFunc) Length

func (e *ExpectedValueFunc) Length() int

func (*ExpectedValueFunc) NormFactors

func (e *ExpectedValueFunc) NormFactors() map[int32]float64

func (*ExpectedValueFunc) NormTypeString

func (e *ExpectedValueFunc) NormTypeString() string

func (*ExpectedValueFunc) Text

func (e *ExpectedValueFunc) Text() string

Text: output detail string

func (*ExpectedValueFunc) Unit

func (e *ExpectedValueFunc) Unit() int
type Footer struct {
	NBytes           int32
	NEntrys          int32
	Entry            map[string]Index
	ExpectedValueMap map[string]*ExpectedValueFunc //expected value map string format: unitIdx + "_" + binsize + "_" + normTypeIdx
	NormVector       map[string]*NormVector
	NormTypes        map[int]bool
	Units            map[int]bool
}

func (*Footer) NormTypeIdx

func (f *Footer) NormTypeIdx() []int

NormTypeIdx: get all normalization types indexes

func (*Footer) NormTypeStrings

func (f *Footer) NormTypeStrings() []string

NormTypeStrings: get all norm type strings

func (*Footer) NormTypeStrs

func (f *Footer) NormTypeStrs() []string

NormTypeStrs: get all norm type short strings

func (*Footer) String

func (f *Footer) String() string

type HiC

type HiC struct {
	Reader io.ReadSeeker

	Version int32

	Genome   string
	NAttr    int32
	Attr     map[string]string
	NChrs    int32
	Chr      []Chr
	NBpRes   int32
	BpRes    []int32
	NFragRes int32
	FragRes  []int32
	Footer   Footer
	// contains filtered or unexported fields
}

func DataReader

func DataReader(buf io.ReadSeeker) (*HiC, error)

func DataReaderLowMem

func DataReaderLowMem(buf io.ReadSeeker) (*HiC, error)

func NewHiC

func NewHiC(useBuffer bool) HiC

func (*HiC) Corrected

func (hic *HiC) Corrected(s int, e int, resIdx int) (int, int)

Corrected: get correted bed position

func (*HiC) Entrys

func (e *HiC) Entrys() []string

Entrys list of chr_chr entrys in hic file

func (*HiC) GetResIdx

func (e *HiC) GetResIdx(length int, width int) int

GetResIdx : Calculate the resolution index based on the width of panel and the length of query region

func (*HiC) LoadBodyIndex

func (e *HiC) LoadBodyIndex(key string) (*Body, error)

func (*HiC) LoadIndex

func (e *HiC) LoadIndex(r io.Reader)

LoadIndex : TODO

func (*HiC) Lock

func (e *HiC) Lock()

func (*HiC) QueryOE

func (e *HiC) QueryOE(chr string, start int, end int, normtype int, unit int, resIdx int) (mat64.Matrix, error)

func (*HiC) QueryOE2

func (e *HiC) QueryOE2(chr string, start int, end int, chr2 string, start2 int, end2 int, normtype int, unit int, resIdx int) (mat64.Matrix, error)

func (*HiC) QueryOne

func (e *HiC) QueryOne(chrom string, start int, end int, width int) (mat64.Matrix, error)

QueryOne : get one matrix diag square submatrix

func (*HiC) QueryOneNormMat

func (e *HiC) QueryOneNormMat(chr string, start int, end int, resIdx int, normtype int, unit int) (mat64.Matrix, error)

func (*HiC) QueryTwo

func (e *HiC) QueryTwo(chr string, start int, end int, chr2 string, start2 int, end2 int, resIdx int) (mat64.Matrix, error)

QueryTwo : get two region matrix

func (*HiC) QueryTwoNormMat

func (e *HiC) QueryTwoNormMat(chr string, start int, end int, chr2 string, start2 int, end2 int, resIdx int, normtype int, unit int) (mat64.Matrix, error)

func (*HiC) Read

func (e *HiC) Read(p []byte) (int, error)

func (*HiC) Seek

func (e *HiC) Seek(offset int64, w int) (int64, error)

func (*HiC) String

func (e *HiC) String() string

func (*HiC) Unlock

func (e *HiC) Unlock()

func (*HiC) WriteIndex

func (e *HiC) WriteIndex(w io.Writer)

WriteIndex : TODO

type Index

type Index struct {
	Position int64
	Size     int32
}

type MatrixViewer

type MatrixViewer interface {
	mat64.Matrix
	mat64.Viewer
}

type NormVector

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

func NewNormVector

func NewNormVector(normType int, chrIdx int, unit int, resolution int, index *Index) *NormVector

func (*NormVector) Data

func (v *NormVector) Data() ([]float64, error)

func (*NormVector) Key

func (v *NormVector) Key() string

func (*NormVector) Load

func (v *NormVector) Load(reader MutexReadSeeker)

type Position

type Position struct {
	X     int
	Y     int
	Value float32
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto