Last data update: 2014.03.03

R: Set Status of each Spot from List of Spot Types
controlStatusR Documentation

Set Status of each Spot from List of Spot Types

Description

Determine the type (or status) of each spot in the gene list.

Usage

controlStatus(types, genes, spottypecol="SpotType", regexpcol, verbose=TRUE)

Arguments

types

dataframe containing spot type specifiers, usually input using readSpotTypes.

genes

dataframe containing gene annotation, or an object of class RGList, MAList, EListRaw, EList or MArrayLM from which the gene annotation can be extracted.

spottypecol

integer or name specifying column of types containing spot type names.

regexpcol

vector of integers or column names specifying columns of types containing regular expressions. Defaults to any column names in common between types and genes.

verbose

logical, if TRUE then progess on pattern matching is reported to the standard output channel.

Details

This function constructs a vector of status codes by searching for patterns in the gene list. The data frame genes contains gene IDs and should have as many rows as there are spots on the microarrays. Such a data frame is often read using readGAL. The data frame types has as many rows as you want to distinguish types of spots in the gene list. This data frame should contain a column or columns, the regexpcol columns, which have the same names as columns in genes and which contain patterns to match in the gene list. Another column, the spottypecol, contains the names of the spot types. Any other columns are assumed to contain plotting parameters, such as colors or symbols, to be associated with the spot types.

The patterns in the regexpcol columns are simplified regular expressions. For example, AA* means any string starting with AA, *AA means any code ending with AA, AA means exactly these two letters, *AA* means any string containing AA, AA. means AA followed by exactly one other character and AA. means exactly AA followed by a period and no other characters. Any other regular expressions are allowed but the codes ^ for beginning of string and $ for end of string should not be included.

Note that the patterns are matched sequentially from first to last, so more general patterns should be included first. For example, it is often a good idea to include a default spot-type as the first line in types with pattern * for all regexpcol columns and default plotting parameters.

Value

Character vector specifying the type (or status) of each spot on the array. Attributes contain plotting parameters associated with each spot type.

Author(s)

Gordon Smyth

See Also

An overview of LIMMA functions for reading data is given in 03.ReadingData.

Examples

genes <- data.frame(
      ID=c("Control","Control","Control","Control","AA1","AA2","AA3","AA4"),
      Name=c("Ratio 1","Ratio 2","House keeping 1","House keeping 2",
             "Gene 1","Gene 2","Gene 3","Gene 4"))
types <- data.frame(
      SpotType=c("Gene","Ratio","Housekeeping"),
      ID=c("*","Control","Control"),
      Name=c("*","Ratio*","House keeping*"),
      col=c("black","red","blue"))
status <- controlStatus(types,genes)

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(limma)
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/limma/controlStatus.Rd_%03d_medium.png", width=480, height=480)
> ### Name: controlStatus
> ### Title: Set Status of each Spot from List of Spot Types
> ### Aliases: controlStatus
> ### Keywords: IO
> 
> ### ** Examples
> 
> genes <- data.frame(
+       ID=c("Control","Control","Control","Control","AA1","AA2","AA3","AA4"),
+       Name=c("Ratio 1","Ratio 2","House keeping 1","House keeping 2",
+              "Gene 1","Gene 2","Gene 3","Gene 4"))
> types <- data.frame(
+       SpotType=c("Gene","Ratio","Housekeeping"),
+       ID=c("*","Control","Control"),
+       Name=c("*","Ratio*","House keeping*"),
+       col=c("black","red","blue"))
> status <- controlStatus(types,genes)
Matching patterns for: ID Name 
Found 8 Gene 
Found 2 Ratio 
Found 2 Housekeeping 
Setting attributes: values col 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>