Title: | High-performing routines for the randomization of a bipartite graph (or a binary event matrix), undirected and directed signed graph preserving degree distribution (or marginal totals) |
---|---|
Description: | Fast functions for bipartite network rewiring through N consecutive switching steps (See References) and for the computation of the minimal number of switching steps to be performed in order to maximise the dissimilarity with respect to the original network. Includes functions for the analysis of the introduced randomness across the switching steps and several other routines to analyse the resulting networks and their natural projections. Extension to undirected networks and directed signed networks is also provided. Starting from version 1.9.7 a more precise bound (especially for small network) has been implemented. Starting from version 2.2.0 the analysis routine is more complete and a visual montioring of the underlying Markov Chain has been implemented. Starting from 3.6.0 the library can handle also matrices with NA (not for the directed signed graphs). Since version 3.27.1 it is possible to add a constraint for dsg generation: usually positive and negative arc between two nodes could be not accepted. |
Authors: | Andrea Gobbi [aut], Francesco Iorio [aut], Giuseppe Jurman [cbt], Davide Albanese [cbt], Julio Saez-Rodriguez [cbt]. |
Maintainer: | Andrea Gobbi <[email protected]> |
License: | GPL-3 |
Version: | 3.39.0 |
Built: | 2024-10-30 04:24:01 UTC |
Source: | https://github.com/bioc/BiRewire |
R package for computationally-efficient rewiring of bipartite graphs (or randomisation of 0-1 tables with prescribed marginal totals), undirected and directed signed graphs (dsg). The package provides useful functions for the analysis and the randomisation of large biological datasets that can be encoded as 0-1 tables, hence modeled as bipartite graphs by considering a 0-1 table as an incidence matrix, and for data that can be encoded as directed signed graphs such as patways and signaling networks. Large collections of such randomised tables can be used to approximate null models, preserving event-rates both across rows and columns, for statistical significance tests of combinatorial properties of the original dataset. The package provides an interface to a sampler routine useful for generating correctly such collections. Moreover a visual monitoring for the Markov Chain underlying the swithicng algorithm has been implemented. Since version 3.6.0 the SA can be performed also using matrices with NAs. In this case the positions of the NAs are preserved as the degree distribution. This extension is limited when the tables are provided instead of the graphs and does not work for the dsg.
Summary:
Package: | BiRewire |
Version: | 3.7.0 |
Date: 2017-02-27 | |
Require: slam, igraph, Rtsne, Matrix, R>=2.10 | |
URL: http://www.ebi.ac.uk/~iorio/BiRewire | |
License: | GPL-3 |
Andrea Gobbi [aut], Davide Albanese [cbt], Francesco Iorio [cbt], Giuseppe Jurman [cbt].
Maintainer: Andrea Gobbi <[email protected]>
Iorio, F. and and Bernardo-Faura, M. and Gobbi, A. and Cokelaer, T.and Jurman, G.and Saez-Rodriguez, J. (2016) Efficient randomization of biologicalnetworks while preserving functionalcharacterization of individual nodes Bioinformatics 2016 1 (17):542 doi: 10.1186/s12859-016-1402-1.
Gobbi, A. and Iorio, F. and Dawson, K. J. and Wedge, D. C. and Tamborero, D. and Alexandrov, L. B. and Lopez-Bigas, N. and Garnett, M. J. and Jurman, G. and Saez-Rodriguez, J. (2014) Fast randomization of large genomic datasets while preserving alteration counts Bioinformatics 2014 30 (17): i617-i623 doi: 10.1093/bioinformatics/btu474.
Iorio, F. and and Bernardo-Faura, M. and Gobbi, A. and Cokelaer, T.and Jurman, G.and Saez-Rodriguez, J. (2016) Efficient randomization of biologicalnetworks while preserving functionalcharacterization of individual nodes Bioinformatics 2016 1 (17):542 doi: 10.1186/s12859-016-1402-1.
Jaccard, P. (1901), Étude comparative de la distribution florale dans une portion des Alpes et des Jura,
Bulletin de la Société Vaudoise des Sciences Naturelles 37: 547–579.
R. Milo, N. Kashtan, S. Itzkovitz, M. E. J. Newman, U. Alon (2003), On the uniform generation of random graphs with prescribed degree sequences, eprint arXiv:cond-mat/0312028
Csardi, G. and Nepusz, T (2006)
Van der Maaten, L.J.P. and Hinton, G.E., Visualizing High-Dimensional Data Using t-SNE. Journal of Machine Learning Research 9(Nov):2579-2605, 2008
The igraph software package for complex network research,
InterJournal, Complex Systems
http://igraph.sf.net
This function performs a sequence of max.iter switching steps on the input bipartite graph g and compute the Jaccard similarity between g (the initial network) and its rewired version each step switching steps. This procedure is pefromed n.networks times and a simple explorative plot, with mean and CI, is visualized if display is set to true.
birewire.analysis.bipartite(incidence, step=10, max.iter="n",accuracy=0.00005, verbose=TRUE,MAXITER_MUL=10,exact=FALSE,n.networks=50,display=TRUE)
birewire.analysis.bipartite(incidence, step=10, max.iter="n",accuracy=0.00005, verbose=TRUE,MAXITER_MUL=10,exact=FALSE,n.networks=50,display=TRUE)
incidence |
Incidence matrix of the initial bipartite graph g (can be extracted from an |
step |
10 (default): the interval (in terms of switching steps) at which the Jaccard index between g and the its current rewired version is computed; |
max.iter |
"n" (default) the number of switching steps to be performed (or if exact==TRUE the number of successful switching steps). If equal to "n" then this number is considered equal to the analytically derived lower bound presented in Gobbi et al. (see References): |
accuracy |
0.00005 (default) is the desired level of accuracy reflecting the average distance between the Jaccard index at the N-th step and its analytically derived fixed point in terms of fracion of common edges; |
verbose |
TRUE (default). When TRUE a progression bar is printed during computation; |
MAXITER_MUL |
10 (default). If exact==TRUE in order to prevent a possible infinite loop the program stops anyway after MAXITER_MUL*max.iter iterations; |
exact |
FALSE (default). If TRUE the program performs max.iter swithcing steps, otherwise the program will count also the not-performed swithcing steps; |
n.networks |
50 (default), the number of independent rewiring process starting from the same inital graph from which the mean value and the CI is computed. |
display |
TRUE (default). If TRUE two explorative plots are displayed summarizing the trend of the Jaccard index in terms of mean and confidence interval. |
This function performs max.iter switching steps (see references). In particular, at each step two edges are randomly selected from the current version of g. Let these two edges be and
(where
and
belong to the first class of nodes whereas
and
belong to the second one), with
and
.
If the and
edges are not already present in the current current version of
g then
and
replace
and
.
At each step number of switching steps the function computes the Jaccard index between the original graph g and its current version.
This procedure is perfomed n.networks times and if display is set to TRUE, two explorative plots showing the mean value of the Jaccad Index over the SS and its CI are displayed.
A list containing a data.frame data collecting all the Jacard index computed (each row is a run of the SA), and the analytically derived lower bound N of switching steps to be performed by the switching algorithm in order to provide the revired version of g with the maximal level of achievable randomness (in terms of dissimilarity from the initial g).
Andrea Gobbi
Maintainer: Andrea Gobbi <[email protected]>
Special thanks to:
Davide Albanese
Gobbi, A. and Iorio, F. and Dawson, K. J. and Wedge, D. C. and Tamborero, D. and Alexandrov, L. B. and Lopez-Bigas, N. and Garnett, M. J. and Jurman, G. and Saez-Rodriguez, J. (2014) Fast randomization of large genomic datasets while preserving alteration counts Bioinformatics 2014 30 (17): i617-i623 doi: 10.1093/bioinformatics/btu474.
Iorio, F. and and Bernardo-Faura, M. and Gobbi, A. and Cokelaer, T.and Jurman, G.and Saez-Rodriguez, J. (2016) Efficient randomization of biologicalnetworks while preserving functionalcharacterization of individual nodes Bioinformatics 2016 1 (17):542 doi: 10.1186/s12859-016-1402-1.
Jaccard, P. (1901), Étude comparative de la distribution florale dans une portion des Alpes et des Jura,
Bulletin de la Société Vaudoise des Sciences Naturelles 37: 547–579.
R. Milo, N. Kashtan, S. Itzkovitz, M. E. J. Newman, U. Alon (2003), On the uniform generation of random graphs with prescribed degree sequences, eprint arXiv:cond-mat/0312028
library(BiRewire) g <-graph.bipartite(rep(0:1,length=10), c(1:10)) ##get the incidence matrix of g m<-as.matrix(get.incidence(graph=g)) ## set parameters step=1 max=100*length(E(g)) ## perform two different analysis using two different maximal number of switching steps scores<-birewire.analysis.bipartite(m,step,max,n.networks=10) scores2<-birewire.analysis.bipartite(m,step,"n",n.networks=10)
library(BiRewire) g <-graph.bipartite(rep(0:1,length=10), c(1:10)) ##get the incidence matrix of g m<-as.matrix(get.incidence(graph=g)) ## set parameters step=1 max=100*length(E(g)) ## perform two different analysis using two different maximal number of switching steps scores<-birewire.analysis.bipartite(m,step,max,n.networks=10) scores2<-birewire.analysis.bipartite(m,step,"n",n.networks=10)
This function performs a sequence of max.iter.pos (and max.iter.pos) switching steps on the positive (and negative) part of the input dsg g and computes the Jaccard similarity between g (the initial network) and its rewired version each step switching steps. This procedure is pefromed n.networks times and a simple explorative plot, with mean and CI, is visualized if display is set to TRUE. The plot shows the trend of the Jaccad Index relative to the positve (and negative) part of g.
birewire.analysis.dsg(dsg, step=10, max.iter.pos='n',max.iter.neg='n',accuracy=0.00005, verbose=TRUE,MAXITER_MUL=10,exact=FALSE,n.networks=50,display=TRUE)
birewire.analysis.dsg(dsg, step=10, max.iter.pos='n',max.iter.neg='n',accuracy=0.00005, verbose=TRUE,MAXITER_MUL=10,exact=FALSE,n.networks=50,display=TRUE)
dsg |
The initial dsg object (see |
step |
10 (default): the interval (in terms of switching steps) at which the Jaccard index between g and the its current rewired version is computed; |
max.iter.pos |
"n" (default) the number of switching steps to be performed (or if exact==TRUE the number of successful switching steps) for the positive part of g.
See |
max.iter.neg |
"n" (default) the same of max.iter.p but relative to the negative part; |
accuracy |
0.00005 (default) is the desired level of accuracy reflecting the average distance between the Jaccard index at the N-th step and its analytically derived fixed point in terms of fracion of common edges; |
verbose |
TRUE (default). When TRUE a progression bar is printed during computation; |
MAXITER_MUL |
10 (default). If exact==TRUE in order to prevent a possible infinite loop the program stops anyway after MAXITER_MUL*max.iter iterations; |
exact |
FALSE (default). If TRUE the program performs max.iter swithcing steps, otherwise the program will count also the not-performed swithcing steps; |
n.networks |
50 (default), the number of independent rewiring process starting from the same inital graph from which the mean value and the CI is computed. |
display |
TRUE (default). If TRUE two explorative plots are displayed summarizing the trend of the Jaccard index in terms of mean and confidence interval. |
This procedure acts in the same way of birewire.analysis.bipartite
but in the case of dsg. The similarity is measurwe using birewire.similarity.dsg
.
A list containing two lists: data that is a list collecting all the Jacard index computed (each row is a run of the SA) for the positive and negative part, and a list with the analytically derived lower bounds N for the positive and negative part of g.
Andrea Gobbi
Maintainer: Andrea Gobbi <[email protected]>
Iorio, F. and and Bernardo-Faura, M. and Gobbi, A. and Cokelaer, T.and Jurman, G.and Saez-Rodriguez, J. (2016) Efficient randomization of biologicalnetworks while preserving functionalcharacterization of individual nodes Bioinformatics 2016 1 (17):542 doi: 10.1186/s12859-016-1402-1.
Gobbi, A. and Iorio, F. and Dawson, K. J. and Wedge, D. C. and Tamborero, D. and Alexandrov, L. B. and Lopez-Bigas, N. and Garnett, M. J. and Jurman, G. and Saez-Rodriguez, J. (2014) Fast randomization of large genomic datasets while preserving alteration counts Bioinformatics 2014 30 (17): i617-i623 doi: 10.1093/bioinformatics/btu474.
Jaccard, P. (1901), Étude comparative de la distribution florale dans une portion des Alpes et des Jura,
Bulletin de la Société Vaudoise des Sciences Naturelles 37: 547–579.
R. Milo, N. Kashtan, S. Itzkovitz, M. E. J. Newman, U. Alon (2003), On the uniform generation of random graphs with prescribed degree sequences, eprint arXiv:cond-mat/0312028
library(BiRewire) data(test_dsg) dsg <- birewire.induced.bipartite(test_dsg,sparse=FALSE) a=birewire.analysis.dsg(dsg,verbose=FALSE,step=1,exact=TRUE,max.iter.pos=200,max.iter.neg=50)
library(BiRewire) data(test_dsg) dsg <- birewire.induced.bipartite(test_dsg,sparse=FALSE) a=birewire.analysis.dsg(dsg,verbose=FALSE,step=1,exact=TRUE,max.iter.pos=200,max.iter.neg=50)
This function performs a sequence of max.iter switching steps on the input undirected graph g and compute the Jaccard similarity between g (the initial network) and its rewired version each step switching steps. This procedure is pefromed n.networks times and a simple explorative plot, with mean and CI, is visualized if display is set to TRUE.
birewire.analysis.undirected(adjacency, step=10, max.iter="n",accuracy=0.00005, verbose=TRUE,MAXITER_MUL=10,exact=FALSE,n.networks=50,display=TRUE)
birewire.analysis.undirected(adjacency, step=10, max.iter="n",accuracy=0.00005, verbose=TRUE,MAXITER_MUL=10,exact=FALSE,n.networks=50,display=TRUE)
adjacency |
Incidence matrix of the initial bipartite graph g (can be extracted from an |
step |
10 (default): the interval (in terms of switching steps) at which the Jaccard index between g and the its current rewired version is computed; |
max.iter |
"n" (default) the number of switching steps to be performed (or if exact==TRUE the number of successful switching steps). If equal to "n" then this number is considered equal to the analytically derived lower bound presented in Gobbi et al. (see References): |
accuracy |
0.00005 (default) is the desired level of accuracy reflecting the average distance between the Jaccard index at the N-th step and its analytically derived fixed point in terms of fracion of common edges; |
verbose |
TRUE (default). When TRUE a progression bar is printed during computation; |
MAXITER_MUL |
10 (default). If exact==TRUE in order to prevent a possible infinite loop the program stops anyway after MAXITER_MUL*max.iter iterations; |
exact |
FALSE (default). If TRUE the program performs max.iter swithcing steps, otherwise the program will count also the not-performed swithcing steps; |
n.networks |
50 (default), the number of independent rewiring process starting from the same inital graph from which the mean value and the CI is computed. |
display |
TRUE (default). If TRUE two explorative plots are displayed summarizing the trend of the Jaccard index in terms of mean and confidence interval. |
This function performs max.iter switching steps (see references). In particular, at each step two edges are randomly selected from the current version of
g. Let these two edges be and
, with
,
,
,
.
If the and
(or
and
) edges are not already present in the current version of
g then
and
replace
and
(or
and
replace
and
). If both of the configuarations are allowed, then one of them is randomly selected.
At each step number of switching steps the function computes the Jaccard index between the original graph g and its current version.
This procedure is perfomed n.networks times and if display is set to TRUE, two explorative plots showing the mean value of the Jaccad Index over the SS and its CI are displayed.
A list containing a data.frame data collecting all the Jacard index computed (each row is a run of the SA), and the analytically derived lower bound N of switching steps to be performed by the switching algorithm in order to provide the revired version of g with the maximal level of achievable randomness (in terms of dissimilarity from the initial g).
Andrea Gobbi
Maintainer: Andrea Gobbi <[email protected]>
Special thanks to:
Davide Albanese
Gobbi, A. and Iorio, F. and Dawson, K. J. and Wedge, D. C. and Tamborero, D. and Alexandrov, L. B. and Lopez-Bigas, N. and Garnett, M. J. and Jurman, G. and Saez-Rodriguez, J. (2014) Fast randomization of large genomic datasets while preserving alteration counts Bioinformatics 2014 30 (17): i617-i623 doi: 10.1093/bioinformatics/btu474.
Iorio, F. and and Bernardo-Faura, M. and Gobbi, A. and Cokelaer, T.and Jurman, G.and Saez-Rodriguez, J. (2016) Efficient randomization of biologicalnetworks while preserving functionalcharacterization of individual nodes Bioinformatics 2016 1 (17):542 doi: 10.1186/s12859-016-1402-1.
Gobbi, A. and Jurman, G. (2013) Theoretical and algorithmic solutions for null models in network theory (Doctoral dissertation) http://eprints-phd.biblio.unitn.it/1125/
Jaccard, P. (1901), Étude comparative de la distribution florale dans une portion des Alpes et des Jura,
Bulletin de la Société Vaudoise des Sciences Naturelles 37: 547–579.
R. Milo, N. Kashtan, S. Itzkovitz, M. E. J. Newman, U. Alon (2003), On the uniform generation of random graphs with prescribed degree sequences, eprint arXiv:cond-mat/0312028
library(BiRewire) g <- erdos.renyi.game(1000,0.1) ##get the incidence matrix of g m<-as.matrix(get.adjacency(graph=g,sparse=FALSE)) ## set parameters step=1000 max=100*length(E(g)) ## perform two different analysis using two different numbers of switching steps scores<-birewire.analysis.undirected(m,step,max,n.networks=10,verbose=FALSE) scores2<-birewire.analysis.undirected(m,step,"n",n.networks=10,verbose=FALSE)
library(BiRewire) g <- erdos.renyi.game(1000,0.1) ##get the incidence matrix of g m<-as.matrix(get.adjacency(graph=g,sparse=FALSE)) ## set parameters step=1000 max=100*length(E(g)) ## perform two different analysis using two different numbers of switching steps scores<-birewire.analysis.undirected(m,step,max,n.networks=10,verbose=FALSE) scores2<-birewire.analysis.undirected(m,step,"n",n.networks=10,verbose=FALSE)
This function creates an igraph
bipartite graph from an incidence matrix.
birewire.bipartite.from.incidence(matrix,directed=FALSE)
birewire.bipartite.from.incidence(matrix,directed=FALSE)
matrix |
incidence matrix: an (n-by-m) binary matrix where rows correspond to vertices in the frist class while columns correspond to vertices in the second one; |
directed |
Logical, if TRUE a directed graph is created. |
The function calls graph.incidence
of package igraph
. See igraph
documentation for more details.
Bipartite igraph graph.
Andrea Gobbi
Maintainer: Andrea Gobbi <[email protected]>
Csardi, G. and Nepusz, T (2006) The igraph software package for complex network research, InterJournal, Complex Systems url http://igraph.sf.net
library(igraph) library(BiRewire) g <- graph.bipartite( rep(0:1,length=10), c(1:10)) ##gets the incidence matrix of g m<-as.matrix(get.incidence(graph=g)) ##rewire the current graph m2=birewire.rewire.bipartite(m,100) #create the rewired bipartite graph g2<-birewire.bipartite.from.incidence(m2,TRUE)
library(igraph) library(BiRewire) g <- graph.bipartite( rep(0:1,length=10), c(1:10)) ##gets the incidence matrix of g m<-as.matrix(get.incidence(graph=g)) ##rewire the current graph m2=birewire.rewire.bipartite(m,100) #create the rewired bipartite graph g2<-birewire.bipartite.from.incidence(m2,TRUE)
The routine transforms the initial dsg (two bipartite graphs) into SIF dsg format.
birewire.build.dsg(dsg,delimitators=list(negative='-',positive='+'))
birewire.build.dsg(dsg,delimitators=list(negative='-',positive='+'))
dsg |
The dsg to be converted; |
delimitators |
list(negative='-',positive='+') (default):a list with 'positive' and 'negative' names identifying the character encoding the relation; |
This fuction converts the dsg object into a SIF format that can be saved using birewire.write.dsg
, an internal function, using the given delimitators for encoding the relations. It is the inverse function of birewire.induced.bipartite
.
A dsg in SIF format.
data(test_dsg) dsg=birewire.induced.bipartite(test_dsg) tmp= birewire.rewire.dsg(dsg,verbose=FALSE) dsg2=birewire.build.dsg(tmp)
data(test_dsg) dsg=birewire.induced.bipartite(test_dsg) tmp= birewire.rewire.dsg(dsg,verbose=FALSE) dsg2=birewire.build.dsg(tmp)
The routine transforms the initial dsg graph in SIF format into a dsg object made of two bipartite graphs: one for positive edges and the other for negative edges.
birewire.induced.bipartite(g,delimitators=list(negative='-',positive='+'),sparse=FALSE)
birewire.induced.bipartite(g,delimitators=list(negative='-',positive='+'),sparse=FALSE)
g |
A dataframe in SIF format describing a dsg (for example the output of |
delimitators |
list(negative='-',positive='+') (default):a list with 'positive' and 'negative' names identifying the character encoding the relation; |
sparse |
FALSE (default): if TRUE the two bipartite graphs are saved as |
This fuction extract the positive and negative part of g and create a dsg object that can be used for example in the rewiring algorithm. Is is the inverse function of birewire.build.dsg
.
A list of two incidence matrix or bipartite igraph
objects.
Iorio, F. and and Bernardo-Faura, M. and Gobbi, A. and Cokelaer, T.and Jurman, G.and Saez-Rodriguez, J. (2016) Efficient randomization of biologicalnetworks while preserving functionalcharacterization of individual nodes Bioinformatics 2016 1 (17):542 doi: 10.1186/s12859-016-1402-1.
data(test_dsg) dsg=birewire.induced.bipartite(test_dsg)
data(test_dsg) dsg=birewire.induced.bipartite(test_dsg)
The routine reads a SIF file and return a R table.
birewire.load.dsg(path)
birewire.load.dsg(path)
path |
Path to the SIF file. |
A R table that can be transfomred into a dsg using birewire.induced.bipartite
Optimal implementation of the switching algorithm. It returns the rewired version of the initial bipartite graph or its incidence matrix.
birewire.rewire.bipartite(incidence, max.iter="n",accuracy=0.00005,verbose=TRUE, MAXITER_MUL=10,exact=FALSE)
birewire.rewire.bipartite(incidence, max.iter="n",accuracy=0.00005,verbose=TRUE, MAXITER_MUL=10,exact=FALSE)
incidence |
Incidence matrix of the initial bipartite graph g (can be extracted from an |
max.iter |
"n" (default) the number of switching steps to be performed (or if exact==TRUE the number of successful switching steps). If equal to "n" then this number is considered equal to the analytically derived lower bound presented in Gobbi et al. (see References): |
accuracy |
0.00005 (default) is the desired level of accuracy reflecting the average distance between the Jaccard index at the N-th step and its analytically derived fixed point in terms of fracion of common edges; |
verbose |
TRUE (default). When TRUE a progression bar is printed during computation. |
MAXITER_MUL |
10 (default). If exact==TRUE in order to prevent a possible infinite loop the program stops anyway after MAXITER_MUL*max.iter iterations; |
exact |
FALSE (default). If TRUE the program performs max.iter swithcing steps, otherwise the program will count also the not-performed swithcing steps; |
Main function of the package. It performs at most switching steps producing a rewired version of an initial bipartite graph.
Incidence matrix of the rewired graphn or the igraph corresponding object depending on the input type.
Andrea Gobbi
Maintainer: Andrea Gobbi <[email protected]>
Gobbi, A. and Iorio, F. and Dawson, K. J. and Wedge, D. C. and Tamborero, D. and Alexandrov, L. B. and Lopez-Bigas, N. and Garnett, M. J. and Jurman, G. and Saez-Rodriguez, J. (2014) Fast randomization of large genomic datasets while preserving alteration counts Bioinformatics 2014 30 (17): i617-i623 doi: 10.1093/bioinformatics/btu474.
Iorio, F. and and Bernardo-Faura, M. and Gobbi, A. and Cokelaer, T.and Jurman, G.and Saez-Rodriguez, J. (2016) Efficient randomization of biologicalnetworks while preserving functionalcharacterization of individual nodes Bioinformatics 2016 1 (17):542 doi: 10.1186/s12859-016-1402-1.
R. Milo, N. Kashtan, S. Itzkovitz, M. E. J. Newman, U. Alon (2003), On the uniform generation of random graphs with prescribed degree sequences, eprint arXiv:cond-mat/0312028
library(igraph) library(BiRewire) g <-graph.bipartite( rep(0:1,length=10), c(1:10)) ##gets the incidence matrix of g m<-as.matrix(get.incidence(graph=g)) ##rewiring m2=birewire.rewire.bipartite(m,100*length(E(g))) ##creates the corresponding bipartite graph g2<-birewire.bipartite.from.incidence(m2,directed=TRUE)
library(igraph) library(BiRewire) g <-graph.bipartite( rep(0:1,length=10), c(1:10)) ##gets the incidence matrix of g m<-as.matrix(get.incidence(graph=g)) ##rewiring m2=birewire.rewire.bipartite(m,100*length(E(g))) ##creates the corresponding bipartite graph g2<-birewire.bipartite.from.incidence(m2,directed=TRUE)
This function performs the same analysis of birewire.analysis.bipartite
but additionally it provides in output a rewired version of the two networks resulting from the natural projections of the initial graph, together with the corresponding Jaccard index trends.
birewire.rewire.bipartite.and.projections(graph,step=10,max.iter="n", accuracy=0.00005,verbose=TRUE,MAXITER_MUL=10)
birewire.rewire.bipartite.and.projections(graph,step=10,max.iter="n", accuracy=0.00005,verbose=TRUE,MAXITER_MUL=10)
graph |
A bipartite graph g; |
max.iter |
"n" (default) the number of successful switching steps to be performed. If equal to "n" then this number is considered equal to the analytically derived lower bound |
step |
10 (default): the interval (in terms of switching steps) at which the Jaccard index between g and the its current rewired version is computed; |
accuracy |
0.00005 (default) is the desired level of accuracy reflecting the average distance between the Jaccard index at the N-th step and its analytically derived fixed point in terms of fracion of common edges; |
verbose |
TRUE (default) boolean value. If TRUE print a processing bar during the rewiring algorithm. |
MAXITER_MUL |
10 (default).Since |
See birewire.analysis.bipartite
for details.
A list containing the three sequences of Jaccard index values (similarity_scores, similarity_scores.proj1, similarity_scores.proj2) for the three resulting graphs respectively (rewired, rewired.proj1, rewired.proj2). The first one is the rewired version of the initial graph g, while the second and the third one are rewired versions of its natural projections.
Andrea Gobbi
Maintainer: Andrea Gobbi <[email protected]>
Gobbi, A. and Iorio, F. and Dawson, K. J. and Wedge, D. C. and Tamborero, D. and Alexandrov, L. B. and Lopez-Bigas, N. and Garnett, M. J. and Jurman, G. and Saez-Rodriguez, J. (2014) Fast randomization of large genomic datasets while preserving alteration counts Bioinformatics 2014 30 (17): i617-i623 doi: 10.1093/bioinformatics/btu474.
Iorio, F. and and Bernardo-Faura, M. and Gobbi, A. and Cokelaer, T.and Jurman, G.and Saez-Rodriguez, J. (2016) Efficient randomization of biologicalnetworks while preserving functionalcharacterization of individual nodes Bioinformatics 2016 1 (17):542 doi: 10.1186/s12859-016-1402-1.
library(igraph) library(BiRewire) g <- simplify(graph.bipartite( rep(0:1,length=100), c(c(1:100),seq(1,100,3),seq(1,100,7),100,seq(1,100,13), seq(1,100,17),seq(1,100,19),seq(1,100,23),100))) ##gets the incidence matrix of g m<-as.matrix(get.incidence(graph=g)) ## rewires g and its projections result=birewire.rewire.bipartite.and.projections(g,step=10,max.iter="n",accuracy=0.00005)
library(igraph) library(BiRewire) g <- simplify(graph.bipartite( rep(0:1,length=100), c(c(1:100),seq(1,100,3),seq(1,100,7),100,seq(1,100,13), seq(1,100,17),seq(1,100,19),seq(1,100,23),100))) ##gets the incidence matrix of g m<-as.matrix(get.incidence(graph=g)) ## rewires g and its projections result=birewire.rewire.bipartite.and.projections(g,step=10,max.iter="n",accuracy=0.00005)
Optimal implementation of the switching algorithm. It returns the rewired version of the initial directed signed graph (dsg).
birewire.rewire.dsg(dsg,exact=FALSE,verbose=1,max.iter.pos='n',max.iter.neg='n', accuracy=0.00005,MAXITER_MUL=10,path=NULL,delimitators=list(positive='+',negative= '-'),check_pos_neg=FALSE,in_sampler=FALSE)
birewire.rewire.dsg(dsg,exact=FALSE,verbose=1,max.iter.pos='n',max.iter.neg='n', accuracy=0.00005,MAXITER_MUL=10,path=NULL,delimitators=list(positive='+',negative= '-'),check_pos_neg=FALSE,in_sampler=FALSE)
dsg |
A dsg object: is a list of two incidence matrices (see References), "positive" and "negative", encoding the positive edges and negative edges. This list can be obtained reading a SIF file using |
exact |
FALSE (default). If TRUE the program performs max.iter successful swithcing steps, otherwise the program will count also the not-performed swithcing steps; |
verbose |
TRUE (default). When TRUE a progression bar is printed during computation; |
max.iter.pos |
"n" (default) the number of switching steps to be performed on the positive part of dsg (or if exact==TRUE the number of successful switching steps). If equal to "n" then this number is considered equal to the analytically derived lower bound presented in Gobbi et al. (see References): |
max.iter.neg |
"n" (default) the number of switching steps to be performed on the negative part of dsg (or if exact==TRUE the number of successful switching steps). If equal to "n" then this number is considered equal to the analytically derived lower bound presented in Gobbi et al. (see References): |
accuracy |
0.00005 (default) is the desired level of accuracy reflecting the average distance between the Jaccard index at the N-th step and its analytically derived fixed point in terms of fracion of common edges; |
MAXITER_MUL |
10 (default). If exact==TRUE in order to prevent a possible infinite loop the program stops anyway after MAXITER_MUL*max.iter iterations; |
path |
NULL (default). If not NULL, the dsg is saved in path in SIF format; |
delimitators |
list(positive='+',negative= '-') (default). If save.file is true, the dsg is saved using delimitators as characters encoding the relations. See |
check_pos_neg |
FALSE (default). if true check if there are positive and negative loops in the same arc, if so the routine will not save the dsg but return it anyway with a warining |
in_sampler |
FALSE (default).if TRUE does not print the warining due to the positive-negative check |
This fuction runs birewire.rewire.bipartite
on the positive and negative part of dsg. See references for more details.
Rewired dsg.
Andrea Gobbi: <[email protected]>
Iorio, F. and and Bernardo-Faura, M. and Gobbi, A. and Cokelaer, T.and Jurman, G.and Saez-Rodriguez, J. (2016) Efficient randomization of biologicalnetworks while preserving functionalcharacterization of individual nodes Bioinformatics 2016 1 (17):542 doi: 10.1186/s12859-016-1402-1.
Gobbi, A. and Iorio, F. and Dawson, K. J. and Wedge, D. C. and Tamborero, D. and Alexandrov, L. B. and Lopez-Bigas, N. and Garnett, M. J. and Jurman, G. and Saez-Rodriguez, J. (2014) Fast randomization of large genomic datasets while preserving alteration counts Bioinformatics 2014 30 (17): i617-i623 doi: 10.1093/bioinformatics/btu474.
R. Milo, N. Kashtan, S. Itzkovitz, M. E. J. Newman, U. Alon (2003), On the uniform generation of random graphs with prescribed degree sequences, eprint arXiv:cond-mat/0312028
library(BiRewire) data(test_dsg) dsg=birewire.induced.bipartite(test_dsg) tmp= birewire.rewire.dsg(dsg,verbose=FALSE)
library(BiRewire) data(test_dsg) dsg=birewire.induced.bipartite(test_dsg) tmp= birewire.rewire.dsg(dsg,verbose=FALSE)
Optimal implementation of the switching algorithm. It returns the rewired version of the initial undirected graph or its adjacency matrix.
birewire.rewire.undirected(adjacency, max.iter="n",accuracy=0.00005, verbose=TRUE,MAXITER_MUL=10,exact=FALSE)
birewire.rewire.undirected(adjacency, max.iter="n",accuracy=0.00005, verbose=TRUE,MAXITER_MUL=10,exact=FALSE)
adjacency |
An |
max.iter |
"n" (default) the number of switching steps to be performed (or if exact==TRUE the number of successful switching steps). If equal to "n" then this number is considered equal to the analytically derived lower bound presented in Gobbi et al. (see References): |
accuracy |
0.00005 (default) is the desired level of accuracy reflecting the average distance between the Jaccard index at the N-th step and its analytically derived fixed point in terms of fracion of common edges; |
verbose |
TRUE (default) boolean value. If TRUE print a processing bar during the rewiring algorithm. |
MAXITER_MUL |
10 (default). If exact==TRUE in order to prevent a possible infinite loop the program stops anyway after MAXITER_MUL*max.iter iterations; |
exact |
FALSE (default). If TRUE the program performs max.iter swithcing steps, otherwise the program will count also the not-performed swithcing steps; |
Performs at most number of rewiring steps producing a rewired version of an initial undirected graph.
Adjacency matrix of the rewired graph or the relative igraph object depending on the input type.
Andrea Gobbi
Maintainer: Andrea Gobbi <[email protected]>
Special thanks to:Davide Albanese
Gobbi, A. and Iorio, F. and Dawson, K. J. and Wedge, D. C. and Tamborero, D. and Alexandrov, L. B. and Lopez-Bigas, N. and Garnett, M. J. and Jurman, G. and Saez-Rodriguez, J. (2014) Fast randomization of large genomic datasets while preserving alteration counts Bioinformatics 2014 30 (17): i617-i623 doi: 10.1093/bioinformatics/btu474.
Iorio, F. and and Bernardo-Faura, M. and Gobbi, A. and Cokelaer, T.and Jurman, G.and Saez-Rodriguez, J. (2016) Efficient randomization of biologicalnetworks while preserving functionalcharacterization of individual nodes Bioinformatics 2016 1 (17):542 doi: 10.1186/s12859-016-1402-1.
Gobbi, A. and Jurman, G. (2013) Theoretical and algorithmic solutions for null models in network theory (Doctoral dissertation) http://eprints-phd.biblio.unitn.it/1125/
R. Milo, N. Kashtan, S. Itzkovitz, M. E. J. Newman, U. Alon (2003), On the uniform generation of random graphs with prescribed degree sequences, eprint arXiv:cond-mat/0312028
library(igraph) library(BiRewire) g <- erdos.renyi.game(1000,0.1) ##gets the incidence matrix of g m<-as.matrix(get.adjacency(graph=g,sparse=FALSE)) ## sets parameters step=1000 max=100*length(E(g)) ##rewiring m2=birewire.rewire.undirected(m,100*length(E(g))) ##creates the corresponding bipartite graph g2<-graph.adjacency(m2,mode="undirected")
library(igraph) library(BiRewire) g <- erdos.renyi.game(1000,0.1) ##gets the incidence matrix of g m<-as.matrix(get.adjacency(graph=g,sparse=FALSE)) ## sets parameters step=1000 max=100*length(E(g)) ##rewiring m2=birewire.rewire.undirected(m,100*length(E(g))) ##creates the corresponding bipartite graph g2<-graph.adjacency(m2,mode="undirected")
The routine samples correctly from the null model of a given bipartite graph creating a set of randomized version of the initial bipartite graph.
birewire.sampler.bipartite(incidence,K,path,max.iter="n", accuracy=0.00005, verbose=TRUE,MAXITER_MUL=10,exact=FALSE,write.sparse=TRUE)
birewire.sampler.bipartite(incidence,K,path,max.iter="n", accuracy=0.00005, verbose=TRUE,MAXITER_MUL=10,exact=FALSE,write.sparse=TRUE)
incidence |
Incidence matrix of the initial bipartite graph. Since 3.6.0 this matrix can contain also NAs and the position of such entries will be preserved by the SA; |
K |
The number of networks that has to be generated; |
path |
The directory in which the routine stores the outputs; |
max.iter |
"n" (default) the number of switching steps to be performed (or if exact==TRUE the number of successful switching steps). If equal to "n" then this number is considered equal to the analytically derived lower bound presented in Gobbi et al. (see References): |
accuracy |
0.00005 (default) is the desired level of accuracy reflecting the average distance between the Jaccard index at the N-th step and its analytically derived fixed point in terms of fracion of common edges; |
verbose |
TRUE (default). When TRUE a progression bar is printed during computation. |
MAXITER_MUL |
10 (default). If exact==TRUE in order to prevent a possible infinite loop the program stops anyway after MAXITER_MUL*max.iter iterations; |
exact |
FALSE (default). If TRUE the program performs max.iter swithcing steps, otherwise the program will count also the not-performed swithcing steps; |
write.sparse |
TRUE (default). If FALSE the table is written as an R data.frame (long time and more space needed) |
The routine creates, starting from the given path, different subfolders in order to have maximum 1000 files for folder . Moreover the incidence matrices are saved using write_stm_CLUTO
(sparse matrices) that can be loaded using read_stm_CLUTO
. The set is generated calling birewire.rewire.bipartite on the last generated graph starting from the input graph.
Andrea Gobbi: <[email protected]>
Gobbi, A. and Iorio, F. and Dawson, K. J. and Wedge, D. C. and Tamborero, D. and Alexandrov, L. B. and Lopez-Bigas, N. and Garnett, M. J. and Jurman, G. and Saez-Rodriguez, J. (2014) Fast randomization of large genomic datasets while preserving alteration counts Bioinformatics 2014 30 (17): i617-i623 doi: 10.1093/bioinformatics/btu474.
Iorio, F. and and Bernardo-Faura, M. and Gobbi, A. and Cokelaer, T.and Jurman, G.and Saez-Rodriguez, J. (2016) Efficient randomization of biologicalnetworks while preserving functionalcharacterization of individual nodes Bioinformatics 2016 1 (17):542 doi: 10.1186/s12859-016-1402-1.
R. Milo, N. Kashtan, S. Itzkovitz, M. E. J. Newman, U. Alon (2003), On the uniform generation of random graphs with prescribed degree sequences, eprint arXiv:cond-mat/0312028
Efficient generation of a null model for a given dsg. The routine samples correctly from the null model of a given dsg creating a set of randomized dsgs.
birewire.sampler.dsg(dsg,K,path,delimitators=list(negative='-',positive='+'),exact=FALSE, verbose=TRUE, max.iter.pos='n',max.iter.neg='n', accuracy=0.00005,MAXITER_MUL=10,check_pos_neg=FALSE)
birewire.sampler.dsg(dsg,K,path,delimitators=list(negative='-',positive='+'),exact=FALSE, verbose=TRUE, max.iter.pos='n',max.iter.neg='n', accuracy=0.00005,MAXITER_MUL=10,check_pos_neg=FALSE)
dsg |
A dsg object: is a list of two incidence matrices (see References), "positive" and "negative", encoding the positive edges and negative edges. This list can be obtained reading a SIF file using |
max.iter.pos |
"n" (default) the number of switching steps to be performed on the positive part of dsg (or if exact==TRUE the number of successful switching steps). If equal to "n" then this number is considered equal to the analytically derived lower bound presented in Gobbi et al. (see References): |
max.iter.neg |
"n" (default) the number of switching steps to be performed on the negative part of dsg (or if exact==TRUE the number of successful switching steps). If equal to "n" then this number is considered equal to the analytically derived lower bound presented in Gobbi et al. (see References): |
accuracy |
0.00005 (default) is the desired level of accuracy reflecting the average distance between the Jaccard index at the N-th step and its analytically derived fixed point in terms of fracion of common edges; |
verbose |
TRUE (default). When TRUE a progression bar is printed during computation. |
MAXITER_MUL |
10 (default). If exact==TRUE in order to prevent a possible infinite loop the program stops anyway after MAXITER_MUL*max.iter iterations; |
exact |
FALSE (default). If TRUE the program performs max.iter swithcing steps, otherwise the program will count also the not-performed swithcing steps; |
path |
The directory in which the routine stores the outputs; |
K |
The number of network that has to be generated; |
delimitators |
list(negative='-',positive='+') (default):a list with 'positive' and 'negative' names identifying the character encoding the relation used for writing the ouput with |
check_pos_neg |
FALSE (default) : if true check if there are positive and negative loops in the same arc, if so the routine will not save the dsg and goes on with the marcov chain (it can be slower due to the chekcs); |
The routine creates, starting from a given path, different subfolders in order to have maximum 1000 files for folder; the SIF files are saved using birewire.write.dsg
, an internal routine. The set is generated calling birewire.rewire.dsg on the last generated dsg starting from the input dsg.
Andrea Gobbi: <[email protected]>
Iorio, F. and and Bernardo-Faura, M. and Gobbi, A. and Cokelaer, T.and Jurman, G.and Saez-Rodriguez, J. (2016) Efficient randomization of biologicalnetworks while preserving functionalcharacterization of individual nodes Bioinformatics 2016 1 (17):542 doi: 10.1186/s12859-016-1402-1.
Gobbi, A. and Iorio, F. and Dawson, K. J. and Wedge, D. C. and Tamborero, D. and Alexandrov, L. B. and Lopez-Bigas, N. and Garnett, M. J. and Jurman, G. and Saez-Rodriguez, J. (2014) Fast randomization of large genomic datasets while preserving alteration counts Bioinformatics 2014 30 (17): i617-i623 doi: 10.1093/bioinformatics/btu474.
R. Milo, N. Kashtan, S. Itzkovitz, M. E. J. Newman, U. Alon (2003), On the uniform generation of random graphs with prescribed degree sequences, eprint arXiv:cond-mat/0312028
The routine samples correctly from the null model of a given undirected graph creating a set of randomized version of the initial undirected graph.
birewire.sampler.undirected(adjacency,K,path,max.iter="n", accuracy=0.00005, verbose=TRUE,MAXITER_MUL=10,exact=FALSE,write.sparse=TRUE)
birewire.sampler.undirected(adjacency,K,path,max.iter="n", accuracy=0.00005, verbose=TRUE,MAXITER_MUL=10,exact=FALSE,write.sparse=TRUE)
adjacency |
Adjacency matrix of the initial undirected graph. Since 3.6.0 this matrix can contain also NAs and the position of such entries will be preserved by the SA; |
K |
The number of networks that has to be generated; |
path |
The directory in which the routine stores the outputs; |
max.iter |
"n" (default) see |
accuracy |
0.00005 (default) is the desired level of accuracy reflecting the average distance between the Jaccard index at the N-th step and its analytically derived fixed point in terms of fracion of common edges; |
verbose |
TRUE (default). When TRUE a progression bar is printed during computation. |
MAXITER_MUL |
10 (default). If exact==TRUE in order to prevent a possible infinite loop the program stops anyway after MAXITER_MUL*max.iter iterations; |
exact |
FALSE (default). If TRUE the program performs max.iter swithcing steps, otherwise the program will count also the not-performed swithcing steps; |
write.sparse |
TRUE (default). If FALSE the table is written as an R data.frame (long time and more space needed) |
The routine creates, starting from the given path, different subfolders in order to have maximum 1000 files for folder . Moreover the incidence matrices are saved using write_stm_CLUTO
(sparse matrices) that can be loaded using read_stm_CLUTO
. The set is generated calling birewire.rewire.undirected on the last generated graph starting from the input graph.
Andrea Gobbi: <[email protected]>
Gobbi, A. and Iorio, F. and Dawson, K. J. and Wedge, D. C. and Tamborero, D. and Alexandrov, L. B. and Lopez-Bigas, N. and Garnett, M. J. and Jurman, G. and Saez-Rodriguez, J. (2014) Fast randomization of large genomic datasets while preserving alteration counts Bioinformatics 2014 30 (17): i617-i623 doi: 10.1093/bioinformatics/btu474.
Iorio, F. and and Bernardo-Faura, M. and Gobbi, A. and Cokelaer, T.and Jurman, G.and Saez-Rodriguez, J. (2016) Efficient randomization of biologicalnetworks while preserving functionalcharacterization of individual nodes Bioinformatics 2016 1 (17):542 doi: 10.1186/s12859-016-1402-1.
Gobbi, A. and Jurman, G. (2013) Theoretical and algorithmic solutions for null models in network theory (Doctoral dissertation) http://eprints-phd.biblio.unitn.it/1125/
R. Milo, N. Kashtan, S. Itzkovitz, M. E. J. Newman, U. Alon (2003), On the uniform generation of random graphs with prescribed degree sequences, eprint arXiv:cond-mat/0312028
Compute the Jaccard similarity index between two binary matrices with the same number of non-null entries and the sam row- and column-wise sums. The function accept also two igraph objects.
birewire.similarity( m1,m2)
birewire.similarity( m1,m2)
m1 |
First matrix or graph; |
m2 |
Second matrix or graph. |
The Jaccard index between two sets M and N is defined as:
With M and N binary matrices, the Jaccard index is computed as:
The Jaccard index ranges between 0 and 1 and since 3.6.0 can be computed also among matrix with NAs.
Returns the Jaccard similarity index between the objects.
Andrea Gobbi
Maintainer: Andrea Gobbi <[email protected]>
library(igraph) library(BiRewire) g <- graph.bipartite( rep(0:1,length=10), c(1:10)) g2=birewire.rewire.bipartite(g) birewire.similarity(get.incidence(g,sparse=FALSE),get.incidence(g2,sparse=FALSE)) birewire.similarity(g,g2)
library(igraph) library(BiRewire) g <- graph.bipartite( rep(0:1,length=10), c(1:10)) g2=birewire.rewire.bipartite(g) birewire.similarity(get.incidence(g,sparse=FALSE),get.incidence(g2,sparse=FALSE)) birewire.similarity(g,g2)
Compute the Jaccard similarity index between dsg objects described in the same way (matrices of graphs).
birewire.similarity.dsg( m1,m2)
birewire.similarity.dsg( m1,m2)
m1 |
First dsg; |
m2 |
Second dsg. |
See birewire.similarity
for more details.
Returns the Jaccard similarity index between the objects.
Andrea Gobbi
Maintainer: Andrea Gobbi <[email protected]>
library(BiRewire) data(test_dsg) dsg <- birewire.induced.bipartite(test_dsg,sparse=FALSE) birewire.similarity.dsg(dsg,birewire.rewire.dsg(dsg)) dsg <- birewire.induced.bipartite(test_dsg,sparse=TRUE) birewire.similarity.dsg(dsg,birewire.rewire.dsg(dsg))
library(BiRewire) data(test_dsg) dsg <- birewire.induced.bipartite(test_dsg,sparse=FALSE) birewire.similarity.dsg(dsg,birewire.rewire.dsg(dsg)) dsg <- birewire.induced.bipartite(test_dsg,sparse=TRUE) birewire.similarity.dsg(dsg,birewire.rewire.dsg(dsg))
Transform a triplet sparse matrix from slum package to a Matrix sparse matrix that can be used by igraph for creating a network. This function could be used in order to analyze graphs obtained from samplers routines (birewire.sampler.undirected
,birewire.sampler.dsg
and birewire.sampler.bipartite
.)
birewire.slum.to.sparseMatrix( simple_triplet_matrix_sparse)
birewire.slum.to.sparseMatrix( simple_triplet_matrix_sparse)
simple_triplet_matrix_sparse |
A triplet sparse matrix, usually the object coming from |
Returns an Matrix sparse matrix that could be used for building an igraph
graph using graph.adjacency
.
Andrea Gobbi
Maintainer: Andrea Gobbi <[email protected]>
This function generates a cascade-sampling from the model at different switching steps given in sequence. For each step the routine computes the pairwise Jaccard distance (1-JI) among the samples and perfroms, on the resulting matix, a dimentional scaling reduction (using Rtsne
). If display is set to TRUE the relative plot is displayed.
birewire.visual.monitoring.bipartite(data,accuracy=0.00005,verbose=FALSE,MAXITER_MUL=10, exact=FALSE,n.networks=100,perplexity=15,sequence=c(1,5,100,"n"),ncol=2, nrow=length(sequence)/ncol,display=TRUE)
birewire.visual.monitoring.bipartite(data,accuracy=0.00005,verbose=FALSE,MAXITER_MUL=10, exact=FALSE,n.networks=100,perplexity=15,sequence=c(1,5,100,"n"),ncol=2, nrow=length(sequence)/ncol,display=TRUE)
data |
The initial bipartite graph, either an incidence matrix or an igraph bipartite graph object. Since 3.6.0, if the matrix is provided, such matrix can contain also NAs and the position of such entries will be preserved by the SA; |
accuracy |
0.00005 (default) is the desired level of accuracy reflecting the average distance between the Jaccard index at the N-th step and its analytically derived fixed point in terms of fracion of common edges; |
verbose |
TRUE (default). When TRUE a progression bar is printed during computation. |
MAXITER_MUL |
10 (default). If exact==TRUE in order to prevent a possible infinite loop the program stops anyway after MAXITER_MUL*max.iter iterations; |
exact |
FALSE (default). If TRUE the program performs max.iter swithcing steps, otherwise the program will count also the not-performed swithcing steps; |
n.networks |
100 (default): the number of network generated for each step defined in sequence ; |
perplexity |
15 (default): the value of perplexity passed to the function |
sequence |
c(1,5,100,"n")(default) the sequence of step for wich generating a sampler (see |
ncol |
2 (default). The number of column in the plot; |
nrow |
length(sequence)/ncol (default). The number of row in the plot; |
display |
TRUE (default). If TRUE the result is displayed. |
For each value p in sequence (it that can also contain the special character "n", see birewire.rewire.bipartite
), the routine generates n.networks sampled each p SS from the SA initialized with the given data. Pariwise distance are computed using the Jaccard distance and the resulting matrix is the input for the dimensional scaling performed by the function Rtsne
. An explorative plot is displayed if display is set to TRUE.
A list containing the list containing the distance matrices dist and the list containing the tsne results Rtsne.
Andrea Gobbi
Maintainer: Andrea Gobbi <[email protected]>
Gobbi, A. and Iorio, F. and Dawson, K. J. and Wedge, D. C. and Tamborero, D. and Alexandrov, L. B. and Lopez-Bigas, N. and Garnett, M. J. and Jurman, G. and Saez-Rodriguez, J. (2014) Fast randomization of large genomic datasets while preserving alteration counts Bioinformatics 2014 30 (17): i617-i623 doi: 10.1093/bioinformatics/btu474.
Iorio, F. and and Bernardo-Faura, M. and Gobbi, A. and Cokelaer, T.and Jurman, G.and Saez-Rodriguez, J. (2016) Efficient randomization of biologicalnetworks while preserving functionalcharacterization of individual nodes Bioinformatics 2016 1 (17):542 doi: 10.1186/s12859-016-1402-1.
Jaccard, P. (1901), Étude comparative de la distribution florale dans une portion des Alpes et des Jura,
Bulletin de la Société Vaudoise des Sciences Naturelles 37: 547–579.
R. Milo, N. Kashtan, S. Itzkovitz, M. E. J. Newman, U. Alon (2003), On the uniform generation of random graphs with prescribed degree sequences, eprint arXiv:cond-mat/0312028
Van der Maaten, L.J.P. and Hinton, G.E. Visualizing High-Dimensional Data Using t-SNE. Journal of Machine Learning Research 9(Nov):2579-2605, 2008
library(BiRewire) g <- graph.bipartite( rep(0:1,length=100), c(1:100)) tsne = birewire.visual.monitoring.bipartite(g,display=FALSE,n.networks=10,perplexity=1)
library(BiRewire) g <- graph.bipartite( rep(0:1,length=100), c(1:100)) tsne = birewire.visual.monitoring.bipartite(g,display=FALSE,n.networks=10,perplexity=1)
This function generates a cascade-sampling from the model at different switching steps given in sequence. For each step the routine computes the pairwise Jaccard distance (1-JI) among the samples and perfroms, on the resulting matix, a dimentional scaling reduction (using Rtsne
). If display is set to TRUE the relative plot is displayed.
birewire.visual.monitoring.dsg(data,accuracy=0.00005,verbose=FALSE,MAXITER_MUL=10,exact=FALSE,n.networks=100,perplexity=15, sequence.pos=c(1,5,100,"n"), sequence.neg=c(1,5,100,"n"),ncol=2,nrow=length(sequence.pos)/ncol,display=TRUE)
birewire.visual.monitoring.dsg(data,accuracy=0.00005,verbose=FALSE,MAXITER_MUL=10,exact=FALSE,n.networks=100,perplexity=15, sequence.pos=c(1,5,100,"n"), sequence.neg=c(1,5,100,"n"),ncol=2,nrow=length(sequence.pos)/ncol,display=TRUE)
data |
The initial dsg either in matrix or graph formulation 9see |
accuracy |
0.00005 (default) is the desired level of accuracy reflecting the average distance between the Jaccard index at the N-th step and its analytically derived fixed point in terms of fracion of common edges; |
verbose |
TRUE (default). When TRUE a progression bar is printed during computation. |
MAXITER_MUL |
10 (default). If exact==TRUE in order to prevent a possible infinite loop the program stops anyway after MAXITER_MUL*max.iter iterations; |
exact |
FALSE (default). If TRUE the program performs max.iter swithcing steps, otherwise the program will count also the not-performed swithcing steps; |
n.networks |
100 (default): the number of network generated for each step defined in sequence ; |
perplexity |
15 (default): the value of perplexity passed to the function |
sequence.pos |
c(1,5,100,"n")(default) the sequence of step for wich generating a sampler (see |
sequence.neg |
same as sequence.pos but for the negative part |
ncol |
2 (default). The number of column in the plot; |
nrow |
length(sequence)/ncol (default). The number of row in the plot; |
display |
TRUE (default). If TRUE the result of tsne is displayed. |
See birewire.visual.monitoring.bipartite
for more details.
A list containing the list containing the distance matrices dist and the list containing the tsne results Rtsne.
Andrea Gobbi
Maintainer: Andrea Gobbi <[email protected]>
Iorio, F. and and Bernardo-Faura, M. and Gobbi, A. and Cokelaer, T.and Jurman, G.and Saez-Rodriguez, J. (2016) Efficient randomization of biologicalnetworks while preserving functionalcharacterization of individual nodes Bioinformatics 2016 1 (17):542 doi: 10.1186/s12859-016-1402-1.
Gobbi, A. and Iorio, F. and Dawson, K. J. and Wedge, D. C. and Tamborero, D. and Alexandrov, L. B. and Lopez-Bigas, N. and Garnett, M. J. and Jurman, G. and Saez-Rodriguez, J. (2014) Fast randomization of large genomic datasets while preserving alteration counts Bioinformatics 2014 30 (17): i617-i623 doi: 10.1093/bioinformatics/btu474.
Jaccard, P. (1901), Étude comparative de la distribution florale dans une portion des Alpes et des Jura,
Bulletin de la Société Vaudoise des Sciences Naturelles 37: 547–579.
R. Milo, N. Kashtan, S. Itzkovitz, M. E. J. Newman, U. Alon (2003), On the uniform generation of random graphs with prescribed degree sequences, eprint arXiv:cond-mat/0312028
Van der Maaten, L.J.P. and Hinton, G.E. Visualizing High-Dimensional Data Using t-SNE. Journal of Machine Learning Research 9(Nov):2579-2605, 2008
library(BiRewire) data(test_dsg) ##bigger dsg test_dsg_2=test_dsg test_dsg_2[,1]=paste(test_dsg_2[,1],"_",sep="") test_dsg_2[,3]=paste(test_dsg_2[,3],"_",sep="") dsg <- birewire.induced.bipartite(rbind(test_dsg,test_dsg_2),sparse=FALSE) tsne = birewire.visual.monitoring.dsg(dsg,exact=TRUE,sequence.pos=c(1,2,"n",100), sequence.neg=c(1,2,"n",60),n.networks=50,perplexity=1)
library(BiRewire) data(test_dsg) ##bigger dsg test_dsg_2=test_dsg test_dsg_2[,1]=paste(test_dsg_2[,1],"_",sep="") test_dsg_2[,3]=paste(test_dsg_2[,3],"_",sep="") dsg <- birewire.induced.bipartite(rbind(test_dsg,test_dsg_2),sparse=FALSE) tsne = birewire.visual.monitoring.dsg(dsg,exact=TRUE,sequence.pos=c(1,2,"n",100), sequence.neg=c(1,2,"n",60),n.networks=50,perplexity=1)
This function generates a cascade-sampling from the model at different switching steps given in sequence. For each step the routine computes the pairwise Jaccard distance (1-JI) among the samples and perfroms, on the resulting matix, a dimentional scaling reduction (using Rtsne
). If display is set to TRUE the relative plot is displayed.
birewire.visual.monitoring.undirected(data,accuracy=0.00005,verbose=FALSE,MAXITER_MUL=10, exact=FALSE,n.networks=100,perplexity=15,sequence=c(1,5,100,"n"),ncol=2, nrow=length(sequence)/ncol,display=TRUE)
birewire.visual.monitoring.undirected(data,accuracy=0.00005,verbose=FALSE,MAXITER_MUL=10, exact=FALSE,n.networks=100,perplexity=15,sequence=c(1,5,100,"n"),ncol=2, nrow=length(sequence)/ncol,display=TRUE)
data |
The initial undirected graph, either an adjacency matrix or an igraph undirected graph object. Since 3.6.0, if the matrix is provided, such matrix can contain also NAs and the position of such entries will be preserved by the SA; |
accuracy |
0.00005 (default) is the desired level of accuracy reflecting the average distance between the Jaccard index at the N-th step and its analytically derived fixed point in terms of fracion of common edges; |
verbose |
TRUE (default). When TRUE a progression bar is printed during computation. |
MAXITER_MUL |
10 (default). If exact==TRUE in order to prevent a possible infinite loop the program stops anyway after MAXITER_MUL*max.iter iterations; |
exact |
FALSE (default). If TRUE the program performs max.iter swithcing steps, otherwise the program will count also the not-performed swithcing steps; |
n.networks |
100 (default): the number of network generated for each step defined in sequence ; |
perplexity |
15 (default): the value of perplexity passed to the function |
sequence |
c(1,5,100,"n")(default) the sequence of step for wich generating a sampler
(see |
ncol |
2 (default). The number of column in the plot; |
nrow |
length(sequence)/ncol (default). The number of row in the plot; |
display |
TRUE (default). If TRUE the result of tsne is displayed. |
For each value p in sequence (it that can also contain the special character "n", see birewire.rewire.bipartite
), the routine generates n.networks sampled each p SS from the SA initialized with the given data. Pariwise distance are computed using the Jaccard distance and the resulting matrix is the input for the dimensional scaling performed by the function Rtsne
. An explorative plot is displayed if display is set to TRUE.
A list containing the list containing the distance matrices dist and the list containing the tsne results Rtsne.
Andrea Gobbi
Maintainer: Andrea Gobbi <[email protected]>
Gobbi, A. and Iorio, F. and Dawson, K. J. and Wedge, D. C. and Tamborero, D. and Alexandrov, L. B. and Lopez-Bigas, N. and Garnett, M. J. and Jurman, G. and Saez-Rodriguez, J. (2014) Fast randomization of large genomic datasets while preserving alteration counts Bioinformatics 2014 30 (17): i617-i623 doi: 10.1093/bioinformatics/btu474.
Iorio, F. and and Bernardo-Faura, M. and Gobbi, A. and Cokelaer, T.and Jurman, G.and Saez-Rodriguez, J. (2016) Efficient randomization of biologicalnetworks while preserving functionalcharacterization of individual nodes Bioinformatics 2016 1 (17):542 doi: 10.1186/s12859-016-1402-1.
Jaccard, P. (1901), Étude comparative de la distribution florale dans une portion des Alpes et des Jura,
Bulletin de la Société Vaudoise des Sciences Naturelles 37: 547–579.
R. Milo, N. Kashtan, S. Itzkovitz, M. E. J. Newman, U. Alon (2003), On the uniform generation of random graphs with prescribed degree sequences, eprint arXiv:cond-mat/0312028
Van der Maaten, L.J.P. and Hinton, G.E. Visualizing High-Dimensional Data Using t-SNE. Journal of Machine Learning Research 9(Nov):2579-2605, 2008
library(BiRewire) g <- erdos.renyi.game(1000,0.1) tsne = birewire.visual.monitoring.undirected(g,display=FALSE,n.networks=10,perplexity=1)
library(BiRewire) g <- erdos.renyi.game(1000,0.1) tsne = birewire.visual.monitoring.undirected(g,display=FALSE,n.networks=10,perplexity=1)
Breast cancer samples and their respective mutations downloaded from the Cancer Cancer Genome Atlas (TCGA), used in Gobbi et al..
Germline mutations were filtered out of the list of reported mutations; synonymous mutations and mutations identified as benign and tolerated were also removed from the dataset. The bipartite graph resulting when considering this matrix as an incidence matrix has for an edge density equal to
.
data(BRCA_binary_matrix)
data(BRCA_binary_matrix)
http://tcga.cancer.gov/dataportal/
Gobbi, A. and Iorio, F. and Dawson, K. J. and Wedge, D. C. and Tamborero, D. and Alexandrov, L. B. and Lopez-Bigas, N. and Garnett, M. J. and Jurman, G. and Saez-Rodriguez, J. (2014) Fast randomization of large genomic datasets while preserving alteration counts Bioinformatics 2014 30 (17): i617-i623 doi: 10.1093/bioinformatics/btu474.
A simple dsg for testing routines.
data(test_dsg)
data(test_dsg)