GeneColorSet-class         package:GSEABase         R Documentation

_C_l_a_s_s "_G_e_n_e_C_o_l_o_r_S_e_t"

_D_e_s_c_r_i_p_t_i_o_n:

     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.

_O_b_j_e_c_t_s _f_r_o_m _t_h_e _C_l_a_s_s:

     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>").'

_S_l_o_t_s:

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

     '_p_h_e_n_o_t_y_p_e': Object of class '"ScalarCharacter"' describing the
          phenotype for which this gene set is colored.

     '_g_e_n_e_C_o_l_o_r': Object of class '"factor"' describing the coloring of
          each gene in the set. The lengths of 'geneColor' and 'gene'
          must be equal.

     '_p_h_e_n_o_t_y_p_e_C_o_l_o_r': Object of class '"factor"' describing the
          phenotypic coloring of each gene in the set. The lengths of
          'phenotypeColor' and 'gene' must be equal.

_E_x_t_e_n_d_s:

     Class '"GeneSet"', directly.

_M_e_t_h_o_d_s:

     Methods unique to 'GeneColorSet' include:

     _c_o_l_o_r_i_n_g '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'.

     _c_o_l_o_r_i_n_g<- '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.

     _g_e_n_e_C_o_l_o_r<- 'signature(object = "GeneColorSet", value =
          "factor")': assign gene colors. 

     _g_e_n_e_C_o_l_o_r 'signature(object = "GeneColorSet")': retrieve gene
          colors as a 'factor'.

     _p_h_e_n_o_t_y_p_e_C_o_l_o_r<- 'signature(object = "GeneColorSet", value =
          "factor")': assign phenotype colors.

     _p_h_e_n_o_t_y_p_e_C_o_l_o_r 'signature(object = "GeneColorSet")': retrieve
          phenotype colors as a 'factor'.

     _p_h_e_n_o_t_y_p_e<- 'signature(object = "GeneColorSet", value =
          "character")': assign the phenotype from a single-element
          character vector.

     _p_h_e_n_o_t_y_p_e '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.

     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.

_A_u_t_h_o_r(_s):

     Martin Morgan <mtmorgan@fhcrc.org>

_S_e_e _A_l_s_o:

     'GeneSet'.

_E_x_a_m_p_l_e_s:

     ## 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

