geneScatter: Make a Gene Level Scatter Plot

View source: R/geneScatter.R

geneScatterR Documentation

Make a Gene Level Scatter Plot

Description

Visualize gene expression data in 1, 2, and 3 dimension scatter/waterfall plots for exploratory data analysis.

Usage

geneScatter(
  x,
  genes = NULL,
  color = NULL,
  shape = NULL,
  size = NULL,
  trendline = FALSE,
  symbol = "GeneSymbol",
  legend = NULL,
  main = TRUE,
  na.rm = TRUE,
  facet = NULL,
  shiny = FALSE,
  useNormCounts = TRUE,
  ...
)

Arguments

x

R data object; Most typically this is an ExpressionSet there is support for other data types as well including matrix and data.frame.

genes

character vector; Names of genes or or phenotype data that can be coerced into a numeric vector.

color

vector/character; Should either be factor of values used to color points or the name of a gene/phenotype that can be used to construct one.

shape

vector/character; Should either be factor of values used to control the shape (i.e. pty) of points or the name of a gene/phenotype that can be used to construct one.

size

vector/character; Should either be factor of values used to control the shape (i.e. pty) of points or the name of a gene/phenotype that can be used to construct one.

trendline

character; Valid options include color, shape or density.See details for more information. Setting to TRUE will cause the first grouping factor to be used.

symbol

character; Column name of of gene symbols in the feature data of x (fData).

legend

logical or character; Draws a figure legend. Use to set the legend title which defaults to "Legend" if equals TRUE. Set to FALSE to disable.

main

character; The main plot title. Defaults to true for automated generation.

na.rm

logical; Removes NA values prior to plotting.

facet

factor or name of factor to be exacted from x (e.g. pData). Split the data into multiple smaller graphs.

shiny

logical; Use shiny interfaces if available.

useNormCounts

logical; By default geneScatter will try to use normCounts instead of counts in SeqExpressionSets. Set to FALSE to use raw counts instead, though this will generate a warning about using non-normalized data.

...

Any valid bvt plotting parameter that can be found in bvt_graphic_options.

Details

Details will be forthcoming. Makes a 2D or 3D scatter plot.

Value

A list of class npData. This contains data necessary to regenerate the plot as well as summary statistics.

See Also

niceScatter, niceDensity

Examples

#While bioinformatic data sets are the intended use case, bvt functions can be used with as regular
#plotting functions with data such as iris. As geneScatter is expecting expression data with
#patients as columns and genes as rows, it is necessary to take the transpose of the data set first.

data("iris")
#basic usage
geneScatter(t(iris[,1:2]), color=iris$Species, shape=iris$Species, size=iris$Petal.Length,
   legend=c("Species", "Petal Length"), main="Basic Scatter")

#using adding a trendline
a<-geneScatter(t(iris[,3:4]), color=iris$Species,  trendline=TRUE, theme=npGGTheme, verbose=TRUE,
corMethod="spearman", pointSize=.8,logScale=10, minorTick=3, minorGuides=TRUE, main="Using Trend Lines")
#to access the linear model or cor.test statics later:
a$stats

#multiple trend lines
geneScatter(t(iris[,1:2]), color=iris$Species=="setosa", shape=iris$Species,
trendline="color", theme=npColorTheme, legend=c("Is Setosa?","Species"), main="Multiple Trend Lines")

#single variable plotting
geneScatter(t(iris[,3]), color=iris$Species, main="Single Variable Plotting")

#waterfall version of the above. Note type is the same as in base plotting \(i.e. "p","b","h","l"\)
orderedIris<-order(iris[,3], decreasing = TRUE)
geneScatter(t(iris[orderedIris,3]), color=iris$Species[orderedIris], type="h", main="Waterfall Example")

#3D plotting. You can set useRgl=TRUE for rgl based interactive graphics
geneScatter(t(iris[,1:3]), color=iris$Species, logScale=2, size=iris[,4] ,pointSize=1)


ZachHunter/bvt documentation built on Sept. 18, 2024, 3:12 p.m.