Last data update: 2014.03.03

R: Plot Density and Scatterplot for Genes By Class
plotFeatureClassesR Documentation

Plot Density and Scatterplot for Genes By Class

Description

Allows the visualisation of genes which were selected by a feature selection method.

Usage

  ## S4 method for signature 'matrix'
plotFeatureClasses(expression, classes, ...)
  ## S4 method for signature 'ExpressionSet'
plotFeatureClasses(expression, rows, whichPlots = c("both", "density", "stripchart"),
                               xAxisLabel = expression(log[2](expression)), expressionLimits = c(2, 16),
                               yAxisLabels = c("Density", "Classes"), showXtickLabels = TRUE,
                               showYtickLabels = TRUE, xLabelPositions = "auto",
                               yLabelPositions = "auto", fontSizes = c(24, 16, 12, 12, 12),
                               colours = c("blue", "red"), plot = TRUE)

Arguments

expression

Either a matrix or ExpressionSet containing the training data. For a matrix, the rows are features, and the columns are samples.

classes

A vector of class labels.

...

Unused variables from the matrix method passed to the ExpressionSet method.

rows

A vector specifying which rows of the matrix to plot.

whichPlots

Which plots to draw. Can draw either a density plot, stripchart, or both.

xAxisLabel

The axis label for the expression axis.

yAxisLabels

A character vector of length 2. The first value is the y-axis label for the density plot. The second value is the y-axis labels for the stripchart. Provide both labels, even if only plotting one kind of plot.

expressionLimits

The minimum and maximum expression values to plot. Set to NULL to use range of data.

showXtickLabels

Logical. IF FALSE, the x-axis labels are hidden.

showYtickLabels

Logical. IF FALSE, the y-axis labels are hidden.

xLabelPositions

Either "auto" or a vector of values. The positions of labels on the x-axis. If "auto", the placement of labels is automatically calculated.

yLabelPositions

Either "auto" or a vector of values. The positions of labels on the y-axis. If "auto", the placement of labels is automatically calculated.

fontSizes

A vector of length 5. The first number is the size of the title. The second number is the size of the axes titles. The third number is the size of the axes values. The fourth number is the size of the legends' titles. The fifth number is the font size of the legend labels.

colours

The colours to plot data of each class in.

plot

Logical. If TRUE, a plot is produced on the current graphics device.

Value

Plots.

Author(s)

Dario Strbenac

Examples

  # First 25 samples are mixtures of two normals. Last 25 samples are one normal.
  genesMatrix <- sapply(1:25, function(geneColumn) c(rnorm(50, 5, 1), rnorm(50, 15, 1)))
  genesMatrix <- cbind(genesMatrix, sapply(1:25, function(geneColumn) rnorm(100, 9, 3)))
  classes <- factor(rep(c("Poor", "Good"), each = 25), levels = c("Good", "Poor"))
  chosen <- 1:5 # First five genes in the data were chosen.
                                     
  plotFeatureClasses(genesMatrix, classes, chosen, expressionLimits = NULL)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(ClassifyR)
Loading required package: Biobase
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
    get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
    match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
    rbind, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit

Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

Loading required package: BiocParallel
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/ClassifyR/plotFeatureClasses.Rd_%03d_medium.png", width=480, height=480)
> ### Name: plotFeatureClasses
> ### Title: Plot Density and Scatterplot for Genes By Class
> ### Aliases: plotFeatureClasses plotFeatureClasses,matrix-method
> ###   plotFeatureClasses,ExpressionSet-method
> 
> ### ** Examples
> 
>   # First 25 samples are mixtures of two normals. Last 25 samples are one normal.
>   genesMatrix <- sapply(1:25, function(geneColumn) c(rnorm(50, 5, 1), rnorm(50, 15, 1)))
>   genesMatrix <- cbind(genesMatrix, sapply(1:25, function(geneColumn) rnorm(100, 9, 3)))
>   classes <- factor(rep(c("Poor", "Good"), each = 25), levels = c("Good", "Poor"))
>   chosen <- 1:5 # First five genes in the data were chosen.
>                                      
>   plotFeatureClasses(genesMatrix, classes, chosen, expressionLimits = NULL)
`stat_bindot()` using `bins = 30`. Pick better value with `binwidth`.
`stat_bindot()` using `bins = 30`. Pick better value with `binwidth`.
`stat_bindot()` using `bins = 30`. Pick better value with `binwidth`.
`stat_bindot()` using `bins = 30`. Pick better value with `binwidth`.
`stat_bindot()` using `bins = 30`. Pick better value with `binwidth`.
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>