Last data update: 2014.03.03

R: Frequency-Frequency Plot Focusing On Significant Deviations...
plotAmpliconduoR Documentation

Frequency-Frequency Plot Focusing On Significant Deviations In Amplicon Occurences

Description

Applied to an ampliconduo data frame, one element of the return value of the ampliconduo function. Generates a plot of freqB over freqA (the read numbers of the same amplicon in both halves A and B of a split sample). For amplicons that have significantly deviating read numbers, i.e. with a p-value or adjusted p-value below a certain treshold, points are colored differently (default: red).

Usage

plotAmpliconduo(x, color.treshold = 0.05, xlab = "Abundance (PCR A)", 
ylab = "Abundance (PCR B)",main = NULL, log = "xy", corrected = TRUE, asp = 1, 
legend.position = NULL, save = FALSE, path = NULL, file.name = NULL,
format = "jpeg", h.start = 0, ...)

Arguments

x

Ampliconduo data frame, an element of the returned list of the ampliconduo function.

color.treshold

Optional. Numeric value specifying at which p-value or adjusted p-value points in the plot are drawn in complementary color. Default value is 0.05.

xlab

Optional. Character indicating the x-axis label. Default is “Abundance (PCR A)”.

ylab

Optional. Character indicating the y-axis label. Default is “Abundance (PCR B)”.

main

Optional. Character specifying the overall title of the plot. If no value is passed, takes the sample name from the x$sample column.

log

Optional. Character specifying the variables to transform to log (“”,“x”, “y”, or “xy”). Default is “xy”.

corrected

Optional. Logical to decide whether the p-value (FALSE), or corrected p-value (TRUE) is used for coloring. Default value is TRUE.

asp

Optional. Numeric value, the y/x aspect ratio. Default is 1.

legend.position

Optional. Numeric vector of length two. Defines the position of the legend. By default tries to find a position that fits best the arrangement of the plots.

save

Optional. Logical value indicationg if the plot should be saved to file. Default value is FALSE.

path

Optional. Character, in case the argument save was set to TRUE, specifies the directory (no backslash or slash at the end) for saving. By default (parameter save is set to TRUE) the plot is saved in the working directory.

file.name

Optional. If argument save was set to TRUE specifies the file name for the plot. The default name is “ampliconduo_<date>.<file extension>”

format

Optional. Character specifying the format of the saved file. One of “eps”, “ps”, “tex”, “pdf”, “jpeg”, “tiff”, “png”, “bmp”, “svg” and “wmf” (windows only). Default format is “jpeg”.

h.start

Optional. Numeric value between 0 and 360 defines the color of the plotted points. Default value is 0 (blue-green, red).

...

Optional. Allows to pass other aesthetics.

Author(s)

Anja Lange & Daniel Hoffmann

References

http://had.co.nz/ggplot2/book/qplot.pdf

See Also

ggplot2 package

qplot internally used to create the plot.

plotAmpliconduo.set, generates a very similar plot for a list of ampliconduo data frames.

ampliconduo, generates the input data.

Examples

## load example data
data(amplicons)

## extract the second ampliconduo data frame
ampliconduo2 <- amplicons[[2]]

## plot the amplicon frequencies of the ampliconduo data frame 
plotAmpliconduo(ampliconduo2, main = "ampliconduo_2")
plotAmpliconduo(ampliconduo2, main = "ampliconduo_2", h.start = 50, log = "")
plotAmpliconduo(ampliconduo2, h.start = 50, log = "", asp = 2, corrected = FALSE)

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(AmpliconDuo)
Loading required package: ggplot2
Loading required package: xtable
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/AmpliconDuo/plotAmpliconduo.Rd_%03d_medium.png", width=480, height=480)
> ### Name: plotAmpliconduo
> ### Title: Frequency-Frequency Plot Focusing On Significant Deviations In
> ###   Amplicon Occurences
> ### Aliases: plotAmpliconduo
> ### Keywords: hplot
> 
> ### ** Examples
> 
> ## load example data
> data(amplicons)
> 
> ## extract the second ampliconduo data frame
> ampliconduo2 <- amplicons[[2]]
> 
> ## plot the amplicon frequencies of the ampliconduo data frame 
> plotAmpliconduo(ampliconduo2, main = "ampliconduo_2")
> plotAmpliconduo(ampliconduo2, main = "ampliconduo_2", h.start = 50, log = "")
> plotAmpliconduo(ampliconduo2, h.start = 50, log = "", asp = 2, corrected = FALSE)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>