Last data update: 2014.03.03

R: Class DEResult
DEResultR Documentation

Class DEResult

Description

Class to contain and describe results of a differential expression (DE) analysis. The main components are statistic which hold the results of any statistic (e.g. p-values, PPLR values, etc.), and FC which hold the fold changes.

Creating Objects

DEResult objects will generally be created using one of the functions pumaDE, calculateLimma, calculateFC or calculateTtest.

Objects can also be created from scratch:

new("DEResult")

new("DEResult", statistic=matrix() , FC=matrix() , statisticDescription="unknown" , DEMethod="unknown" )

Slots

statistic:

Object of class "matrix" holding the statistics returned by the DE method.

FC:

Object of class "matrix" holding the fold changes returned by the DE method.

statisticDescription:

A text description of the contents of the statistic slot.

DEMethod:

A string indicating which DE method was used to create the object.

Methods

Class-specific methods.

statistic(DEResult), statistic(DEResult,matrix)<-

Access and set the statistic slot.

FC(DEResult), FC(DEResult,matrix)<-

Access and set the FC slot.

statisticDescription(DEResult), statisticDescription(DEResult,character)<-

Access and set the statisticDescription slot.

DEMethod(DEResult), DEMethod(DEResult,character)<-

Access and set the DEMethod slot.

pLikeValues(object, contrast=1, direction="either")

Access the statistics of an object of class DEResult, converted to "p-like values". If the object holds information on more than one contrast, only the values of the statistic for contrast number contrast are given. Direction can be "either" (meaning we want order genes by probability of being either up- or down-regulated), "up" (meaning we want to order genes by probability of being up-regulated), or "down" (meaning we want to order genes by probability of being down-regulated). "p-like values" are defined as values between 0 and 1, where 0 identifies the highest probability of being differentially expressed, and 1 identifies the lowest probability of being differentially expressed. We use this so that we can easily compare results from methods that provide true p-values (e.g. calculateLimma) and methods methods that do not provide p-values (e.g. pumaDE). For objects created using pumaDE, this returns 1-PPLR if the direction is "up", PPLR if direction is "down", and 1-abs(2*(PPLR-0.5)) if direction is "either". For objects created using calculateLimma or calculateTtest, this returns the p-value if direction is "either", ((p-1 * sign(FC))/2)+ 0.5, if the direction is "up", and ((1-p * sign(FC))/2)+ 0.5 if the direction is "down". For all other methods, this returns the rank of the appropriate statistic, scaled to lie between 0 and 1. contrast will be returned.

topGenes(object, numberOfGenes=1, contrast=1, direction="either")

Returns the index numbers (row numbers) of the genes determined to be most likely to be differentially expressed. numberOfGenes specifies the number of genes to be returned by the function. If the object holds information on more than one contrast, only the values of the statistic for contrast number contrast are given. Direction can be "either" (meaning we want order genes by probability of being either up- or down-regulated), "up" (meaning we want to order genes by probability of being up-ragulated), or "down" (meaning we want to order genes by probability of being down-regulated). Note that genes are ordered by "p-like values" (see pLikeValues). object is an object of class DEResult.

topGeneIDs(object, numberOfGenes=1, contrast=1, direction="either")

Returns the Affy IDs (row names) of the genes determined to be most likely to be differentially expressed. numberOfGenes specifies the number of genes to be returned by the function. If the object holds information on more than one contrast, only the values of the statistic for contrast number contrast are given. Direction can be "either" (meaning we want order genes by probability of being either up- or down-regulated), "up" (meaning we want to order genes by probability of being up-ragulated), or "down" (meaning we want to order genes by probability of being down-regulated). Note that genes are ordered by "p-like values" (see pLikeValues). object is an object of class DEResult.

numberOfProbesets(object)

Returns the number of probesets (number of rows) in an object of class DEResult. This method is synonymous with numberOfGenes.

numberOfGenes(object)

Returns the number of probesets (number of rows) in an object of class DEResult. This method is synonymous with numberOfProbesets.

numberOfContrasts(object)

Returns the number of contrasts (number of columns) in an object of class DEResult.

write.reslts(object)

signature(x = "DEResult"): writes the statistics and related fold changes (FCs) to files. It takes the same arguments as write.table. The argument "file" does not need to set any extension. The different file marks and extension "csv" will be added automatically. The default file name is "tmp". In the final results, statistics are in the file "tmp_statistics.csv", and FCs are in "tmp_FCs.csv" respectively.

Standard generic methods:

show(object)

Informatively display object contents.

Author(s)

Richard D. Pearson

See Also

Related methods pumaDE, calculateLimma, calculateFC or calculateTtest.

Examples

## Create an example DEResult object
#	Next 4 lines commented out to save time in package checks, and saved version used
# if (require(affydata)) {
#	data(Dilution)
#	eset_mmgmos <- mmgmos(Dilution)
# }
data(eset_mmgmos)

#	Next line used so eset_mmgmos only has information about the liver factor
#	The scanner factor will thus be ignored, and the two arrays of each level
#	of the liver factor will be treated as replicates
pData(eset_mmgmos) <- pData(eset_mmgmos)[,1,drop=FALSE]

#	To save time we'll just use 100 probe sets for the example
eset_mmgmos_100 <- eset_mmgmos[1:100,]
eset_comb <- pumaComb(eset_mmgmos_100)

esetDE <- pumaDE(eset_comb)

## Use some of the methods
statisticDescription(esetDE)
DEMethod(esetDE)
numberOfProbesets(esetDE)
numberOfContrasts(esetDE)
topGenes(esetDE)
topGenes(esetDE, 3)
pLikeValues(esetDE)[topGenes(esetDE,3)]
topGeneIDs(esetDE, 3)
topGeneIDs(esetDE, 3, direction="down")

## save the expression results into files
write.reslts(esetDE, file="example")

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(puma)
Loading required package: oligo
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

Loading required package: oligoClasses
Welcome to oligoClasses version 1.34.0
Loading required package: Biobase
Welcome to Bioconductor

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

Loading required package: Biostrings
Loading required package: S4Vectors
Loading required package: stats4

Attaching package: 'S4Vectors'

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

    colMeans, colSums, expand.grid, rowMeans, rowSums

Loading required package: IRanges
Loading required package: XVector
================================================================================
Welcome to oligo version 1.36.1
================================================================================
Loading required package: mclust
Package 'mclust' version 5.2
Type 'citation("mclust")' for citing this R package in publications.
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/puma/DEResult-class.Rd_%03d_medium.png", width=480, height=480)
> ### Name: DEResult
> ### Title: Class DEResult
> ### Aliases: class:DEResult DEResult DEResult-class statistic statistic<-
> ###   FC FC<- statisticDescription statisticDescription<- DEMethod
> ###   DEMethod<- pLikeValues topGenes topGeneIDs numberOfProbesets
> ###   numberOfGenes numberOfContrasts statistic,DEResult-method
> ###   statistic<-,DEResult,matrix-method FC,DEResult-method
> ###   FC<-,DEResult,matrix-method statisticDescription,DEResult-method
> ###   statisticDescription<-,DEResult,character-method
> ###   DEMethod,DEResult-method DEMethod<-,DEResult,character-method
> ###   pLikeValues,DEResult-method topGenes,DEResult-method
> ###   topGeneIDs,DEResult-method numberOfProbesets,DEResult-method
> ###   numberOfGenes,DEResult-method numberOfContrasts,DEResult-method
> ###   show,DEResult-method write.reslts,DEResult-method
> ### Keywords: classes
> 
> ### ** Examples
> 
> ## Create an example DEResult object
> #	Next 4 lines commented out to save time in package checks, and saved version used
> # if (require(affydata)) {
> #	data(Dilution)
> #	eset_mmgmos <- mmgmos(Dilution)
> # }
> data(eset_mmgmos)
> 
> #	Next line used so eset_mmgmos only has information about the liver factor
> #	The scanner factor will thus be ignored, and the two arrays of each level
> #	of the liver factor will be treated as replicates
> pData(eset_mmgmos) <- pData(eset_mmgmos)[,1,drop=FALSE]
> 
> #	To save time we'll just use 100 probe sets for the example
> eset_mmgmos_100 <- eset_mmgmos[1:100,]
> eset_comb <- pumaComb(eset_mmgmos_100)
Calculating expected completion time
pumaComb expected completion time is 21 seconds 
.......20%.......40%.......60%.......80%......100%
..................................................
> 
> esetDE <- pumaDE(eset_comb)
> 
> ## Use some of the methods
> statisticDescription(esetDE)
[1] "Probability of Positive Log Ratio (PPLR)"
> DEMethod(esetDE)
[1] "pumaDE"
> numberOfProbesets(esetDE)
[1] 100
> numberOfContrasts(esetDE)
[1] 1
> topGenes(esetDE)
[1] 48
> topGenes(esetDE, 3)
[1] 48 53 85
> pLikeValues(esetDE)[topGenes(esetDE,3)]
1043_s_at   1048_at   1077_at 
0.2917025 0.3807863 0.4518201 
> topGeneIDs(esetDE, 3)
[1] "1043_s_at" "1048_at"   "1077_at"  
> topGeneIDs(esetDE, 3, direction="down")
[1] "1077_at"   "103_at"    "1029_s_at"
> 
> ## save the expression results into files
> write.reslts(esetDE, file="example")
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>