Last data update: 2014.03.03

R: Converts an expanded GO profile into a basic (contracted) GO...
contractedProfileR Documentation

Converts an expanded GO profile into a basic (contracted) GO profile

Description

Converts an object of class 'ExpandedGOProfile', or assimilable to it, in an object of class 'BasicGOProfile'

Usage

contractedProfile(prof, nams = NULL)
## S3 method for class 'ExpandedGOProfile'
contractedProfile(prof, nams = NULL)
## Default S3 method:
contractedProfile(prof, nams = NULL)

Arguments

prof

an expanded GO profile, i.e. and object of class 'ExpandedGOProfile', or a numeric vector assimilable to an expanded profile, see the "details" section

nams

optionally, the names of the annotated combinations of GO nodes whose frequency is represented in the expanded profile, see the "details" section

Details

Given a list of n genes, and a set of s GO nodes X, Y, Z, ... in a given ontology (BP, MF or CC), its associated (contracted) "profile" is the frequencies vector (either absolute or relative frequencies) of annotations or hits of the n genes in each node. For a given node, say X, this frequency includes all annotations for X alone, for X and Y, for X and Z and so on. Thus, as relative frequencies, its sum is not necessarily one, or as absolute frequencies their sum is not necessarily n. Basic contracted profiles are represented by objects of S3 class 'BasicGOProfile'. On the other hand, an "expanded profile" corresponds to the frequencies in ALL OBSERVED NODE COMBINATIONS. That is, if n genes have been profiled, the expanded profile stands for the frequency of all hits EXCLUSIVELY in nodes X, Y, Z, ..., jointly with all hits simultaneously in nodes X and Y (and only in X and Y), simultaneously in X and Z, in Y and Z, ... , in X and Y and Z (and only in X,Y,Z), and so on. Thus, their sum is one. Expanded profiles are represented by objects of S3 class 'ExpandedGOProfile'. The generic function 'contractedProfile' "contracts" an expanded profile, either represented by a 'ExpandedGOProfile' object or a numeric vector interpretable as an expanded profile, in order to obtain its contracted profile representation.

The rownames attribute of an 'ExpandedGOProfile' or, equivalently, the names attribute of a vector representing an expanded profile, or the nams argument, must represent the GO nodes combinations separating the node names with dots, ".", for example: "X", "Y", "Z", "X.Y", "X.Z", "Y.Z", "X.Y.Z" and so on.

Value

An object of class 'BasicGOProfile' the contracted profile representation of the expanded profile

Author(s)

Jordi Ocana

Examples

data(prostateIds)
expandedWelsh <- expandedProfile(welsh01EntrezIDs[1:100], onto="MF",
                        level=2, orgPackage="org.Hs.eg.db")
reContractedWelsh <- contractedProfile(expandedWelsh[["MF"]])
print(expandedWelsh)
print(reContractedWelsh)
class(reContractedWelsh)
ngenes(reContractedWelsh)

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(goProfiles)
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: AnnotationDbi
Loading required package: stats4
Loading required package: IRanges
Loading required package: S4Vectors

Attaching package: 'S4Vectors'

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

    colMeans, colSums, expand.grid, rowMeans, rowSums

Loading required package: GO.db

> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/goProfiles/contractedProfile.rd_%03d_medium.png", width=480, height=480)
> ### Name: contractedProfile
> ### Title: Converts an expanded GO profile into a basic (contracted) GO
> ###   profile
> ### Aliases: contractedProfile contractedProfile.ExpandedGOProfile
> ###   contractedProfile.default
> 
> ### ** Examples
> 
> data(prostateIds)
> expandedWelsh <- expandedProfile(welsh01EntrezIDs[1:100], onto="MF",
+                         level=2, orgPackage="org.Hs.eg.db")

> reContractedWelsh <- contractedProfile(expandedWelsh[["MF"]])
> print(expandedWelsh)
$MF
                 V1
4        0.01041667
7        0.01041667
9        0.43750000
19       0.01041667
2.9      0.01041667
3.9      0.03125000
4.9      0.10416667
5.9      0.01041667
7.9      0.12500000
8.9      0.01041667
8.19     0.01041667
9.19     0.03125000
2.3.9    0.01041667
4.5.9    0.01041667
4.7.9    0.02083333
4.8.9    0.02083333
4.9.19   0.02083333
5.8.9    0.01041667
5.9.18   0.01041667
7.9.19   0.01041667
8.9.18   0.01041667
2.3.4.9  0.01041667
4.5.9.18 0.04166667
4.8.9.19 0.01041667
5.8.9.19 0.01041667

> print(reContractedWelsh)
   Description GOID Frequency
4                 4        24
7                 7        16
9                 9        92
19               19        10
2                 2         3
3                 3         5
5                 5         9
8                 8         8
18               18         6
> class(reContractedWelsh)
[1] "BasicGOProfile" "data.frame"    
> ngenes(reContractedWelsh)
[1] 96
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>