Genome scale network model
From CSBLwiki
(Difference between revisions)
Line 16: | Line 16: | ||
library("BiGGR") # <- related packages automatically ON (graph, igraph,...) | library("BiGGR") # <- related packages automatically ON (graph, igraph,...) | ||
load("shewanella.rdata") | load("shewanella.rdata") | ||
+ | #sm # stoichiometric matrix | ||
+ | metabo = rownames(sm) # metabolites | ||
+ | fluxname = colnames(sm) # reactions | ||
+ | dim(sm) | ||
+ | am = matrix(0,729,729) # null adj. matrix | ||
+ | dimnames(am) = list(metabo,metabo); am[1:5,1:5] | ||
+ | ## converting sm to am | ||
+ | for(i in 1:ncol(sm)) { | ||
+ | # i = 1 | ||
+ | ind = names(sm[which(sm[,i]!=0),i]) | ||
+ | am[ind,ind] = 1 | ||
+ | # print(i) | ||
+ | } | ||
+ | diag(am) = 0 # set digonal '0' | ||
+ | ## Too many edges such as ATP, H2O, PPi.... | ||
+ | cofact = sort(rowSums(am),decreasing=T)[1:100] | ||
+ | cofact # top 100; mostly cofactors, tRNA... | ||
+ | cof.ind = which(metabo %in% names(cof)) | ||
+ | am.m = am[-cof.ind,-cof.ind] | ||
+ | dim(am.m) # 629 629 | ||
+ | |||
+ | ## adjacency matrix to graph obj. | ||
+ | gl = new("graphAM",adjMat=am.m) | ||
+ | |||
</pre> | </pre> |
Revision as of 16:21, 21 July 2011
- Graph Visualization
- Bioconductor Install
- Rgraphviz
- rsbml
- BiGGR
source("http://bioconductor.org/biocLite.R") ## requirement: libsbml, graphviz library biocLite("rsbml","Rgraphviz","BiGGR",type="source") # compiling from source code ### ### visualization of stoichiometric matrix ### library("BiGGR") # <- related packages automatically ON (graph, igraph,...) load("shewanella.rdata") #sm # stoichiometric matrix metabo = rownames(sm) # metabolites fluxname = colnames(sm) # reactions dim(sm) am = matrix(0,729,729) # null adj. matrix dimnames(am) = list(metabo,metabo); am[1:5,1:5] ## converting sm to am for(i in 1:ncol(sm)) { # i = 1 ind = names(sm[which(sm[,i]!=0),i]) am[ind,ind] = 1 # print(i) } diag(am) = 0 # set digonal '0' ## Too many edges such as ATP, H2O, PPi.... cofact = sort(rowSums(am),decreasing=T)[1:100] cofact # top 100; mostly cofactors, tRNA... cof.ind = which(metabo %in% names(cof)) am.m = am[-cof.ind,-cof.ind] dim(am.m) # 629 629 ## adjacency matrix to graph obj. gl = new("graphAM",adjMat=am.m)