Last data update: 2014.03.03

R: Coverage analysis
CoverageR Documentation

Coverage analysis

Description

Functions to do analyses based on coverage

Usage

binnedCoverage( data, sampledata, gccount = FALSE )

Arguments

data

A list with element Coverage (a 3d integer array of size [1:2, 1:k, 1:n])

sampledata

A data.frame with k rows (one for each sample) and columns Type, Column and (SampleGroup or Patient). The tally file should contain this information as a group attribute, see getSampleData for an example.

gccount

Boolean flag to specify whether the gc count of the bin should be reported as well, Reference must be a slot in the data object

Details

Explanations:

This computes the per sample coverage in a given bin (determined by the width of data). This feature is not implemented yet!

Value

Returns a data.frame with columns containing the coverage with the current bin for all samples provided in sampledata. The binsize is determined by the blocksize argument given to h5dapply when this function is run directly on a tally file.

Author(s)

Paul Pyl

Examples

  # loading library and example data
  library(h5vc)
  tallyFile <- system.file( "extdata", "example.tally.hfs5", package = "h5vcData" )
  sampleData <- getSampleData( tallyFile, "/ExampleStudy/22" )
  data <- h5dapply( # extractting coverage binned at 1000 bases
    filename = tallyFile,
    group = "/ExampleStudy/22",
    blocksize = 1000,
    FUN = binnedCoverage,
    sampledata = sampleData,
    gccount = TRUE,
    names = c( "Coverages", "Reference" ),
    range = c(38900000,39000000)
  )
  data <- do.call(rbind, data)
  rownames(data) <- NULL
  head(data)

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/coverage.Rd_%03d_medium.png", width=480, height=480)
> ### Name: Coverage
> ### Title: Coverage analysis
> ### Aliases: binnedCoverage
> 
> ### ** Examples
> 
>   # loading library and example data
>   library(h5vc)
>   tallyFile <- system.file( "extdata", "example.tally.hfs5", package = "h5vcData" )
>   sampleData <- getSampleData( tallyFile, "/ExampleStudy/22" )
>   data <- h5dapply( # extractting coverage binned at 1000 bases
+     filename = tallyFile,
+     group = "/ExampleStudy/22",
+     blocksize = 1000,
+     FUN = binnedCoverage,
+     sampledata = sampleData,
+     gccount = TRUE,
+     names = c( "Coverages", "Reference" ),
+     range = c(38900000,39000000)
+   )
>   data <- do.call(rbind, data)
>   rownames(data) <- NULL
>   head(data)
  PT5ControlDNA PT5PrimaryDNA PT5RelapseDNA PT8ControlDNA PT8EarlyStageDNA
1         53001         63179         24902         59620            47520
2         32193         35596         13497         33194            30825
3         37230         45267         18671         40159            40179
4         40849         51886         18408         42760            48981
5         44519         56407         18616         46656            39872
6         45196         61589         20398         51093            46342
  PT8PrimaryDNA Chrom    Start      End GCCount
1         22071    22 38900000 38900999     395
2         14885    22 38901000 38901999     594
3         14921    22 38902000 38902999     604
4         20269    22 38903000 38903999     515
5         21485    22 38904000 38904999     496
6         18503    22 38905000 38905999     460
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>