makeFdrPlot: Plot FDR

Description Usage Arguments Examples

View source: R/tfbs.R

Description

Plot one or more false discovery rate data.frame(s). False discovery rate data.frame(s) are created using calc.fdr. This plot enables the user to get an idea of an appropreate FDR threshold to use for determining likely binding sites.

Usage

1
makeFdrPlot(x, xlim = NULL, ylim = NULL, col = "black", lty = 1, ...)

Arguments

x

data.frame created by calc.fdr, or list of such data frames

xlim

If given, specifies the x coordinate boundaries. Otherwise these are taken by the observed range of scores

ylim

If given, specifies the y coordinate boundaries. Otherwise these are taken by the observed range of FDR values.

col

The color to plot (see par() for description). Will be recycled to the number of data.frames in x.

lty

The line type (see par() for description). Will be recycled to the number of data.frames in x.

...

Additional arguments to be passed to plot()

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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
require("rtfbs")
exampleArchive <- system.file("extdata", "NRSF.zip", package="rtfbs")
seqFile <- "input.fas"
unzip(exampleArchive, seqFile)
# Read in FASTA file "input.fas" from the examples into an 
#   MS (multiple sequences) object
ms <- read.ms(seqFile);
pwmFile <- "pwm.meme"
unzip(exampleArchive, pwmFile)
# Read in Position Weight Matrix (PWM) from MEME file from
#  the examples into a Matrix object
pwm <- read.pwm(pwmFile)
# Build a 3rd order Markov Model to represent the sequences
#   in the MS object "ms".  The Model will be a list of
#   matrices  corrisponding in size to the order of the 
#   Markov Model
mm <- build.mm(ms, 3);
# Match the PWM against the sequences provided to find
#   possible transcription factor binding sites.  A 
#   Features object is returned, containing the location
#   of each possible binding site and an associated score.
#   Sites with a negative score are not returned unless 
#   we set threshold=-Inf as a parameter.
cs <- score.ms(ms, pwm, mm)
# Generate a sequence 1000 bases long using the supplied
#   Markov Model and random numbers
v <- simulate.ms(mm, 10000)
# Match the PWM against the sequences provided to find
#   possible transcription factor binding sites.  A 
#   Features object is returned, containing the location
#   of each possible binding site and an associated score.
#   Sites with a negative score are not returned unless 
#   we set threshold=-Inf as a parameter. Any identified
#   binding sites from simulated data are false positives
#   and used to calculate False Discovery Rate
xs <- score.ms(v, pwm, mm)
# Calculate the False Discovery Rate for each possible
#   binding site in the Features object CS.  Return
#   a mapping between each binding site score and the
#   associated FDR.
fdr <- calc.fdr(ms, cs, v, xs)
# Plot the False Discovery Rate v.s. score for one or
#   more groups.  To plot multiple FDR/Score mapping 
#   data frames on a single plot, simply supply a list
#   of FDR/Score data.frames 
makeFdrPlot(fdr)
unlink("pwm.meme")
unlink("input.fas")

rtfbs documentation built on Jan. 22, 2020, 1:07 a.m.