GeneColorSet-class: Class "GeneColorSet"

Description Objects from the Class Slots Extends Methods Author(s) See Also Examples

Description

A GeneColorSet extends GeneSet to allow genes to be 'colored'. Coloring means that for a particular phenotype, each gene has a color (e.g., expression levels "up", "down", or "unchanged") and a phenotypic consequence (e.g., the phenotype is "enhanced" or "reduced").

All operations on a GeneSet can be applied to a GeneColorSet; coloring can also be accessed.

Objects from the Class

Construct a GeneColorSet with a GeneColorSet method. These methods are identical to those for GeneSet, except they require an additional phenotype argument to specify the phenotype to which the genetic and phenotypic coloring apply. A GeneColorSet can be constructed from a GeneSet with GeneColorSet(<GeneSet>, phenotype="<phenotype>").

Slots

A GeneColorSet inherits all slots from GeneSet, and gains the following slots:

phenotype:

Object of class "ScalarCharacter" describing the phenotype for which this gene set is colored.

geneColor:

Object of class "factor" describing the coloring of each gene in the set. The lengths of geneColor and gene must be equal.

phenotypeColor:

Object of class "factor" describing the phenotypic coloring of each gene in the set. The lengths of phenotypeColor and gene must be equal.

Extends

Class "GeneSet", directly.

Methods

Methods unique to GeneColorSet include:

coloring

signature(object = "GeneColorSet"): retrieve coloring as a data.frame. The row names of the data frame are the gene names; the columns are geneColor and phenotypeColor.

coloring<-

signature(object = "GeneColorSet", value = "data.frame"): use a data frame to assign coloring information. The data.frame must have the same number of rows as the GeneColorSet has genes (though see the examples below for flexible ways to alter coloring of a subset of genes). Row names of the data.frame correspond to gene names. The data frame has two columns, named geneColor and phenotypeColor. These must be of class factor.

A typical use of coloring<- is to simultaneous extract, subset, and reassign the current coloring, e.g., coloring(<GeneColorSet>)[1:5,"geneColor"] <- "up"; see the examples below.

geneColor<-

signature(object = "GeneColorSet", value = "factor"): assign gene colors.

geneColor

signature(object = "GeneColorSet"): retrieve gene colors as a factor.

phenotypeColor<-

signature(object = "GeneColorSet", value = "factor"): assign phenotype colors.

phenotypeColor

signature(object = "GeneColorSet"): retrieve phenotype colors as a factor.

phenotype<-

signature(object = "GeneColorSet", value = "character"): assign the phenotype from a single-element character vector.

phenotype

signature(object = "GeneColorSet"): retrieve the phenotype as a single-element character.

GeneColorSet inherits all methods from class GeneSet. Methods with different behavior include

[

signature(x = "GeneSet", i="character") signature(x = "GeneSet", i="numeric"): subset the gene set by index (i="numeric") or gene value (i="character"). Genes are re-ordered as required. geneColor and phenotypeColor are subset as appropriate.

[[

signature(x = "GeneSet"): select a single gene from the gene set, returning a named character vector of gene, geneColor, phenotypeColor. Exact matches only.

\$

signature(x = "GeneSet"): select a single gene from the gene set, returning a named character vector of gene, geneColor, phenotypeColor. Provides partial matching into the list of genes.

mapIdentifiers

signature(x="GeneColorSet", to="*", from="*"): checks that gene- and phenotype colors are consistent for mapped identifiers, e.g., that two AnnotationIdentifiers mapping to the same SymbolIdentifier are colored the same.

Logical (set) operations &, |, setdiff warn if the phenotype geneColor, or phenotypeColor differs between sets; this implies coercion of factor levels, and the consequences should be carefully considered.

Author(s)

Martin Morgan <Martin.Morgan@RoswellPark.org>

See Also

GeneSet.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## Create a GeneColorSet from an ExpressionSet
data(sample.ExpressionSet)
gcs1 <- GeneColorSet(sample.ExpressionSet[100:109],
                     phenotype="imaginary")
gcs1
## or with color...
gcs2 <- GeneColorSet(sample.ExpressionSet[100:109],
                     phenotype="imaginary",
                     geneColor=factor(
                       rep(c("up", "down", "unchanged"),
                           length.out=10)),
                     phenotypeColor=factor(
                       rep(c("enhanced", "reduced"),
                           length.out=10)))
coloring(gcs2)

## recode geneColor of genes 1 and 4
coloring(gcs2)[c(1,4),"geneColor"] <- "down"
coloring(gcs2)
## reset, this time by gene name
coloring(gcs2)[c("31339_at", "31342_at"),"geneColor"] <- c("up", "up")
## usual 'factor' errors and warning apply:
coloring(gcs2)[c("31339_at", "31342_at"),"geneColor"] <- c("UP", "up")

gcs2[["31342_at"]]
try(gcs2[["31342_"]]) # no partial matching
gcs2$"31342" # 1 partial match ok

GSEABase documentation built on Dec. 13, 2020, 2 a.m.