######=------>
library(ADASPR)
#-------->testing code for multiligandmodel
#kon<-c(2E3, 1E5, 3E4)
kon<-c(2E3, 1E5, 3E2)
#koff<-c(1E-4, 1E-4, 5E-3)
koff<-c(1E-2, 1E-3, 1E-3)
analyteConcentrations<-c(
#5E-4, 4E-4, 3E-4, 2E-4,
#1E-5, 9E-6, 6E-6, 3E-6, 2E-6
9E-5, 7E-5, 5E-5, 3E-5, 2E-5
)
associationLength<-300
dissociationLength<-200
#Rmax<-c(30,120,40)
Rmax<-c(30,100,40)
mlgm<- new("MultiLigandModel", kon=kon, koff=koff, analyteConcentrations=analyteConcentrations,
associationLength=associationLength, dissociationLength=dissociationLength, Rmax=Rmax
)
#now start multiple runs for estimation distributions of results
runs<-2000
fpc_lst<-vector("list", runs)
fpc_m<-NULL
m_m<-NULL
for (i in 1:runs)
{
cat("doing ", i, "th data set....\n")
flush.console()
set.seed(i)
sData<-Simulate(mlgm,sampleFreq=0.01, sd=0.1)
#steady state
fss<-FitSteadyStateSPR(sData[[1]], degree=5, steadyStateStart=95,steadyStateEnd=100, auto=F)
#non-steady state
fpc<-fitPolySPRs(sData[[1]], debug=T, degree=100,weights.step=60, weights.scale=0.1, weights.type="exp");
###======>
###following the above code, starting testing the fitting coefficient of polySPR
m<-fitCoefficientPolySPRs(fpc, analyteConcentrations,debug=F)
#m/fss[1]
m/170
degree<-length(analyteConcentrations)
nConc<-length(analyteConcentrations)
fpc_m<-matrix(rep(0, degree*nConc), ncol=degree, nrow=nConc)
for(j in 1:nConc) #row
{
Y<-rep(0, degree)
for(k in 1:degree)
{
fpc_m[j,k]<-fpc[[j]][[1]][k]*(-1)^(k-1)
}
#Y<-(-1)^(curr_degree-1)*Y
}
rownames(fpc_m)<-paste(rep("conc", nConc), c(1:nConc))
colnames(fpc_m)<-paste(rep("degree", degree), c(1:degree))
fpc_lst[[i]]<-fpc_m
if(i==1)
{
m_m<-matrix(rep(0,runs*degree), nrow=runs, ncol=degree)
}
m_m[i,]<-m
}
#first get the distribution of Rmax
E_kon<-rep(0,length(kon))
E_kon[1]<-sum(Rmax/sum(Rmax)*kon)
E_kon[2]<-sum(Rmax/sum(Rmax)*kon^2)
E_kon[3]<-sum(Rmax/sum(Rmax)*kon^3)
E_kon[4]<-sum(Rmax/sum(Rmax)*kon^4)
E_kon[5]<-sum(Rmax/sum(Rmax)*kon^5)
e_k<-rep(0, length(koff))
e_k[1]<-sum(koff/kon*(Rmax/sum(Rmax)))
e_k[2]<-sum((koff/kon)^2*(Rmax/sum(Rmax)))
e_k[3]<-sum((koff/kon)^3*(Rmax/sum(Rmax)))
e_k[4]<-sum((koff/kon)^4*(Rmax/sum(Rmax)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.