Learn R Programming

a4 (version 1.20.0)

boxPlot: Create a boxplot for a given gene.

Description

Create a boxplot for a given gene. The boxplot displays the expression values (y-axis) by groupss (x-axis). The raw data are superimposed as dots, jittered for readability of the plot. Optionally, the dots can be colored by another variable.

Usage

boxPlot(probesetId = NULL, geneSymbol = NULL, object, groups, main = NULL, colvec = NULL, colgroups = NULL, probe2gene = TRUE, addLegend = TRUE, legendPos = "topleft", ...)

Arguments

probesetId
The probeset ID. These should be stored in the featureNames of the expressionSet object.
geneSymbol
The gene symbol. These should be stored in the column `Gene Symbol` in the featureData of the expressionSet object.
object
ExpressionSet object for the experiment
groups
String containing the name of the grouping variable. This should be a the name of a column in the pData of the expressionSet object.
main
Main title on top of the graph
colvec
Vector of colors to be used for the groups. If not specified, the default colors of a4palette are used.
colgroups
String containing the name of the variable to color the superimposed dots. This should be a the name of a column in the pData of the expressionSet object.
probe2gene
Boolean indicating whether the probeset should be translated to a gene symbol (used for the default title of the plot)
addLegend
Boolean indicating whether a legend for the colors of the dots should be added.
legendPos
Specify where the legend should be placed. Typically either topright, bottomright, topleft (the default) or bottomleft
...
Possibility to add extra plot options. See par

See Also

plot1gene

Examples

Run this code
# simulated data set
esSim <- simulateData()
boxPlot(probesetId = 'Gene.1', object = esSim, groups = 'type', addLegend = FALSE)

# ALL data set
if (require(ALL)){
  data(ALL, package = "ALL")
  ALL <- addGeneInfo(ALL)
  ALL$BTtype <- as.factor(substr(ALL$BT,0,1))

  boxPlot(geneSymbol = 'HLA-DPB1', object = ALL, boxwex = 0.3,
		  groups = 'BTtype', colgroups = 'BT', legendPos='topright')
}

Run the code above in your browser using DataLab