BindScore: Class "BindScore"

Description Usage Arguments Objects from the Class Slots Methods Author(s) References See Also Examples

View source: R/initialize.R

Description

This class provides the infrastructure to store results of ChIP-seq analysis.

Usage

 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
30
31
32
33
34
35
36
37
38
39
	## S4 method for signature 'BindScore'
binding(x)
	## S4 method for signature 'BindScore'
chrLength(x, subset)
	## S4 method for signature 'BindScore'
cutoff(x, type=c("score", "pvalue"))
	## S4 replacement method for signature 'BindScore'
cutoff(x, type=c("score", "pvalue")) <- value
	## S4 method for signature 'BindScore'
head(x, n=6, by=c("score", "position"), ...)
	## S4 method for signature 'BindScore'
lapply(X, FUN, ...)
	## S4 method for signature 'BindScore'
length(x)
	## S4 replacement method for signature 'BindScore'
length(x) <- value
	## S4 method for signature 'BindScore'
max(x, ..., na.rm=TRUE)
	## S4 method for signature 'BindScore'
min(x, ..., na.rm=TRUE)
	## S4 method for signature 'BindScore'
names(x)
	## S4 replacement method for signature 'BindScore,ANY'
names(x) <- value
	## S4 method for signature 'BindScore'
nullDist(x)
	## S4 replacement method for signature 'BindScore'
nullDist(x) <- value
	## S4 method for signature 'BindScore'
peaks(x, ...)
	## S4 method for signature 'BindScore'
range(x, ..., na.rm=TRUE)
	## S4 method for signature 'BindScore'
score(x)
	## S4 method for signature 'BindScore'
support(x)
	## S4 method for signature 'BindScore'
tail(x, n=6, by=c("score", "position"), ...)
	BindScore(call, score=list(), pvalue=list(), peaks=list(), cutoff=c(-Inf, 1), nullDist=c(0, 1), names=NULL, start=1L, compress=TRUE, digits=16)

Arguments

x

Object of class BindScore.

X

Object of class BindScore.

subset

Index vector indicating a subset of x. If subset is missing everything is selected.

type

A string indicating which type of cut-off should be returned or changed. Either "score" or "pvalue"

n

Number of entries to show.

by

A string indicating whether the output should be sorted by score or by position in the genome.

na.rm

Logical indication whether NAs should be ignored.

FUN

Function to apply to results for each chromosome.

value

Replacement value.

call

Function call used to generate the values of the other slots.

score

List of binding site scores. One component per chromosome.

pvalue

List of binding site p-values. One component per chromosome.

peaks

List of significant peaks in binding site score. One component per chromosome.

cutoff

Numeric vector of length two indicating the significance cut-off in terms of score and p-value.

nullDist

Parameters of the null distribution.

names

Character vector providing names for chromosomes.

start

Integer indicating position of first binding site score.

compress

Logical indicating whether scores and p-values should be compressed.

digits

The number of decimal places to retain for compression.

...

Further arguments.

Objects from the Class

Objects can be created by calls of the form new("BindScore", functionCall, score, pvalue, peaks, cutoff, nullDist, names, ...). Objects of this class are typically created (and returned) by functions that perform peak calling on ChIP-seq data. Usually there should be no need to create them directly.

Slots

functionCall:

Object of class "call" storing the function call used to initiate the analysis.

score:

Object of class "list". The binding site score. One numeric vector per chromosome.

pvalue:

Object of class "list". The (adjusted) p-values corresponding to the scores in slot score.

peaks:

Object of class "list" giving the location of significant peaks in the binding site score. These correspond to the location of predicted binding sites.

cutoff:

Object of class "numeric" with entries ‘pvalue’ and ‘score’ giving the significance threshold used for peak calling in terms of p-value and score.

nullDist:

Object of class "numeric" providing the parameters of the null distribution used to determine p-values.

start:

Object of class "integer" indicating the index corresponding to the first entry in score (assumed to be the same for all chromosomes).

Methods

as.data.frame

signature(x = "BindScore"): Convert results into a data.frame giving the location, score and p-value of significant peaks.

[

signature(x = "BindScore", i = "ANY", j = "missing", drop = "missing"): Restrict results to a subset of chromosomes. Chromosomes can either be identified by name or by numerical index.

[[

signature(x = "BindScore", i = "ANY", j = "missing"): Restrict results to a single chromosome. Note that x[["chr1"]] is identical to x["chr1"].

[[

signature(x = "BindScore", i = "ANY", j = "numeric"): subset results to restrict them to a region on a single chromosome.

binding

signature(x = "BindScore"): Returns length of binding site used during analysis.

chrLength

signature(x = "BindScore", subset = "ANY"): Returns length of all chromosomes represented in x.

cutoff<-

signature(x = "BindScore"): Sets the significance cut-off. Argument type=c("score", "pvalue") determines which cut-off is to be set, the other is adjusted accordingly. This recalculates the significance of peaks in the binding site score and may be slow.

cutoff

signature(x = "BindScore"): Returns significance threshold used for analysis.

head

signature(x = "BindScore"): Returns the first n peaks. Argument by = c("score", "position") determines whether results are sorted by score or by genomic location.

lapply

signature(X = "BindScore"): Applies a function to results for each chromosome.

length<-

signature(x = "BindScore"): Reduces the number of chromosomes for which results are stored, i.e., length(x) <- 3 only retains the first three chromosomes.

length

signature(x = "BindScore"): Returns the number of binding sites identified by the analysis.

max

signature(x = "BindScore"): Returns maximum score.

min

signature(x = "BindScore"): Returns minimum score.

names<-

signature(x = "BindScore", value = "ANY"): Sets the chromosome names.

names

signature(x = "BindScore"): Returns the chromosome names.

nullDist<-

signature(x = "BindScore"): Sets the parameters of the null distribution adjusting the significance cut-off in the process and predicts binding sites using the new null distribution.

peaks

signature(x = "BindScore"): Returns list of predicted binding sites.

range

signature(x = "BindScore"): Range of binding site scores.

score

signature(x = "BindScore"): Returns list of binding site scores.

support

signature(x = "BindScore"): Returns length of support region used during analysis.

tail

signature(x = "BindScore"): Returns the last n peaks. Argument by = c("score", "position") determines whether results are sorted by score or by genomic location.

Author(s)

Peter Humburg

References

~put references to the literature/web site here ~

See Also

ReadCounts for the data structure used as input for the analysis and callBindingSites

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
30
31
32
33
34
showClass("BindScore")

set.seed(1)

## determine binding site locations
b <- sample(1:1e6, 5000)

## sample read locations
fwd <- unlist(lapply(b, function(x) sample((x-83):(x-73), 20, replace=TRUE)))
rev <- unlist(lapply(b, function(x) sample((x+73):(x+83), 20, replace=TRUE)))

## add some background noise
fwd <- c(fwd, sample(1:(1e6-25), 50000))
rev <- c(rev, sample(25:1e6, 50000))

## create data.frame with read positions as input to strandPileup
reads <- data.frame(chromosome="chr1", position=c(fwd, rev), 
	length=25, strand=factor(rep(c("+", "-"), times=c(150000, 150000))))

## create object of class ReadCounts
readPile <- strandPileup(reads, chrLen=1e6, extend=1, plot=FALSE)

## predict binding site locations
## the artificial dataset is very small so predictions may not be very reliable
bindScore <- simpleNucCall(readPile, bind=147, support=20, plot=FALSE, compress=FALSE)

## number of binding sites found
length(bindScore)

## the first few predictions, by score
head(bindScore)

## score and p-value cut-off used
cutoff(bindScore)

ChIPseqR documentation built on Nov. 8, 2020, 6:49 p.m.