| Title: | Network Enrichment Analysis |
|---|---|
| Description: | Performs network enrichment analysis against functional gene sets. Benchmarks networks. Renders raw gene profile matrices of dimensionality "N genes x N samples" into the space of gene set (typically pathway) enrichment scores of dimensionality "N pathways x N samples". |
| Authors: | Andrey Alexeyenko [aut, cph, ths], Ashwini Jeggari [aut, cre] |
| Maintainer: | Ashwini Jeggari <[email protected]> |
| License: | GPL-3 |
| Version: | 1.5 |
| Built: | 2026-11-28 17:11:13 UTC |
| Source: | https://github.com/cran/NEArender |
Each network node X becomes an FGS itself, so that e.g. each ID 'X' generates a list entry named 'X', the content of which is c('X'), i.e. this same gene/protein. The total length of the FGS list then equals the number of nodes in the network. This is a way to create single-gene "quasi-pathways" for a more specific network enrichment analysis.
as_genes_fgs(Net.list, Lowercase = 1)as_genes_fgs(Net.list, Lowercase = 1)
Net.list |
the global network object, pre-created using |
Lowercase |
render gene/protein IDs lower-case (Default:1) |
data(net.kegg) net <- import.net(net.kegg) fgs.genes <- as_genes_fgs(net) print(fgs.genes[1:10])data(net.kegg) net <- import.net(net.kegg) fgs.genes <- as_genes_fgs(net) print(fgs.genes[1:10])
Tests the ability of a given network to perform well in a network enrichment analysis. It executes a series of multiple individual tests: for each member gene of a pathway or another functional set calculates the network enrichment score against other members of the same gene set. This procedure gives true positive and false negative test results. In order to complement it with false positives and true negatives, the same is done for randomly picked genes (with matching node connectivity values) against the same functional sets. The two vectors allow plotting a ROC curve where at each sequential cutoff represents a ratio of true positive vs. false positive predictions. This approach (first presented in Merid et al. (2012)) is an alternative to the trivial counting edges shared between different networks and is superior to the latter because: 1) the analysis can be done without knowing the "true" reference network, 2) benchmarks can be context-dependent by using domain-specific test sets (e.g. cancer, diabetes etc.), 3) one can compare more than two networks at a time, and 4) given dense global networks and due to the use of multi-gene sets, presence or absence of particular links is unlikely to affect the overall result.
benchmark(NET, GS, gs.gene.col = 2, gs.group.col = 3, net.gene1.col = 1, net.gene2.col = 2, echo = 1, graph = FALSE, na.replace = 0, mask = ".", minN = 0, coff.z = 1.965, coff.fdr = 0.1, Parallelize = 1)benchmark(NET, GS, gs.gene.col = 2, gs.group.col = 3, net.gene1.col = 1, net.gene2.col = 2, echo = 1, graph = FALSE, na.replace = 0, mask = ".", minN = 0, coff.z = 1.965, coff.fdr = 0.1, Parallelize = 1)
NET |
A network to benchmark. See Details in |
GS |
a test set, typically a set of pathways with known members. |
gs.gene.col |
number of the column containing GS genes (only needed if GS is submitted as a text file) |
gs.group.col |
number of the column containing group IDs (only needed if GS 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 ROC curve immediately. Alternatively, the returned list is plotted afterwards by |
na.replace |
replace NA values. Default=0, i.e. do not replace. |
mask |
when the test set contains various GSs, they can be used selectively by applying a mask. The mask follows the regular expression synthax, since |
minN |
the minimal number of network edges that must connect a tested member with the GS genes for the test to be considered positive. (Default:0). |
coff.z |
a parameter to |
coff.fdr |
to make significance levels comparable between different curves, the point where FDR= |
Parallelize |
The number of CPU cores to be used for the step "Counting actual links" (while the other steps are sufficiently fast). The option is not supported in Windows. |
The function would either plot a ROC curve for the analyzed network, or return an object with the following slots from function prediction (package ROCR):
tp, vector of true positives;
fp, vector of false positives;
tn, vector of true negatives;
fn, vector of false negatives;
cutoffs, z-score cutoffs from nea.render;
cross.z, a z-score value which corresponds to FDR=coff.fdr (will be denoted with a special marker at the curve);
An object, i.e. a list of three equal-length vectors from a prediction object of ROCR package (prediction@cutoffs, prediction@fp, prediction@tp) and the point that matches coff.fdr. These are needed to plot a ROC curve for the given network and test set by using roc.
http://www.biomedcentral.com/1471-2105/15/308
data(can.sig.go); fpath <- can.sig.go gs.list <- import.gs(fpath, Lowercase = 1, col.gene = 2, col.set = 3); data(net.kegg) netpath <- net.kegg net <- import.net(netpath) b0 <- benchmark (NET = net, GS = gs.list, echo=1, graph=TRUE, na.replace = 0, mask = ".", minN = 0, coff.z = 1.965, coff.fdr = 0.1, Parallelize=2); ## Not run: ## Benchmark a number of networks on GO terms and KEGG pathways separately, using masks: b1 <- NULL; for (mask in c("kegg_", "go_")) { b1[[mask]] <- NULL; for (file.net in c("netpath")) { # a series of networks can be put here: c("netpath1", "netpath2", "netpath3") net <- import.net(netpath, col.1 = 1, col.2 = 2, Lowercase = 1, echo = 1) b1[[mask]][[file.net]] <- benchmark (NET = net, GS = gs.list, echo=1, graph=FALSE, na.replace = 0, mask = mask, minN = 0, Parallelize=1); }} par(mfrow=c(2,1)); roc(b1[["kegg_"]], coff.z = 2.57,main="kegg_"); roc(b1[["go_"]], coff.z = 2.57,main="go_"); ## End(Not run)data(can.sig.go); fpath <- can.sig.go gs.list <- import.gs(fpath, Lowercase = 1, col.gene = 2, col.set = 3); data(net.kegg) netpath <- net.kegg net <- import.net(netpath) b0 <- benchmark (NET = net, GS = gs.list, echo=1, graph=TRUE, na.replace = 0, mask = ".", minN = 0, coff.z = 1.965, coff.fdr = 0.1, Parallelize=2); ## Not run: ## Benchmark a number of networks on GO terms and KEGG pathways separately, using masks: b1 <- NULL; for (mask in c("kegg_", "go_")) { b1[[mask]] <- NULL; for (file.net in c("netpath")) { # a series of networks can be put here: c("netpath1", "netpath2", "netpath3") net <- import.net(netpath, col.1 = 1, col.2 = 2, Lowercase = 1, echo = 1) b1[[mask]][[file.net]] <- benchmark (NET = net, GS = gs.list, echo=1, graph=FALSE, na.replace = 0, mask = mask, minN = 0, Parallelize=1); }} par(mfrow=c(2,1)); roc(b1[["kegg_"]], coff.z = 2.57,main="kegg_"); roc(b1[["go_"]], coff.z = 2.57,main="go_"); ## End(Not run)
Example functional gene sets (FGS) from GO and KEGG
data(can.sig.go)data(can.sig.go)
An object, i.e. a list with FGS IDs as names and vectors of gene IDs as member (34 FGSs in total). See see import.gs
head(can.sig.go)head(can.sig.go)
Function for plotting node degree distribution in order to test if the network is scale-free
connectivity(NET, Lowercase = 1, col.1 = 1, col.2 = 2, col.score = 3, echo = 1, main = "Connectivity plot", min.score = NA, n.top = NA, hex = FALSE)connectivity(NET, Lowercase = 1, col.1 = 1, col.2 = 2, col.score = 3, echo = 1, main = "Connectivity plot", min.score = NA, n.top = NA, hex = FALSE)
NET |
Input network file. |
Lowercase |
If node IDs should be rendered lower-case (Default:1, i.e. 'yes'). |
col.1 |
Number of column where 1st node of each edge should be found (only needed when NET is a text file rather than a list). |
col.2 |
Number of column where 2nd node of each edge should be found (only needed when NET is a text file rather than a list, i.e. passed down to import.net). |
col.score |
Number of column where edge confidence score is found (only needed when NET is a text file rather than a list, i.e. passed down to import.net). |
echo |
If messages about execution progress should appear. |
main |
title name for the plot, default: "Connectivity plot" |
min.score |
Minimum confidence score for an edge to be included in the network (is alternative to n.top and is only used when NET is a text file rather than a list, i.e. passed down to import.net). |
n.top |
Number of edges to be included in the network, top when ranked by confidence score (is alternative to min.score and only used when NET is a text file rather than a list, i.e. passed down to import.net). |
hex |
If the node degree distribution should be presented as density plot using package hexbin. |
benchmark and import.net
file <- system.file("extdata", "Connectivity.FC1_full", package = "NEArender") connect <- connectivity(file,hex=TRUE)file <- system.file("extdata", "Connectivity.FC1_full", package = "NEArender") connect <- connectivity(file,hex=TRUE)
A Fantom5 transcriptomes in 43 carincinoma cell samples
data(fantom5.43samples)data(fantom5.43samples)
An expression data matrix with the genes as rows and columns as cell line samples
colnames(fantom5.43samples)colnames(fantom5.43samples)
A binomial version of GSEA, unified as much as possible with nea.render. Given the altered gene sets (AGS) and functional gene sets (FGS), calculates no. of members (genes/protein IDs) shared by each AGS-FGS pair as well as respective enrichment statistics. Returns matrices of size length(FGS) x length(AGS) (see "Value"). Each of these two parameters can be submitted as either a text file or as an R list which have been preloaded with import.gs.
gsea.render(AGS, FGS, Lowercase = 1, ags.gene.col = 2, ags.group.col = 3, fgs.gene.col = 2, fgs.group.col = 3, echo = 1, Ntotal = 20000, Parallelize = 1)gsea.render(AGS, FGS, Lowercase = 1, ags.gene.col = 2, ags.group.col = 3, fgs.gene.col = 2, fgs.group.col = 3, echo = 1, Ntotal = 20000, Parallelize = 1)
AGS |
Either a text file or a list of members of each AGS (see Details). Group IDs should be found in |
FGS |
Either a text file or a list of members of each FGS (see Details). Group IDs should be found in |
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). |
echo |
if messages about execution progress should appear. |
Ntotal |
The important parameter for precise calculation of the Fisher's statistics: how big is the whole gene universe? Defaults to 20000 but should be changed depending on the hypothesis and genome/proteome size. |
Parallelize |
The number of CPU cores to be used for calculating the gene set overlap. The other steps are sufficiently fast. The option is not supported in Windows. |
A list of entries estimate, p, q, and n, each of which is a matrix of size length(FGS) x length(AGS). The two former ones contain respective output of fisher.test: p.value and estimate, whereas q is produced by p.adjust(p.value, method="BH") and n is the no. of shared members. Input to fisher.test is matrix(c(<no. of shared members>, <no. of solely FGS members>, <no. of solely AGS members>, <no. of non-members>), nrow=2).
ags.list <- samples2ags(fantom5.43samples, Ntop=20, method="topnorm") data(can.sig.go) fpath <- can.sig.go fgs.list <- import.gs(fpath) g1 <- gsea.render(AGS=ags.list, FGS=fgs.list, Lowercase = 1, ags.gene.col = 2, ags.group.col = 3, fgs.gene.col = 2, fgs.group.col = 3, echo=1, Ntotal = 20000, Parallelize=1) hist(g1$estimate, breaks=100) hist(g1$n, breaks=100) hist(g1$p, breaks=100) hist(g1$q, breaks=100)ags.list <- samples2ags(fantom5.43samples, Ntop=20, method="topnorm") data(can.sig.go) fpath <- can.sig.go fgs.list <- import.gs(fpath) g1 <- gsea.render(AGS=ags.list, FGS=fgs.list, Lowercase = 1, ags.gene.col = 2, ags.group.col = 3, fgs.gene.col = 2, fgs.group.col = 3, echo=1, Ntotal = 20000, Parallelize=1) hist(g1$estimate, breaks=100) hist(g1$n, breaks=100) hist(g1$p, breaks=100) hist(g1$q, breaks=100)
Imports a TAB-delimited AGS or FGS file.
Checks the format of the given FGS file. Reads in unique gene/protein IDs from the given file tbl so that the created object can be directly submitted to nea.render and gsea.render. The function import.gs will be automatically called from nea.render if parameters AGS and/or FGS of the latter correspond to text files rather than lists.
import.gs(tbl, Lowercase = 1, col.gene = 2, col.set = 3, gs.type = "", header = FALSE)import.gs(tbl, Lowercase = 1, col.gene = 2, col.set = 3, gs.type = "", header = FALSE)
tbl |
Input TAB-delimited FGS file. |
Lowercase |
render gene/protein IDs lower-case. |
col.gene |
Number of the column with gene/protein IDs in the input file. |
col.set |
Number of the column with set (sample, pathway etc.) IDs in the input file.
Special options:
|
gs.type |
GS type, 'a' produces AGS, 'f' produces FGS. |
header |
assign logical value (TRUE/FALSE) to consider the first line as header from the input file (default:FALSE). |
A list with entry names that correspond AGS/FGS IDs in the input file and gene/protein IDs as elements of each entry.
data(can.sig.go) fpath <- can.sig.go fgs.list <- import.gs(fpath) summary(fgs.list)data(can.sig.go) fpath <- can.sig.go fgs.list <- import.gs(fpath) summary(fgs.list)
This function reads in a TAB-delimited file with the global network data needed for NEA. Checks the format of the given NETWORK file, processes unique genes from the given network file, and counts the network links.
import.net(tbl, Lowercase = 1, col.1 = 1, col.2 = 2, col.score = 3, min.score = NA, n.top = NA, echo = 1)import.net(tbl, Lowercase = 1, col.1 = 1, col.2 = 2, col.score = 3, min.score = NA, n.top = NA, echo = 1)
tbl |
Input network file. |
Lowercase |
Render gene/protein IDs lower-case. |
col.1 |
Number of the column in the input file that corresponds to node 1 (gene/protein ID). |
col.2 |
Number of the column in the input file that corresponds to node 2 (gene/protein ID). |
col.score |
Number of column where edge confidence score is found. |
min.score |
Minimum confidence score for an edge to be included in the network. |
n.top |
Number of edges to be included in the network, top when ranked by confidence score (is alternative to min.score). |
echo |
if execution progress should be reported. |
$Ntotal, the total number of edges in the network and $links, an object with members (named by gene/protein IDs) that correspond to each node in the global network. Each entry of the list $links contains a vector of neighbours of the respective node.
data(net.kegg) net <- import.net(net.kegg) summary(net$links) print(paste(names(net$links)[100], net$links[[100]], sep=": "))data(net.kegg) net <- import.net(net.kegg) summary(net$links) print(paste(names(net$links)[100], net$links[[100]], sep=": "))
Imports a TAB-delimited file with mutations.
This function creates a new list of AGSs from a table listing point (or otherwise qualitatively defined) mutations. Such a matrix M typically has size Ngenes x Nsamples, so that the current function returns a list of length=ncol(M). For each of the Nsamples, AGSs are created as simple lists of all mutated genes G in a given sample S, i.e. any value X in the matrix M that satisfies condition !is.na(X) would be treated as a mutation. Eventual mutation types / categories are ignored. Wild type gene states in the original TAB-delimited file should be represented with NAs.
mutations2ags(MUT, col.mask = NA, namesFromColumn = NA, permute = FALSE)mutations2ags(MUT, col.mask = NA, namesFromColumn = NA, permute = FALSE)
MUT |
Matrix of size Ngenes x Nsamples (the both Ns are positive integers, depending on the screen scale). |
col.mask |
To include only columns with IDs that contain the specified mask. This parameter is aware of regular expression syntax, i.e. uses |
namesFromColumn |
Number of the column (if any) that contains the gene/protein names. Note that it is only necessary if the latter are NOT the unique rownames of the matrix. This could be sometimes useful for processing redundant gene profiles with one-to-many mapping etc. Otherwise (i.e. the default), rownames shall contain gene IDs. |
permute |
If the list of AGSs should be created via random permutation of sample labels. This might be needed for testing the null hypothesis that mutated genes are randomly combined into individual genomes, while having the same frequency distribution as in the actual cohort. Since reproducing the original distribution of AGS sizes is a non-trivial set theoretical problem, the procedure is accompanied by plotting gene set sizes in actual vs. permuted AGS (the latter is usually smaller, which might be unavoidable without a sophisticated algortihm...). |
data("tcga.gbm",package="NEArender") dim(tcga.gbm) ags.list <- mutations2ags(tcga.gbm, col.mask="[-.]01$") length(ags.list) length(unique(unlist(ags.list)))data("tcga.gbm",package="NEArender") dim(tcga.gbm) ags.list <- mutations2ags(tcga.gbm, col.mask="[-.]01$") length(ags.list) length(unique(unlist(ags.list)))
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).
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)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)
AGS |
Either a text file or a list of members of each AGS (see Details). Group IDs should be found in |
FGS |
Either a text file or a list of members of each FGS (see Details). Group IDs should be found in |
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 |
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. |
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.
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").
https://bmcbioinformatics.biomedcentral.com/articles/10.1186/s12859-017-1534-y
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)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)
A more compact alternative global network for the network enrichment analysis
data(net.kegg)data(net.kegg)
A list, see import.net
head(net.kegg)head(net.kegg)
Plot ROC curve(s) for benchmarked network(s)
roc(tpvsfp, mode = "roc", tpr.stop = 1, fpr.stop = 1, coff.z = 1.965, coff.fdr = 0.1, cex.main = 1, cex.leg = 0.75, main = NA, use.lty = FALSE, print.stats = TRUE, sort_by_letter_and_remove = FALSE)roc(tpvsfp, mode = "roc", tpr.stop = 1, fpr.stop = 1, coff.z = 1.965, coff.fdr = 0.1, cex.main = 1, cex.leg = 0.75, main = NA, use.lty = FALSE, print.stats = TRUE, sort_by_letter_and_remove = FALSE)
tpvsfp |
a list contaning data for the ROC curve(s) from |
mode |
either ROC curve (roc) or precision recall curve (prc). default: roc |
tpr.stop |
upper limit for the Y-axis (true positives). default: 1 |
fpr.stop |
upper limit for the X-axis (false prositives), default: 1 |
coff.z |
the point where to stop the ROC curve (in order to disable, set coff.z to below the minimal possible level) |
coff.fdr |
the point where to put the circle ('cross') at the ROC curve |
cex.main |
font size for the main title |
cex.leg |
font size for the legend |
main |
title name for the plot, default: none |
use.lty |
if different line types should be used for the curves, useful when the number of curves is very big (>10). default:"FALSE" |
print.stats |
add N(edges) and N(vertices) to the legend lines; only works if non-empty $ne and $nv elements are submitted in tpvsfp. default:"TRUE" |
sort_by_letter_and_remove |
enable a specific order for the curves in the legend, set by prefix letters |
The function roc can be called either from inside benchmark, or separately. In the latter case, it should receive the first argument as an object of the same type as benchmark can return. Generally, a ROC curve encompasses the whole interval from 0% to 100% at both axes. However in case of predictions made via network analysis, only the interval with (at least) formally significant scores is of interest (Merid et.al 2014).
Therefore the benchmark results are presented as ROC curves that end at minimal acceptable confidence, set via either a z-score cut-off. Additionally, an extra point is denoted that might correspond to cross.z in roc. The scale is given in no. of tested member genes rather then as percentage of the total no. of tests. The scale ranges xlim and ylim of the plot can be reduced by submitting parameters tpr.stop and fpr.stop with values <1.
http://www.biomedcentral.com/1471-2105/15/308
# Benchmark and plot one networks on the whole set of test GSs, using no mask: data(can.sig.go); fpath <- can.sig.go gs.list <- import.gs(fpath, Lowercase = 1, col.gene = 2, col.set = 3); data(net.kegg) netpath <- net.kegg net <- import.net(netpath) b0 <- benchmark (NET = net, GS = gs.list, echo=1, graph=TRUE, na.replace = 0, mask = ".", minN = 0, coff.z = 1.965, coff.fdr = 0.1, Parallelize=2); roc(b0, coff.z = 1.64); ## Not run: ## Benchmark and plot a number of networks on GO terms and KEGG pathways separately, using masks b1 <- NULL; for (mask in c("kegg_", "go_")) { b1[[mask]] <- NULL; for (file.net in c("netpath")) { # a series of networks can be put here: c("netpath1", "netpath2", "netpath3") net <- import.net(netpath, col.1 = 1, col.2 = 2, Lowercase = 1, echo = 1) b1[[mask]][[file.net]] <- benchmark (NET = net, GS = gs.list, gs.gene.col = 2, gs.group.col = 3, net.gene1.col = 1, net.gene2.col = 2, echo=1, graph=FALSE, na.replace = 0, mask = mask, minN = 0, Parallelize=2); }} par(mfrow=c(2,1)); roc(b1[["kegg_"]], coff.z = 2.57,main="kegg_"); roc(b1[["go_"]], coff.z = 2.57,main="go_"); ## End(Not run)# Benchmark and plot one networks on the whole set of test GSs, using no mask: data(can.sig.go); fpath <- can.sig.go gs.list <- import.gs(fpath, Lowercase = 1, col.gene = 2, col.set = 3); data(net.kegg) netpath <- net.kegg net <- import.net(netpath) b0 <- benchmark (NET = net, GS = gs.list, echo=1, graph=TRUE, na.replace = 0, mask = ".", minN = 0, coff.z = 1.965, coff.fdr = 0.1, Parallelize=2); roc(b0, coff.z = 1.64); ## Not run: ## Benchmark and plot a number of networks on GO terms and KEGG pathways separately, using masks b1 <- NULL; for (mask in c("kegg_", "go_")) { b1[[mask]] <- NULL; for (file.net in c("netpath")) { # a series of networks can be put here: c("netpath1", "netpath2", "netpath3") net <- import.net(netpath, col.1 = 1, col.2 = 2, Lowercase = 1, echo = 1) b1[[mask]][[file.net]] <- benchmark (NET = net, GS = gs.list, gs.gene.col = 2, gs.group.col = 3, net.gene1.col = 1, net.gene2.col = 2, echo=1, graph=FALSE, na.replace = 0, mask = mask, minN = 0, Parallelize=2); }} par(mfrow=c(2,1)); roc(b1[["kegg_"]], coff.z = 2.57,main="kegg_"); roc(b1[["go_"]], coff.z = 2.57,main="go_"); ## End(Not run)
This function creates a number of new AGSs from a given dataset, such as gene copy number, gene/protein expression, gene methylation etc. Such matrices M typically have size Ngenes x Nsamples, so that the current function returns a list of length=ncol(M). The AGSs for each of the Nsamples are created with one of the five available methods (see parameter method).
samples2ags(m0, Ntop = NA, col.mask = NA, namesFromColumn = NA, method = c("significant", "top", "toppos", "topnorm", "bestp", "toprandom"), cutoff.q = 0.05)samples2ags(m0, Ntop = NA, col.mask = NA, namesFromColumn = NA, method = c("significant", "top", "toppos", "topnorm", "bestp", "toprandom"), cutoff.q = 0.05)
m0 |
input matrix. |
Ntop |
Number of top ranking genes to include into each sample-specific AGS. Mutually exclusive with "cutoff.q". A practically recommended value of Ntop could be in the range 30...300. Ntop>1000 might decrease the analysis specificity. |
col.mask |
To include only columns with IDs that contain the specified mask. Follows the regular expression syntax. |
namesFromColumn |
Number of the column (if any) that contains the gene/protein names. Note that it is only necessary of the latter are NOT the unique rownames of the matrix. This could be sometimes needed to be able to process redundant expression etc. profiles. |
method |
Method to select sample-specific genes. One of
|
cutoff.q |
cutoff value. Mutually exclusive with "Ntop" (default: 0.05) |
data("fantom5.43samples", package="NEArender") ags.list <- samples2ags(fantom5.43samples, cutoff.q = 0.01, method="significant")data("fantom5.43samples", package="NEArender") ags.list <- samples2ags(fantom5.43samples, cutoff.q = 0.01, method="significant")
Each line in this file represents one gene/protein from an AGS/FGS and is accompanied with respective AGS/FGS ID. This format can be used e.g. as input at web site EviNet
save_gs_list(gs.list, File = "gs.list.groups")save_gs_list(gs.list, File = "gs.list.groups")
gs.list |
a list created with |
File |
output file name. |
http://www.biomedcentral.com/1471-2105/13/226
samples2ags, mutations2ags, as_genes_fgs, import.gs
data(net.kegg) netpath <- net.kegg net <- import.net(netpath); fgs.genes <- as_genes_fgs(net); save_gs_list(fgs.genes, File = "single_gene_ags.groups.tsv");data(net.kegg) netpath <- net.kegg net <- import.net(netpath); fgs.genes <- as_genes_fgs(net); save_gs_list(fgs.genes, File = "single_gene_ags.groups.tsv");
TCGA point mutations from the glioblastoma multiforme cohort
data(tcga.gbm)data(tcga.gbm)
A matrix with genes as rows (9660 genes with mutations reported in at least one sample) and TCGA samples as columns (291 samples). Wild type (=reference) states are denoted with NA.
table(is.na(tcga.gbm))table(is.na(tcga.gbm))
Auxiliary function to estimate how non-random are associations of node degrees in network edges.
topology2nd(NET, Lowercase = 1, col.1 = 1, col.2 = 2, echo = 1, main = "Higher order topology")topology2nd(NET, Lowercase = 1, col.1 = 1, col.2 = 2, echo = 1, main = "Higher order topology")
NET |
Either a text network file or an R list imported with |
Lowercase |
Render gene/protein IDs lower-case. |
col.1 |
Number of the column in the input file that corresponds to node 1 (gene/protein ID). |
col.2 |
Number of the column in the input file that corresponds to node 2 (gene/protein ID). |
echo |
if execution progress should be reported. |
main |
The plot title. |
file <- system.file("extdata", "Connectivity.FC1_full", package = "NEArender") topology2nd(NET=file)file <- system.file("extdata", "Connectivity.FC1_full", package = "NEArender") topology2nd(NET=file)