plot_ks_density: Plot distributions and KS score for a gene.

Description Usage Arguments Value See Also Examples

View source: R/plots.R

Description

The data for the specified gene is retrieved from ksobj$data. outcomes is used to divide the data into distributions for each group, which are then visualized as density distributions. The calculated KS score for the specified gene is displayed in the plot title.

Usage

1
plot_ks_density(ksobj, gene_name)

Arguments

ksobj

An KSomics object, typically returned via a call to calculate_ks.

gene_name

The gene to visualize. The name should be defined as a row name in ksobj$ks.

Value

A ggplot object is returned. If the value is not assigned, a plot will be drawn.

See Also

calculate_ks ggplot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# 100 genes, 100 samples
dat <- matrix(rnorm(10000), nrow=100, ncol=100)
rownames(dat) <- paste("gene", 1:100, sep="")
colnames(dat) <- paste("sample", 1:100, sep="")

# "A": first 50 samples; "B": next 30 samples; "C": final 20 samples
outcomes <- c(rep("A",50), rep("B",30), rep("C",20))
names(outcomes) <- colnames(dat)

results <- calculate_ks(dat, outcomes, nperm=10, parallel=FALSE)
plot_ks_density(results, "gene5")

Example output

Calculating pairwise KS scores...done.
Calculating KS...done.
Calculating permuted KS #1 of 10...done.
Calculating permuted KS #2 of 10...done.
Calculating permuted KS #3 of 10...done.
Calculating permuted KS #4 of 10...done.
Calculating permuted KS #5 of 10...done.
Calculating permuted KS #6 of 10...done.
Calculating permuted KS #7 of 10...done.
Calculating permuted KS #8 of 10...done.
Calculating permuted KS #9 of 10...done.
Calculating permuted KS #10 of 10...done.
Calculating q-values...done.

EMDomics documentation built on Nov. 8, 2020, 5:30 p.m.