Hi, I need help about the creation of a dataframe where for every for cycle I have to add a new column in dataframe with the new values.
Here's the content of the network (called rf.txt in the code)
targets , factors
BDNF, BDNF
SEM3A, SEM3A
TALIN, BDNF
VINCULIN, BDNF
ALFAACTININ, BDNF
FAK , TALIN
DOCK180 , FAK
GRAF , FAK
CDC42 , DOCK180
RAC1 , DOCK180 | PIX
PAK2_3 , CDC42 | RAC1
PIX , PAK2_3
GIT , PIX
PXN ,BDNF &!GIT
RHOA , SEM3A &! GRAF
NWASP , CDC42
WAVE , RAC1
SSH , RAC1
ROCK , RHOA
MLCK , MLCK &!PAK2_3
MLCP, MLCP &! ROCK
MLC_P , ROCK | MLCK &!MLCP
LIMK , PAK2_3
ADFCOFILIN ,SSH &!LIMK
ARP2_3 , NWASP | WAVE
RF , MLC_P | ADFCOFILIN
PROTR , ARP2_3 &! RF
This is the code:
library(BoolNet)
setwd("C:/Users/eleme/OneDrive/Desktop/tesi")
a=loadNetwork("rf.txt")
#print(a)
list= generateState(a,specs=c("BDNF"=1,"SEM3A"=1))
#attr= getAttractors(a,type="synchronous",method = "chosen",startStates = list(list))
#print(attr)
#plot=plotAttractors(attr,title="PLOT EXHAUSTIVE SYNCHRONOUS BDNF ON",mode="table",allInOnePlot = T)
control = 0
inprob= c(0,0,0.04,0.04,0.04,0.04,
0.04,0.04,0.04,0.04,0.04,0.04,
0.04,0.04,0.04,0.04,0.04,0.04,
0.04,0.04,0.04,0.04,0.04,0.04,
0.04,0.04,0.04)
for (i in 1:10000) {
if (i==1){
stat1= stateTransition(a,list,type="asynchronous",
geneProbabilities = inprob)
stat1=data.frame(stat1)
}
if (i!= 1){
last_stat= stat1$stat1
stat1= stateTransition(a,last_stat,type="asynchronous",
geneProbabilities = inprob)
stat1=data.frame(stat1)
if (identical(stat1$stat1,last_stat)){
control= control +1
}
else{
control=0
}
}
if (control==40){
break
}
# print("ok")
new= cbind(stat1,last_stat)
write.table(new,file="new.csv",sep=";", append= TRUE )
}