[R] extract objects from R output
Kruti Pandya
kp1005 at gmail.com
Sun Dec 14 21:30:45 CET 2014
I am new to R and using this package BoolNet. I wanted to extract the
boolean transition functions resulting from the output of
generateRandomNKNetwork function. I am able to extract individual function
using
net$interactions$Gene1$expression,net$interactions$Gene2$expression.... .
But it gives me the transition function in quotes. How can I remove the
quotes ?
My goal is to evaluate each transition function at a randomly generated
initial state. What I need to do is to extract each of the individual
functions one by one. Like
extract net$interactions$Gene1$expression
evaluate the function at random initial sate
then extract net$interactions$Gene2$expression
evaluate the function at random initial state
.... do this for all five functions that comes out of the ouput.
I tried something like this but did not work.
for (i in 1:5){
func[[i]]<-rn$interactions$Gene[i]$expression
#extract net$interactions$Gene1$expression,
net$interactions$Gene2$expression and so on
}
# output of generateRandomNKNetwork
install.packages(BoolNet)
library(BoolNet)
net<-generateRandomNKNetwork(5,3,readableFunctions="canonical")
#Output of net
Boolean network with 5 genes
Involved genes:
Gene1 Gene2 Gene3 Gene4 Gene5
Transition functions:
Gene1 = (!Gene5 & Gene1 & !Gene2) | (!Gene5 & Gene1 & Gene2) | (Gene5 &
!Gene1 & !Gene2)
Gene2 = (!Gene1 & !Gene3 & !Gene2) | (!Gene1 & Gene3 & !Gene2) | (!Gene1 &
Gene3 & Gene2) | (Gene1 & Gene3 & Gene2)
Gene3 = (!Gene3 & Gene1 & !Gene2) | (Gene3 & !Gene1 & !Gene2) | (Gene3 &
Gene1 & !Gene2)
Gene4 = (!Gene4 & !Gene2 & !Gene1) | (!Gene4 & !Gene2 & Gene1) | (!Gene4 &
Gene2 & Gene1) | (Gene4 & !Gene2 & !Gene1) | (Gene4 & Gene2 & Gene1)
Gene5 = (!Gene2 & !Gene4 & !Gene5) | (!Gene2 & !Gene4 & Gene5) | (Gene2 &
!Gene4 & Gene5)
net$interactions$Gene1$expression
#[1] "(!Gene5 & Gene1 & !Gene2) | (!Gene5 & Gene1 & Gene2) | (Gene5 &
!Gene1 & !Gene2)"
[[alternative HTML version deleted]]
More information about the R-help
mailing list