Last data update: 2014.03.03

R: Plot a Grid of Sample Error Rates
errorMapR Documentation

Plot a Grid of Sample Error Rates

Description

A grid of coloured tiles is drawn. There is one column for each sample and one row for each classification result.

Usage

  ## S4 method for signature 'list'
errorMap(results,
                   comparison = c("classificationName", "datasetName", "selectionName", "validation"),
                   errorColours = list(c("#0000FF", "#3F3FFF", "#7F7FFF", "#BFBFFF", "#FFFFFF"),
                                       c("#FF0000", "#FF3F3F", "#FF7F7F", "#FFBFBF", "#FFFFFF")),
                   classColours = c("blue", "red"), fontSizes = c(24, 16, 12, 12, 12),
                   mapHeight = 4, title = "Error Comparison", showLegends = TRUE, xAxisLabel = "Sample Name", 
                   showXtickLabels = TRUE, showYtickLabels = TRUE, yAxisLabel = "Analysis",
                   legendSize = grid::unit(1, "lines"), plot = TRUE)

Arguments

results

A list of ClassifyResult objects.

comparison

The aspect of the experimental design to compare.

errorColours

A vector of colours for error levels.

classColours

Either a vector of colours for class levels if both classes should have same colour, or a list of length 2, with each component being a vector of the same length. The vector has the colour gradient for each class.

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.

mapHeight

Height of the map, relative to the height of the class colour bar.

title

The title to place above the plot.

showLegends

Logical. IF FALSE, the legend is not drawn.

xAxisLabel

The name plotted for the x-axis. NULL suppresses label.

showXtickLabels

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

showYtickLabels

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

yAxisLabel

The name plotted for the y-axis. NULL suppresses label.

legendSize

The size of the boxes in the legends.

plot

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

Details

The names of results determine the row names that will be in the plot. The length of errorColours determines how many bins the error rates will be discretised to.

Value

A plot is produced and a grob is returned that can be saved to a graphics device.

Author(s)

Dario Strbenac

Examples

  predicted <- data.frame(sample = sample(10, 100, replace = TRUE),
                          label = rep(c("Healthy", "Cancer"), each = 50))
  actual <- factor(rep(c("Healthy", "Cancer"), each = 5))
  result1 <- ClassifyResult("Example", "Differential Expression", "t-test",
                            LETTERS[1:10], LETTERS[10:1], list(1:100), list(sample(10, 10)),
                            list(predicted), actual, list("fold", 100, 5))
  predicted[, "label"] <- sample(predicted[, "label"])
  result2 <- ClassifyResult("Example", "Differential Variability", "F-test",
                            LETTERS[1:10], LETTERS[10:1], list(1:100), list(sample(10, 10)),
                            list(predicted), actual, validation = list("leave", 1))
  wholePlot <- errorMap(list(Gene = result1, Protein = result2))
  # if(require(ggplot2))
    # ggsave("wholePlot.png", wholePlot)

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/errorMap.Rd_%03d_medium.png", width=480, height=480)
> ### Name: errorMap
> ### Title: Plot a Grid of Sample Error Rates
> ### Aliases: errorMap errorMap,list-method
> 
> ### ** Examples
> 
>   predicted <- data.frame(sample = sample(10, 100, replace = TRUE),
+                           label = rep(c("Healthy", "Cancer"), each = 50))
>   actual <- factor(rep(c("Healthy", "Cancer"), each = 5))
>   result1 <- ClassifyResult("Example", "Differential Expression", "t-test",
+                             LETTERS[1:10], LETTERS[10:1], list(1:100), list(sample(10, 10)),
+                             list(predicted), actual, list("fold", 100, 5))
>   predicted[, "label"] <- sample(predicted[, "label"])
>   result2 <- ClassifyResult("Example", "Differential Variability", "F-test",
+                             LETTERS[1:10], LETTERS[10:1], list(1:100), list(sample(10, 10)),
+                             list(predicted), actual, validation = list("leave", 1))
>   wholePlot <- errorMap(list(Gene = result1, Protein = result2))
>   # if(require(ggplot2))
>     # ggsave("wholePlot.png", wholePlot)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>