sideViolin: sideViolin

View source: R/SidebySideViolins.R

sideViolinR Documentation

sideViolin

Description

Plots two histograms side by side with smoothed density overlay

Usage

sideViolin(y, cond, MAP = NULL, logT = TRUE, title.gene = "",
  conditionLabels = unique(cond), axes.titles = TRUE)

Arguments

y

Numeric vector of data to plot.

cond

Vector of condition labels corresponding to elements of x.

MAP

List of MAP partition estimates with conditions as list items and samples as elements (integer indicating which cluster each observation belongs to; zeroes belong to cluster 1)

logT

Logical that indicates whether to take the log(x+1) transformation.

title.gene

Character vector that contains the gene name that you are plotting.

conditionLabels

Character vector containing the names of the two conditions.

axes.titles

Logical indicating whether or not to include axes labels on plots.

Value

ggplot object

References

Korthauer KD, Chu LF, Newton MA, Li Y, Thomson J, Stewart R, Kendziorski C. A statistical approach for identifying differential distributions in single-cell RNA-seq experiments. Genome Biology. 2016 Oct 25;17(1):222. https://genomebiology.biomedcentral.com/articles/10.1186/s13059-016-1077-y

Examples


# load toy simulated example ExpressionSet to find DD genes

data(scDatExSim)


# load SingleCellExperiment package to facilitate subset operations 

library(SingleCellExperiment)


# plot side by side violin plots for Gene 1 (DE)

sideViolin(normcounts(scDatExSim)[1,], scDatExSim$condition, 
           title.gene=rownames(scDatExSim)[1])


# plot side by side violin plots for Gene 6 (DP)

sideViolin(normcounts(scDatExSim)[6,], scDatExSim$condition, 
           title.gene=rownames(scDatExSim)[6])


# plot side by side violin plots for Gene 11 (DM)

sideViolin(normcounts(scDatExSim)[11,], scDatExSim$condition, 
           title.gene=rownames(scDatExSim)[11])


# plot side by side violin plots for Gene 16 (DB)

sideViolin(normcounts(scDatExSim)[16,], scDatExSim$condition, 
           title.gene=rownames(scDatExSim)[16])

# plot side by side violin plots for Gene 21 (EP)

sideViolin(normcounts(scDatExSim)[21,], scDatExSim$condition, 
           title.gene=rownames(scDatExSim)[21])


# plot side by side violin plots for Gene 26 (EE)

sideViolin(normcounts(scDatExSim)[26,], scDatExSim$condition, 
           title.gene=rownames(scDatExSim)[26])



kdkorthauer/scDD documentation built on March 27, 2022, 5:11 a.m.