Learn R Programming

derfinder (version 1.6.4)

calculateStats: Calculate F-statistics at base pair resolution from a loaded BAM files

Description

After defining the models of interest (see makeModels) and pre-processing the data (see preprocessCoverage), use calculateStats to calculate the F-statistics at base-pair resolution.

Usage

calculateStats(coveragePrep, models, lowMemDir = NULL, ...)

Arguments

coveragePrep
A list with $coverageProcessed, $mclapplyIndex, and $position normally generated using preprocessCoverage.
models
A list with $mod and $mod0 normally generated using makeModels.
lowMemDir
The directory where the processed chunks are saved when using preprocessCoverage with a specified lowMemDir.
...
Arguments passed to other methods and/or advanced arguments.

Value

  • A numeric Rle with the F-statistics per base pair that passed the cutoff.

See Also

makeModels, preprocessCoverage

Examples

Run this code
## Collapse the coverage information
collapsedFull <- collapseFullCoverage(list(genomeData$coverage), 
    verbose = TRUE)

## Calculate library size adjustments
sampleDepths <- sampleDepth(collapsedFull, probs=c(0.5), verbose = TRUE)

## Build the models
group <- genomeInfo$pop
adjustvars <- data.frame(genomeInfo$gender)
models <- makeModels(sampleDepths, testvars = group, adjustvars = adjustvars)

## Preprocess the data
prep <- preprocessCoverage(genomeData, cutoff = 0, scalefac = 32,
    chunksize=1e3, colsubset=NULL)

## Run the function
fstats <- calculateStats(prep, models, verbose=TRUE, method='regular')
fstats

## Compare vs pre-packaged F-statistics
library('testthat')
expect_that(fstats, is_equivalent_to(genomeFstats))

Run the code above in your browser using DataLab