density_plot: Density plots of count data facetted by groups

Description Usage Arguments Value See Also Examples

Description

density_plot function takes an object of class fpkm_counts or raw_counts and returns density plots of all samples facetted by the groups specified.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
density_plot(x, interactive = FALSE, title, groups, facet_cols = 1L,
  log = FALSE, filename, height = 8L, width = 12L, ...)

## Default S3 method:
density_plot(x, interactive = FALSE, title, groups,
  facet_cols = 1L, log = FALSE, filename, height = 8L, width = 12L, ...)

## S3 method for class 'fpkm_counts'
density_plot(x, interactive = FALSE, title, groups,
  facet_cols = 1L, log = FALSE, filename, height = 8L, width = 12L, ...)

## S3 method for class 'raw_counts'
density_plot(x, interactive = FALSE, title, groups,
  facet_cols = 1L, log = FALSE, filename, height = 8L, width = 12L, ...)

Arguments

x

An object of class dge or a list of objects of class dge.

interactive

Default is FALSE. If TRUE, uses ggplotly::ggplotly() to return an interactive plot.

title

Plot title.

groups

Columns indicating those samples that needs to be selected together while facetting.

facet_cols

Number of columns to provide to facet_wrap.

log

Should values be log-transformed? Default is FALSE.

filename

Default is to plot to screen. If a file name is provided, the plot is saved to file and the plot object will be returned. The type of graphic device is auto-detected from file extension (using ggsave).

height

Height of the plot, default is 8 inches.

width

Width of the plot, default is 12 inches.

...

Optional arguments to pass to ggsave call.

Value

A ggplot2 or plotly object containing the density plot of input fpkm_counts or raw_counts object.

See Also

rnaseq, gather_counts show_counts limma_dge edger_dge construct_design construct_contrasts write_dge as.dgelist as.eset

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
path = system.file("tests", package="ganalyse")

# ----- raw ----- # 
raw_path = file.path(path, "raw", "annotation.txt")
raw_obj = rnaseq(raw_path, format="raw", experiment="sample")
raw_counts = gather_counts(raw_obj, by="gene-id", threshold=1L)

# DE genes between treatA and control
density_plot(raw_counts, interactive=FALSE, groups="condition") # ggplot2
density_plot(raw_counts, interactive=FALSE, groups="condition", log=TRUE)
density_plot(raw_counts, interactive=FALSE, 
        groups="condition", title="Raw count density")
density_plot(raw_counts, interactive=TRUE, 
        groups="condition", log=TRUE) # ggplotly
## Not run: 
# write to file and return plot obj
density_plot(raw_counts, filename="tmp.png")

## End(Not run)

openanalytics/ganalyse documentation built on May 24, 2019, 2:25 p.m.