Last data update: 2014.03.03
R: Estimate allelic frequency distributions in bins along the...
Estimate allelic frequency distributions in bins along the genome
Description
This function is used to give estimates of the ditribution of observed allelic freuqencies in a regions of the genome, use in conjunction with h5dapply
Usage
binnedAFs(data, sampledata, normalise = TRUE, binWidth = 0.05, minCov = 10, minCount = 2)
Arguments
data
A list
object returned by a call to h5dapply
or h5readBlock
.
sampledata
Sample metadata describing the cohort, can be extracted from an HDF5 tally file using the getSampleData
function.
normalise
Boolean flag to specify whether the counts or percentages of observed allelic frequencies should be returned.
binWidth
Width of bins in allelic frequency space, defaults to 0.05.
minCov
Minimum required coverage for a position to be considered.
minCount
Minimum required number of mismatches for a position to be considered.
Value
A matrix of AF bins times samples.
Author(s)
Paul Theodor Pyl
Examples
library(h5vc)
tallyFile <- system.file( "extdata", "example.tally.hfs5", package = "h5vcData" )
sampleData <- getSampleData( tallyFile, "/ExampleStudy/16" )
afs <- h5dapply(
filename = tallyFile,
group = "/ExampleStudy/16",
names = c("Counts", "Coverages"),
range = c(29e6, 29.05e6),
blocksize = 1e4,
FUN = binnedAFs,
sampledata = sampleData
)
afs[[3]]
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(h5vc)
Loading required package: grid
Loading required package: gridExtra
Loading required package: ggplot2
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/h5vc/binnedAFs.Rd_%03d_medium.png", width=480, height=480)
> ### Name: binnedAFs
> ### Title: Estimate allelic frequency distributions in bins along the
> ### genome
> ### Aliases: binnedAFs
>
> ### ** Examples
>
> library(h5vc)
> tallyFile <- system.file( "extdata", "example.tally.hfs5", package = "h5vcData" )
> sampleData <- getSampleData( tallyFile, "/ExampleStudy/16" )
> afs <- h5dapply(
+ filename = tallyFile,
+ group = "/ExampleStudy/16",
+ names = c("Counts", "Coverages"),
+ range = c(29e6, 29.05e6),
+ blocksize = 1e4,
+ FUN = binnedAFs,
+ sampledata = sampleData
+ )
> afs[[3]]
PT5ControlDNA PT5PrimaryDNA PT5RelapseDNA PT8ControlDNA PT8EarlyStageDNA
0.05 0.432330827 0.691056911 0.00000000 0.536312849 0.550943396
0.1 0.406015038 0.241869919 0.50847458 0.318435754 0.332075472
0.15 0.082706767 0.036585366 0.28813559 0.078212291 0.049056604
0.2 0.022556391 0.004065041 0.03389831 0.030726257 0.007547170
0.25 0.007518797 0.002032520 0.00000000 0.008379888 0.011320755
0.3 0.000000000 0.000000000 0.00000000 0.000000000 0.003773585
0.35 0.003759398 0.004065041 0.00000000 0.000000000 0.003773585
0.4 0.011278195 0.002032520 0.00000000 0.000000000 0.000000000
0.45 0.015037594 0.000000000 0.00000000 0.000000000 0.007547170
0.5 0.003759398 0.000000000 0.01694915 0.002793296 0.015094340
0.55 0.007518797 0.002032520 0.00000000 0.002793296 0.007547170
0.6 0.003759398 0.000000000 0.03389831 0.002793296 0.000000000
0.65 0.003759398 0.000000000 0.00000000 0.000000000 0.011320755
0.7 0.000000000 0.000000000 0.00000000 0.000000000 0.000000000
0.75 0.000000000 0.000000000 0.00000000 0.000000000 0.000000000
0.8 0.000000000 0.000000000 0.00000000 0.000000000 0.000000000
0.85 0.000000000 0.000000000 0.00000000 0.000000000 0.000000000
0.9 0.000000000 0.002032520 0.00000000 0.000000000 0.000000000
0.95 0.000000000 0.002032520 0.01694915 0.000000000 0.000000000
1 0.000000000 0.012195122 0.10169492 0.019553073 0.000000000
PT8PrimaryDNA
0.05 0.00000000
0.1 0.20895522
0.15 0.31343284
0.2 0.19402985
0.25 0.05970149
0.3 0.04477612
0.35 0.00000000
0.4 0.07462687
0.45 0.02985075
0.5 0.02985075
0.55 0.01492537
0.6 0.02985075
0.65 0.00000000
0.7 0.00000000
0.75 0.00000000
0.8 0.00000000
0.85 0.00000000
0.9 0.00000000
0.95 0.00000000
1 0.00000000
>
>
>
>
>
> dev.off()
null device
1
>