Documentation
¶
Overview ¶
Package wig provides functions to read, write, and manipulate wig files. more information on the WIG file format can be found at https://genome.ucsc.edu/goldenPath/help/wiggle.html
Index ¶
- func AllEqual(alpha []Wig, beta []Wig) bool
- func GoReadToChan(filename string) <-chan Wig
- func MakeSkeleton(chromSizes map[string]chromInfo.ChromInfo, defaultValue float64) map[string]Wig
- func Pearson(alpha map[string]Wig, beta map[string]Wig, missing float64, ...) float64
- func Read(filename string, chromSizeFile string, defaultValue float64) map[string]Wig
- func ReadToChan(file *fileio.EasyReader, data chan<- Wig, wg *sync.WaitGroup)
- func SmoothMap(w map[string]Wig, windowSize int, missing float64) map[string]Wig
- func SortByCoord(w []Wig)
- func Write(filename string, records map[string]Wig)
- func WriteToFileHandle(file io.Writer, rec Wig)
- type Wig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllEqual ¶
AllEqual returns true if two slices of Wig data structures contain all the same data vales in the same order, false otherwise.
func GoReadToChan ¶
GoReadToChan reads Wig entries from an input filename to a <-chan Wig.
func MakeSkeleton ¶ added in v1.0.1
MakeSkeleton creates a fixed-step map[string]Wig, with one Wig entry per chromosome, where the size of the Values slice in each struct is equal to the chromosome length, as specified by an input chromSizes map[string]chromInfo.ChromInfo. 'Skeleton' refers to the fact that the values are uniformly set to a defaultValue, and contain no information.
func Pearson ¶
func Pearson(alpha map[string]Wig, beta map[string]Wig, missing float64, samplingFrequency float64) float64
Pearson calculates the Pearson Correlation Coefficient between two input wig slices. Data values equal to the 'missing' value are ignored. samplingFrequency is a number between 0 and 1. This represents the proportion of bases that are considered for evaluating the PCC.
func Read ¶
Read creates a whole genome wig map, where each key is a chromosome name and the value is the corresponding wig struct. The wig struct values slice is the size of the whole chromosome, as specified by an input chromSizeFile. Positions in the genome where there is no wig coverage are set to a user-specified defaultValue. This function is robust against different step sizes between entries and multiple wig entries per chromosome, but is currently limited to 'fixedStep' beds.
func ReadToChan ¶
func ReadToChan(file *fileio.EasyReader, data chan<- Wig, wg *sync.WaitGroup)
ReadToChan reads from a fileio.EasyReader to send Wig structs to a chan<- Wig. When it has finished reading the file, ReadToChan will call Done on the waitgroup.
func SmoothMap ¶ added in v1.0.1
SmoothMap performs moving average smoothing on an input map of Wig structs using a user-specified windowSize and a value that represents missing data in the Wig.
func SortByCoord ¶
func SortByCoord(w []Wig)
SortByCoord sorts in place a slice of Wig structs by their genomic position with secondary sorting by the number of values.
func Write ¶
Write writes an input map[string]Wig to an output filename. Entries in the map will be written in alphanumeric order of the map keys.
func WriteToFileHandle ¶
WriteToFileHandle is a helper function for Write that writes the Wig data structure to an io.Writer
Types ¶
type Wig ¶
type Wig struct {
StepType string
Chrom string
Start int
Step int
Span int
DefaultValue float64 // this will be the value in positions where there is no wig data, alternatively referred to as "MissingValue" in some functions
Values []float64
}
Wig stores information on the chromosome location and step properties of Wig data. Individual wig values are stored in the underlying WigValue struct. Can only handle fixedStep wigs.