makeContextDataTable: Compute Statistics Regarding Specific Contexts

Description Usage Arguments Value Examples

Description

These functions compute statistics like the median IPD for a specific context, or the raw IPD for a single context.

Usage

1
2
3
4
5
6
7
8
9
  makeContextDataTable(cmpH5, idx = 1:nrow(cmpH5), up = 2, down = 2, fxs
  = list(ipd = getIPD, pw = getPulseWidth, tpos = getTemplatePosition), ...)

associateWithContext(cmpH5, idx = 1:nrow(cmpH5), f = getIPD, up = 2, down = 2, 
    useReference = TRUE, collapse = FALSE)

summarizeByContext(cmpH5, idx = 1:nrow(cmpH5), up = 2, down = 2,
             statF = getIPD, summaryF = function(a) median(a, na.rm =
     T), ...)

Arguments

cmpH5

An object of class PacBioCmpH5.

idx

The indices of the alignments to retrieve.

up

Number of nucleotides upstream to include in the context.

down

Number of nucleotides downstream to include in the context.

statF

Statistic to be calculated, the default is 'getIPD.'

f

Statistic to be calculated, the default is 'getIPD.'

summaryF

Summary statistic to be calculated, the default is the median.

fxs

A list of statistics to be included in the table, the defaults are 'getIPD', 'getPulseWidth' and 'getTemplatePosition.'

useReference

Boolean statement whether to use the reference strand.

collapse

Collapses all context columns into one column.

...

Extra arguments.

Value

These functions return data.frame(s) with columns containing either numeric or character vectors.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
  ## These functions contain similar information regarding IPD.
  ## This example demonstrates that the median IPD can be computed
  ## using any one of these functions. 
  require(pbh5)
  file <- list.files(system.file("h5_files", package = "pbh5"),  pattern =
  "aligned_reads", full.name = TRUE)
  cmpH5 <- PacBioCmpH5(file)

  summarize <-summarizeByContext(cmpH5)
  head(summarize)

  associate <- associateWithContext(cmpH5)
  head(associate)
  a5A <- subset(associate, context.P01 == 'A' & context.P02 == 'A' &
                 context.P03 == 'A' & context.P04 == 'A' & context.P05 == 'A')
  head(a5A)
  nrow(a5A)
  median(a5A$elt, na.rm = TRUE)

  makeCDT <- makeContextDataTable(cmpH5)
  m5A <- subset(makeCDT, context.P01 == 'A' & context.P02 == 'A' &
          context.P03 == 'A' & context.P04 == 'A' & context.P05 == 'A')
  median(m5A$elt.ipd, na.rm = TRUE)

  ## Some plots...

  plot(density(log(a5A$elt), na.rm = TRUE), main = "Distribution of IPDs
  for context AAAA")
  boxplot(list(m5A$elt.ipd, m5A$elt.pw), ylim = c(0,1), names = c('IPD','PW'))

PacificBiosciences/R-pbh5 documentation built on May 7, 2019, 11:54 p.m.