nea.render: Network Enrichment Analysis (NEA)

Description Usage Arguments Details Value References See Also Examples

View source: R/nea-render.r

Description

Given the altered gene sets (AGS), functional gene sets (FGS) and the network, calculates enrichment statistics based on the number of edges (network links) that connect individual genes in each AGS-FGS pair (edges confined within AGS only or FGS only are not taken into account). Returns relevant statistics in matrices of size length(FGS) x length(AGS) (see "Value"). Each of the first three parameters can be submitted as either a text file or as a list which has been preloaded with import.gs and import.net. The latter scenario could save much time in a batch mode(see Details).

Usage

1
2
3
4
nea.render(AGS, FGS, NET, Lowercase = 1, ags.gene.col = 2,
  ags.group.col = 3, fgs.gene.col = 2, fgs.group.col = 3,
  net.gene1.col = 1, net.gene2.col = 2, echo = 1, graph = FALSE,
  na.replace = 0, members = FALSE, digitalize = TRUE, Parallelize = 1)

Arguments

AGS

Either a text file or a list of members of each AGS (see Details). Group IDs should be found in ags.group.col and gene IDs should be found in ags.gene.col. As a special option, an AGS list can also be pre-created from raw data matrices of the format "genes X samples". Such matrices can contain information on gene copy number, gene/protein expression, gene methylation etc (samples2ags) or point mutation data (mutations2ags). These two functions return AGS lists of length=ncol(Nsamples).

FGS

Either a text file or a list of members of each FGS (see Details). Group IDs should be found in fgs.group.col and gene IDs should be found in fgs.gene.col. As an alternative, this function can use single-node FGSs from the network nodes, which should be pre-created with as_genes_fgs. In this case each network node X becomes an FGS on its own. Respective names in the FGS list equal 'X' and the content becomes c('X'). The total length of the FGS list then equals the no. of nodes in the network. If fewer nodes are needed for such single-node analysis, then one can submit a text file in which fgs.gene.col and fgs.group.col contain identical gene IDs. This option uses as_genes_fgs.

NET

The global network for the analysis (see Details) .

Lowercase

render node and group IDs lower-case (default:1, i.e. 'yes').

ags.gene.col

number of the column containing AGS genes (only needed if AGS is submitted as a text file).

ags.group.col

number of the column containing group IDs (only needed if AGS is submitted as a text file).

fgs.gene.col

number of the column containing FGS genes (only needed if FGS is submitted as a text file).

fgs.group.col

number of the column containing group IDs (only needed if FGS is submitted as a text file).

net.gene1.col

number of the column containing first nodes of each network edge (only needed if NET is submitted as a text file).

net.gene2.col

number of the column containing second nodes of each network edge (only needed if NET is submitted as a text file).

echo

if messages about execution progress should appear.

graph

Plot the heat map

na.replace

replace NA values. Default=0, i.e. not to replace

members

If matrices members.fgs and members.fgs should be created in addition (time- and memory-consuming). These matrices contain lists of genes that contributed to respective AGSxFGS enrichment statistic.

digitalize

If the node ID strings should be converted to internal integer ID, and then back to present the results (can speed up the computation). Since this procedure also takes some time, setting digitalize=TRUE only makes sense for large computations, with a big network, many FGS and/or AGS.

Parallelize

The number of CPU cores to be used for the step "Counting actual links" (the other steps are sufficiently fast). The option is not supported on Windows.

Details

both AGS and FGS can be either
1) a list preloaded from a text file using e.g. GS=import.gs("text_file.groups"); names of the list entries are gene set IDs and the entries contain gene/protein IDs that belong to the respective set or
2) name of the file "text_file.groups" to be read from the disk using import.gs.
The TAB-delimited file "text_file.groups" should contain pre-compiled gene sets, so that gene set IDs will be found in column ags.group.col / fgs.group.col and gene IDs will be found in ags.gene.col / fgs.gene.col. Option (1) is much more efficient than (2) when nea.render has to be run multiple times. Similarly to AGS and FGS, NET could be submitted as either a list, pre-loaded with import.net, or a text TAB-delimited file where two columns net.gene1.col and net.gene2.col represent nodes of respective edges.

Value

An object, i.e. a list of elements n.actual, n.expected, chi, z, p, q, each of which is a matrix of size length(FGS) x length(AGS). The two former ones contain the number of network edges between any nodes of AGS and any nodes of FGS, respectively those observed in the actual network and expected by chance. chi are the original chi-squared network enrichment statistic values. z are respective z-scores which are normally distributed under null and are thus suitable as input to regression modelling and other parametric methods. p and q are p-values and respective FDR estimates from p.adjust(p, method="BH").

References

https://bmcbioinformatics.biomedcentral.com/articles/10.1186/s12859-017-1534-y

See Also

samples2ags

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
ags.list <- samples2ags(fantom5.43samples, Ntop=20, method="topnorm")
data(can.sig.go)
fpath <- can.sig.go
fgs.list <- import.gs(fpath)
summary(fgs.list)
data(net.kegg)
netpath <- net.kegg
net <- import.net(netpath)
n1 <- nea.render(AGS=ags.list[1:10], FGS=fgs.list[1:10], NET=net, graph=FALSE)
hist(n1$chi, breaks=100)
hist(n1$z, breaks=100)
hist(n1$p, breaks=100)
hist(n1$q, breaks=100)

NEArender documentation built on March 22, 2018, 1:05 a.m.