lift

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ElementOverlapProbabilities

func ElementOverlapProbabilities(elements1 []Lift, elements2 []Lift, noGapRegions []Lift) []float64

ElementOverlapProbabilities returns a slice of float64 representing the probabilities that an element in elements2 overlaps an element in elements1.

func EnrichmentPValueApproximation

func EnrichmentPValueApproximation(elementOverlapProbs []float64, overlapCount int) []float64

EnrichmentPValueApproximation performs a calculation of enrichment based on a set of overlap probabilities and the observed overlap count. Uses a normal approximation of the resulting binomial distribution. Very fast and should converge on the correct answer. This is the preferred method. Returns a slice of four values. The first represents a debug check (hardcoded to one), the second is the expected number of overlaps, and the third and fourth represent the pValues for enrichment and depletion, respectively.

func EnrichmentPValueExact

func EnrichmentPValueExact(elementOverlapProbs []float64, overlapCount int) []float64

EnrichmentPValueExact performs an exact calculation fo enrichment bgaased on a set of overlap probabilities and the observed overlap count. The exact method is non-polynomial, and is thus not recommended for large datasets. Returns a slice of four values. The first is the debug check, the second is the expected number of overlaps, and the third and fourth represent the pValues for enrichment and depletion, respectively.

func EnrichmentPValueLowerBound

func EnrichmentPValueLowerBound(elements1 []Lift, elements2 []Lift, noGapRegions []Lift, overlapCount int, verbose int) []float64

EnrichmentPValueLowerBound together with EnrichmentPValueUpperBound provide a range of possible values for the pValue of overlap. Returns a slice of four values. The first is the debug check, the second is the expected number of overlaps, and the third and fourth represent the pValues for enrichment and depletion, respectively.

func EnrichmentPValueUpperBound

func EnrichmentPValueUpperBound(elements1 []Lift, elements2 []Lift, noGapRegions []Lift, overlapCount int, verbose int) []float64

EnrichmentPValueUpperBound, together with EnrichmentPValueLowerBound, provide a range of possible values for the pValue of overlap. Returns a slice of four values. The first is the debug check, the second is the expected number of overlaps, and the third and fourth represent the pValues for enrichment and depletion, respectively.

func GoReadToChan

func GoReadToChan(inputFile string) <-chan Lift

GoReadToChan reads Lift interfaces to a channel from an input file.

func IsSelfOverlapping

func IsSelfOverlapping(b []Lift, verbose int) bool

IsSelfOverlapping returns true if any elements in a Lift slice overlap another element in the same slice. False otherwise. b must be presorted with SortByCoord. Verbose > 0 reveals debug prints.

func LiftCoordinatesWithChain

func LiftCoordinatesWithChain(c chain.Chain, i Lift) (string, int, int)

LiftCoordinatesWithChain returns the update coordinates for an input Lift interface based on an input chain.

func MatchOverlapLen

func MatchOverlapLen(start1 int, end1 int, start2 int, end2 int) int

MatchOverlapLen returns the number of bases shared between two start and end points. Used in MatchProportion.

func MatchProportion

func MatchProportion(c chain.Chain, i interval.Interval) (float64, float64)

MatchProportion returns the proportion of bases in the target and query that can be lifted for a particular interval as a pair of floats (propT, propQ).

func OverlapCount

func OverlapCount(a []Lift, b []Lift) int

OverlapCount returns the number of elements from list one that have any overlap with list two. Answers range from 0 to len(a). Input Lift slices must be presorted with SortByCoord.

func ReadToChan

func ReadToChan(inputFile string, send chan<- Lift)

ReadToChan reads from a file to send Lift interfaces to a chan<- Lift.

func SortByCoord

func SortByCoord(b []Lift)

SortByCoord sorts a slice of Lift interfaces by their coordinates.

func StrictBorderCheck

func StrictBorderCheck(c chain.Chain, i interval.Interval) bool

StrictBorderCheck returns true if the TPos of both the ChromStart and ChromEnd of an interval fall within the chain Size, not TBases.

Types

type Lift

type Lift interface {
	GetChrom() string
	GetChromStart() int
	GetChromEnd() int
	WriteToFileHandle(io.Writer)
	UpdateCoord(string, int, int) interface{}
}

Lift is an interface for genomic regions. Unlike interval, Lifts can be edited in place.

func GoRead

func GoRead(inputFile string) []Lift

GoRead reads Lift interfaces from an input file to a slice. Uses Chans under the hood.

func IntervalSliceToLift

func IntervalSliceToLift(b []interval.Interval) []Lift

IntervalSliceToLift casts a slice of intervals to a slice of Lift interfaces.

Jump to

Keyboard shortcuts

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