evalBinSize {RIPSeeker} | R Documentation

## Evaluate bin size using Shimazaki cost function

### Description

Given a bin size and a GRanges alignment object, the funciton computes the bin count and returns the cost of the bin size based on Shimazaki cost function.

### Usage

    evalBinSize(binSize, alignGR)

### Arguments

`binSize` | An integer that indicates the bin size applied to the binning of the chromosome.
`alignGR` | GRanges object of alignments to a single chromosome.

### Details

The function implements the algorithm developed by Shimazaki and Shinomoto (2007), which is based on the goodness of the fit of the time histogram to estimate the rate of neural response of an animal to certain stimuli in a spike-in experiment. The algorithm involves four simple steps:

1. Divide chromosome sequence into N bins of width b.

2. Count number of read counts x_i that enter the i'th bin.

3. Compute: \bar{x} = \frac{1}{N}∑_{i=1}^{N}x_{i} and v = \frac{1}{N}∑_{i=1}^{N}(x_{i} - \bar{x})^{2}.

4. Compute: C(b) = \frac{2\bar{x}-v}{b^{2}}

### Value

`cost` | A scalar value for the cost of the bin size.

### Author(s)

Yue Li

### References

Hideaki Shimazaki and Shigeru Shinomoto. A method for selecting the bin size of a time histogram. Neural computation, 19(6):1503-1527, June 2007.

### See Also

`selectBinSize, binCount`

### Examples

    # Retrieve system files
    extdata.dir <- system.file("extdata", package="RIPSeeker")

    bamFiles <- list.files(extdata.dir, ".bam$", recursive=TRUE, full.names=TRUE)

    bamFiles <- grep("PRC2", bamFiles, value=TRUE)

    alignGal <- getAlignGal(bamFiles[1], reverseComplement=TRUE, genomeBuild="mm9")

    alignGR <- as(alignGal, "GRanges")

    alignGRList <- GRangesList(as.list(split(alignGR, seqnames(alignGR))))

    binSize <- 1000

    costs <- evalBinSize(binSize, alignGRList$chrX)

[Package RIPSeeker version 1.20.0 Index]