EAM Global Minimization Against Human Glucocorticoid Receptor Experimental Data

Supplementary Material for Li, et al. (2017) “Genetically tunable frustration controls allostery in an intrinsically disordered transcription factor”.

Hilser Lab, July 2017.  Hesam Motlagh, Jordan White, Jamie Wrabl.

The purpose of this Mathematica notebook is an implementation of the Ensemble Allosteric Model (EAM) to estimate reasonable parameters that reproduce experimental data for human glucocorticoid receptor (GR).  The EAM is constrained by ten data points measured from in vivo transcription assays and in vitro binding affinities measured on five GR isoforms A, B, C1, C2, C3 as defined in Figure 1 of Li, et al.  This implementation also uses the following experimental constraints:

(1) The interaction energies between the DNA-binding domain (DBD), and either the regulatory region (R) of C2 or the R of C1, are equal to zero kcal/mol.

(2) The coupling energy etween the DBD and the R of B is 0.7 times the coupling between the DBD and the R of A.

(3) The measured TMAO osmolyte refolding free energies (ΔG) for C3-NTD (N-terminal domain), A-NTD, and C3-NTD-DBD, reported in Supplementary Figure 2a of Li, et al.

Eight thermodynamic parameters are estimated: ΔGDBD, Δg-DBD-R, ΔgGRE, ΔGRB, ΔGRC1, ΔGRC2, ΔgR-F, and a scaling parameter A (necessary to convert EAM population to the experimental observable of transcription activity).

Instructions:  There are 16 numbered sections.  Each should be separately executed, in numerical order, starting with section 1.  Output is the set of thermodynamic parameters satisfying the EAM, and a plot of the simulated transcription activity and binding affinity compared to experiment.  (Such data were used to make Figure 3b of Li, et al.  Error bars in that Figure were obtained by running this notebook multiple times, using different values of ΔGF, ΔGANTD, and ΔGC3DBD each time, sampled according to normal distributions with mean equal to the experimentally measured value and standard deviation equal to the experimental error value.)  Output obtained from our lab in a typical execution is included below; re-running the notebook will result in slightly different numerical values since this implementation is stochastic.

Section 1.  Definitions, constants,and experimental input values.

R = 1.987; (*Universal Gas Constant in cal/mol*K*)
T = 22+273.15; (*Room temperature calculations*)
(*data in the format (binding affinity, activity) normalized to the values for the A-NTD*)
(*INPUT THE KNOWN VALUES*)
ΔGF = -7600; (* Experimental Value -7.6 +/- 0.3 kcal/mol, Li, et al. Supplementary Figure 2a *)
ΔGANTD = -10100; (* Experimental Value -10.1 +/- 0.9 kcal/mol, Li, et al. Supplementary Figure 2a *)
ΔGC3DBD = -6700; (* Experimental Value -6.7 +/- 0.4 kcal/mol, Li, et al. Supplementary Figure 2a *)
(*What are the constrained unknowns?*)
ΔGR=ΔGANTD-ΔGF-ΔgRF;
ΔgDBDF=ΔGC3DBD-ΔGDBD-ΔGF;

Section 2.  Calculate partition function for the C3-DBD construct.

(*Let's start calculating statistical weights for the C3-DBD Ensemble using a 2-domain EAM for each domain/GRE stabilization*)
SWdbdC3=Exp[-ΔGDBD/(R*T)];
SWFC3=Exp[-ΔGF/(R*T)];
SWdbdFC3=Exp[-ΔgDBDF/(R*T)];
Zgre=Exp[-(ΔgGRE)/(R*T)];
(*Now calculate statistical weights of each state*)
K1C3=SWFC3*SWdbdFC3;
K2C3=SWdbdC3*SWdbdFC3;
KUC3=SWdbdC3*SWFC3*SWdbdFC3;
PartFunC3=1+K1C3+K2C3+KUC3;
(*now calculate probabilities of interest*)
PrdbdFC3=(1+K1C3)/PartFunC3;
PrFFC3=(1+K2C3)/PartFunC3;
(*Now recalculate the partition in the presence of the GRE*)
PartFunC3g=(1+Zgre)*(1+K1C3)+K2C3+KUC3;
(*Now calcualte the final probabilities of interest*)
PrFFC3gre=(1+Zgre+K2C3)/PartFunC3g;
dPrFFC3=PrFFC3gre-PrFFC3;
(*states that don't bind GRE and do bind GRE, respectively*)
noBindC3=K2C3+KUC3;
bindC3=1+K1C3;

Section 3.  Calculate partition function for the A-NTD-DBD construct.

(*Calculate the statistical weight of each domain/interaction for the A isoform*)
SWdbdA=Exp[-(ΔGDBD)/(R*T)];
SWRA=Exp[-(ΔGR)/(R*T)];
SWFA=Exp[-(ΔGF)/(R*T)];
SWdbdRA=Exp[-(ΔgDBDR)/(R*T)];
SWRFA=Exp[-(ΔgRF)/(R*T)];
SWdbdFA=Exp[-(ΔgDBDF)/(R*T)];
(*Now calculate the statistical weight of each state for the A isoform*)
K1A=SWdbdA*SWdbdRA*SWdbdFA;
K2A=SWRA*SWdbdRA*SWRFA;
K3A=SWFA*SWRFA*SWdbdFA;
K4A=SWRA*SWFA*SWdbdRA*SWRFA*SWdbdFA;
K5A=SWdbdA*SWFA*SWdbdRA*SWRFA*SWdbdFA;
K6A=SWdbdA*SWRA*SWdbdRA*SWRFA*SWdbdFA;
KUA=SWdbdA*SWRA*SWFA*SWdbdRA*SWRFA*SWdbdFA;
PartFunA=1+K1A+K2A+K3A+K4A+K5A+K6A+KUA;
(*Based on these,calculate the probabilities of interest for the A isoform*)
PrdbdFA=(1+K2A+K3A+K4A)/PartFunA;
PrFFA=(1+K1A+K2A+K6A)/PartFunA;
(*Now recalculate the Partition in the presence of the GRE for the A isoform*)
PartFunAg=(1+Zgre)*(1+K2A+K3A+K4A)+K1A+K5A+K6A+KUA;
(*Now calculate the final probability of interest for the A isoform*)
PrFFAgre=((1+K2A)*(1+Zgre)+K1A+K6A)/PartFunAg;
dPrFFA=PrFFAgre-PrFFA;
(*states that don't bind GRE and do bind GRE, respectively*)
noBindA=K1A+K5A+K6A+KUA;
bindA=1+K2A+K3A+K4A;

Section 4.  Calculate partition function for the B isoform.

(*Calculate the statistical weight of each domain/interaction for the B isoform*)
SWdbdB=Exp[-(ΔGDBD)/(R*T)];
SWRB=Exp[-(ΔGRB)/(R*T)];
SWFB=Exp[-(ΔGF)/(R*T)];
SWdbdRB=Exp[-(ΔgDBDR/3.4*2.0)/(R*T)];
SWRFB=Exp[-(ΔgRF)/(R*T)];
SWdbdFB=Exp[-(ΔgDBDF)/(R*T)];
(*Now calculate the statistical weight of each state for the B isoform*)
K1B=SWdbdB*SWdbdRB*SWdbdFB;
K2B=SWRB*SWdbdRB*SWRFB;
K3B=SWFB*SWRFB*SWdbdFB;
K4B=SWRB*SWFB*SWdbdRB*SWRFB*SWdbdFB;
K5B=SWdbdB*SWFB*SWdbdRB*SWRFB*SWdbdFB;
K6B=SWdbdB*SWRB*SWdbdRB*SWRFB*SWdbdFB;
KUB=SWdbdB*SWRB*SWFB*SWdbdRB*SWRFB*SWdbdFB;
PartFunB=1+K1B+K2B+K3B+K4B+K5B+K6B+KUB;
(*Based on these,calculate the probabilities of interest for the B isoform*)
PrdbdFB=(1+K2B+K3B+K4B)/PartFunB;
PrFFB=(1+K1B+K2B+K6B)/PartFunB;
(*Now recalculate the partition in the presence of the GRE for the B isoform*)
PartFunBg=(1+Zgre)*(1+K2B+K3B+K4B)+K1B+K5B+K6B+KUB;
(*Now calculate the final probability of interest for the B isoform*)
PrFFBgre=((1+K2B)*(1+Zgre)+K1B+K6B)/PartFunBg;
dPrFFB=PrFFBgre-PrFFB;
(*states that don't bind GRE and do bind GRE, respectively*)
noBindB=K1B+K5B+K6B+KUB;
bindB=1+K2B+K3B+K4B;

Section 5.  Calculate partition function for the C1 isoform.

(*Calculate the statistical weight of each domain/interaction for the C1 isoform*)
SWdbdC1=Exp[-(ΔGDBD)/(R*T)];
SWRC1=Exp[-(ΔGRC1)/(R*T)];
SWFC1=Exp[-(ΔGF)/(R*T)];
SWdbdRC1=Exp[-(0)/(R*T)];
SWRFC1=Exp[-(ΔgRF)/(R*T)];
SWdbdFC1=Exp[-(ΔgDBDF)/(R*T)];
(*Now calculate the statistical weight of each state for the C1 isoform*)
K1C1=SWdbdC1*SWdbdRC1*SWdbdFC1;
K2C1=SWRC1*SWdbdRC1*SWRFC1;
K3C1=SWFC1*SWRFC1*SWdbdFC1;
K4C1=SWRC1*SWFC1*SWdbdRC1*SWRFC1*SWdbdFC1;
K5C1=SWdbdC1*SWFC1*SWdbdRC1*SWRFC1*SWdbdFC1;
K6C1=SWdbdC1*SWRC1*SWdbdRC1*SWRFC1*SWdbdFC1;
KUC1=SWdbdC1*SWRC1*SWFC1*SWdbdRC1*SWRFC1*SWdbdFC1;
PartFunC1=1+K1C1+K2C1+K3C1+K4C1+K5C1+K6C1+KUC1;
(*Based on these,calculate the probabilities of interest for the C1 isoform*)
PrdbdFC1=(1+K2C1+K3C1+K4C1)/PartFunC1;
PrFFC1=(1+K1C1+K2C1+K6C1)/PartFunC1;
(*Now recalculate the partition in the presence of the GRE for the C1 isoform*)
PartFunC1g=(1+Zgre)*(1+K2C1+K3C1+K4C1)+K1C1+K5C1+K6C1+KUC1;
(*Now calculate the final probability of interest for the C1 isoform*)
PrFFC1gre=((1+K2C1)*(1+Zgre)+K1C1+K6C1)/PartFunC1g;
dPrFFC1=PrFFC1gre-PrFFC1;
(*states that don't bind GRE and do bind GRE, respectively*)
noBindC1=K1C1+K5C1+K6C1+KUC1;
bindC1=1+K2C1+K3C1+K4C1;

Section 6.  Calculate partition function for the C2 isoform.

(*Calculate the statistical weight of each domain/interaction for the C2 isoform*)
SWdbdC2=Exp[-(ΔGDBD)/(R*T)];
SWRC2=Exp[-(ΔGRC2)/(R*T)];
SWFC2=Exp[-(ΔGF)/(R*T)];
SWdbdRC2=Exp[-(0)/(R*T)];
SWRFC2=Exp[-(ΔgRF)/(R*T)];
SWdbdFC2=Exp[-(ΔgDBDF)/(R*T)];
(*Now calculate the statistical weight of each state for the C2 isoform*)
K1C2=SWdbdC2*SWdbdRC2*SWdbdFC2;
K2C2=SWRC2*SWdbdRC2*SWRFC2;
K3C2=SWFC2*SWRFC2*SWdbdFC2;
K4C2=SWRC2*SWFC2*SWdbdRC2*SWRFC2*SWdbdFC2;
K5C2=SWdbdC2*SWFC2*SWdbdRC2*SWRFC2*SWdbdFC2;
K6C2=SWdbdC2*SWRC2*SWdbdRC2*SWRFC2*SWdbdFC2;
KUC2=SWdbdC2*SWRC2*SWFC2*SWdbdRC2*SWRFC2*SWdbdFC2;
PartFunC2=1+K1C2+K2C2+K3C2+K4C2+K5C2+K6C2+KUC2;
(*Based on these,calculate the probabilities of interest for the C2 isoform*)
PrdbdFC2=(1+K2C2+K3C2+K4C2)/PartFunC2;
PrFFC2=(1+K1C2+K2C2+K6C2)/PartFunC2;
(*Now recalculate the partition in the presence of the GRE for the C2 isoform*)
PartFunC2g=(1+Zgre)*(1+K2C2+K3C2+K4C2)+K1C2+K5C2+K6C2+KUC2;
(*Now calculate the final probability of interest for the C2 isoform*)
PrFFC2gre=((1+K2C2)*(1+Zgre)+K1C2+K6C2)/PartFunC2g;
dPrFFC2=PrFFC2gre-PrFFC2;
(*states that don't bind GRE and do bind GRE, respectively*)
noBindC2=K1C2+K5C2+K6C2+KUC2;
bindC2=1+K2C2+K3C2+K4C2;

Section 7.  Calculate ΔG of dissociation from GRE.

Agre=-R*T*Log[15*(10^5)];  (*convert Ka to Molar and calculate association energy*)
Bgre=-R*T*Log[12*(10^5)];
C1gre=-R*T*Log[9.6*(10^5)];
C2gre=-R*T*Log[8.4*(10^5)];
C3gre=-R*T*Log[11*(10^5)];

Note:  Binding model is of the form:  ΔGapparent (calculated above)  ==  ΔGintrinsic (same for all isoforms; ΔgGRE in above partition functions)  +  RT ln( 1 + Sum(Statistical weights of states that don’t bind GRE) / Sum(Statistical weights that bind GRE) )

Section 8.  Set up the model and the experimental data.

(*data input is {Activity, -RTln(Kd for GRE)} *)

ClearAll[datatoFit,modeltoFit];
datatoFit={27.6,Agre,35.3,Bgre,31.4,C1gre,24.0,C2gre,124.0,C3gre}; 

Print[datatoFit];

(*this data is in the form of transcription activation for A/B/C1/C2/C3 and then the same for binding affinity divided by 10^5*)

modeltoFit={A*dPrFFA,ΔgGRE*((((1+Zgre)*(1+K2A+K3A+K4A))/PartFunAg)),A*dPrFFB,ΔgGRE*((((1+Zgre)*(1+K2B+K3B+K4B))/PartFunBg)),A*dPrFFC1,ΔgGRE*((((1+Zgre)*(1+K2C1+K3C1+K4C1))/PartFunC1g)),A*dPrFFC2,ΔgGRE*((((1+Zgre)*(1+K2C2+K3C2+K4C2))/PartFunC2g)),A*dPrFFC3,ΔgGRE*((((1+Zgre)*(1+K1C3))/PartFunC3g))};

Section 9.  Optimize the model against a merit function, choosing the initial conditions randomly to increase the likelihood of finding the global optimum.

BestMerit=-40000;countr=0;
(*ΔgGRE=-1728.09;*)
For[f=1,f≤50,f++,
ClearAll[A,ΔGDBD,ΔgDBDR,ΔgRF,ΔGRB,ΔGRC1,ΔGRC2,result];

result=NMaximize[-((((((Abs[datatoFit[[1]]-modeltoFit[[1]]])/(Abs[datatoFit[[1]]+modeltoFit[[1]]])))+(((Abs[datatoFit[[2]]-modeltoFit[[2]]])/(Abs[datatoFit[[2]]+modeltoFit[[2]]])))))^2)-((((((Abs[datatoFit[[3]]-modeltoFit[[3]]])/(Abs[datatoFit[[3]]+modeltoFit[[3]]])))+(((Abs[datatoFit[[4]]-modeltoFit[[4]]])/(Abs[datatoFit[[4]]+modeltoFit[[4]]])))))^2)-((((((Abs[datatoFit[[5]]-modeltoFit[[5]]])/(Abs[datatoFit[[5]]+modeltoFit[[5]]])))+(((Abs[datatoFit[[6]]-modeltoFit[[6]]])/(Abs[datatoFit[[6]]+modeltoFit[[6]]])))))^2)-((((((Abs[datatoFit[[7]]-modeltoFit[[7]]])/(Abs[datatoFit[[7]]+modeltoFit[[7]]])))+(((Abs[datatoFit[[8]]-modeltoFit[[8]]])/(Abs[datatoFit[[8]]+modeltoFit[[8]]])))))^2)-((((((Abs[datatoFit[[9]]-modeltoFit[[9]]])/(Abs[datatoFit[[9]]+modeltoFit[[9]]])))+(((Abs[datatoFit[[10]]-modeltoFit[[10]]])/(Abs[datatoFit[[10]]+modeltoFit[[10]]])))))^2),{{A,RandomReal[{-1000,0}],RandomReal[{0,1000}]},{ΔGDBD,RandomReal[{-1000,0}],RandomReal[{0,1000}]},{ΔgDBDR,RandomReal[{-1000,0}],RandomReal[{0,1000}]},{ΔgRF,RandomReal[{-1000,0}],RandomReal[{0,1000}]},{ΔgGRE,RandomReal[{-1000,0}],RandomReal[{0,1000}]},{ΔGRB,RandomReal[{-1000,0}],RandomReal[{0,1000}]},{ΔGRC1,RandomReal[{-1000,0}],RandomReal[{0,1000}]},{ΔGRC2,RandomReal[{-1000,0}],RandomReal[{0,1000}]}},Method->"RandomSearch",MaxIterations->1000];
Print[f];
If[result[[1]]>BestMerit,BestMerit=result[[1]];BestArry=result;Print[f,BestArry]];
countr=countr+1;If[countr>1000,Print["Trial:"]; Print[ f];countr=1]
(*Print[result];*)
]
Print[BestMerit,result];

Section 10. Load found parameters for subsequent calculation of simulated transcription activity and binding affinity.

"dGDBD"
dGDBD =BestArry[[2]][[2]][[2]]
ΔGDBD=BestArry[[2]][[2]][[2]]
"dg-DBD-R"
dgDBDR =BestArry[[2]][[3]][[2]]
ΔgDBDR=BestArry[[2]][[3]][[2]]
"dg-R-F"
dgRF =BestArry[[2]][[4]][[2]]
ΔgRF=BestArry[[2]][[4]][[2]]
"dGR"
dGR = ΔGANTD-ΔGF-dgRF 
"dGRB"
dGRB = BestArry[[2]][[6]][[2]]
ΔGRB= BestArry[[2]][[6]][[2]]
"dGRC1"
dGRC1 =BestArry[[2]][[7]][[2]]
ΔGRC1=BestArry[[2]][[7]][[2]]
"dGC2"
dGRC2 = BestArry[[2]][[8]][[2]]
ΔGRC2= BestArry[[2]][[8]][[2]]
"dg-DBD-F"
dgDBDF=ΔGC3DBD-dGDBD-ΔGF
"dGF"
dGF = -7600
"A"
a=BestArry[[2]][[1]][[2]]
"ΔgGRE"
ΔgGRE=BestArry[[2]][[5]][[2]]

Section 11.  Calculate partition function for the simulated C3-DBD construct.

(*Let's start calculating statistical weights for the C3-DBD Ensemble using a 2-domain EAM for each domain/GRE stabilization*)
cSWdbdC3=Exp[-dGDBD/(R*T)];
cSWFC3=Exp[-dGF/(R*T)];
cSWdbdFC3=Exp[-dgDBDF/(R*T)];
cZgre=Exp[-(ΔgGRE)/(R*T)];
(*Now calculate statistical weights of each state*)
cK1C3=cSWFC3*cSWdbdFC3;
cK2C3=cSWdbdC3*cSWdbdFC3;
cKUC3=cSWdbdC3*cSWFC3*cSWdbdFC3;
cPartFunC3=1+cK1C3+cK2C3+cKUC3;
(*now calculate probabilities of interest*)
cPrdbdFC3=(1+cK1C3)/cPartFunC3;
cPrFFC3=(1+cK2C3)/cPartFunC3;
(*Now recalculate the partition in the presence of the GRE*)
cPartFunC3g=(1+cZgre)*(1+cK1C3)+cK2C3+cKUC3;
(*Now calcualte the final probabilities of interest; probability of F folded in C3 with GRE and the difference between it and without GRE*)
cPrFFC3gre=(cZgre+cK2C3)/cPartFunC3g;
cdPrFFC3=cPrFFC3gre-cPrFFC3;

Section 12.  Calculate partition function for the simulated A-NTD-DBD construct.

(*Calculate the statistical weight of each domain/interaction for the A isoform*)
cSWdbdA=Exp[-(dGDBD)/(R*T)];
cSWRA=Exp[-(dGR)/(R*T)];
cSWFA=Exp[-(dGF)/(R*T)];
cSWdbdRA=Exp[-(dgDBDR)/(R*T)];
cSWRFA=Exp[-(dgRF)/(R*T)];
cSWdbdFA=Exp[-(dgDBDF)/(R*T)];
(*Now calculate the statistical weight of each state for the A isoform*)
cK1A=cSWdbdA*cSWdbdRA*cSWdbdFA;
cK2A=cSWRA*cSWdbdRA*cSWRFA;
cK3A=cSWFA*cSWRFA*cSWdbdFA;
cK4A=cSWRA*cSWFA*cSWdbdRA*cSWRFA*cSWdbdFA;
cK5A=cSWdbdA*cSWFA*cSWdbdRA*cSWRFA*cSWdbdFA;
cK6A=cSWdbdA*cSWRA*cSWdbdRA*cSWRFA*cSWdbdFA;
cKUA=cSWdbdA*cSWRA*cSWFA*cSWdbdRA*cSWRFA*cSWdbdFA;
cPartFunA=1+cK1A+cK2A+cK3A+cK4A+cK5A+cK6A+cKUA;
(*Based on these,calculate the probabilities of interest for the A isoform*)
cPrdbdFA=(1+cK2A+cK3A+cK4A)/cPartFunA;
cPrFFA=(1+cK1A+cK2A+cK6A)/cPartFunA;
(*Now recalculate the cSW's in the presence of the GRE for the A isoform*)
cPartFunAg=(1+cZgre)*(1+cK2A+cK3A+cK4A)+cK1A+cK5A+cK6A+cKUA;
(*Now calculate the final probability of interest for the A isoform*)
cPrFFAgre=(1+cZgre+cK1A+cK2A+cZgre*cK2A+cK6A)/cPartFunAg;
cdPrFFA=cPrFFAgre-cPrFFA;

Section 13.  Calculate partition function for the simulated B isoform.

(*Calculate the statistical weight of each domain/interaction for the B isoform*)
cSWdbdB=Exp[-(dGDBD)/(R*T)];
cSWRB=Exp[-(dGRB)/(R*T)];
cSWFB=Exp[-(dGF)/(R*T)];
cSWdbdRB=Exp[-(dgDBDR/3.4*2.0)/(R*T)];
cSWRFB=Exp[-(dgRF)/(R*T)];
cSWdbdFB=Exp[-(dgDBDF)/(R*T)];
(*Now calculate the statistical weight of each state for the B isoform*)
cK1B=cSWdbdB*cSWdbdRB*cSWdbdFB;
cK2B=cSWRB*cSWdbdRB*cSWRFB;
cK3B=cSWFB*cSWRFB*cSWdbdFB;
cK4B=cSWRB*cSWFB*cSWdbdRB*cSWRFB*cSWdbdFB;
cK5B=cSWdbdB*cSWFB*cSWdbdRB*cSWRFB*cSWdbdFB;
cK6B=cSWdbdB*cSWRB*cSWdbdRB*cSWRFB*cSWdbdFB;
cKUB=cSWdbdB*cSWRB*cSWFB*cSWdbdRB*cSWRFB*cSWdbdFB;
cPartFunB=1+cK1B+cK2B+cK3B+cK4B+cK5B+cK6B+cKUB;
(*Based on these,calculate the probabilities of interest for the B isoform*)
cPrdbdFB=(1+cK2B+cK3B+cK4B)/cPartFunB;
cPrFFB=(1+cK1B+cK2B+cK6B)/cPartFunB;
(*Now recalculate the cSW's in the presence of the GRE for the B isoform*)

cPartFunBg=(1+cZgre)*(1+cK2B+cK3B+cK4B)+cK1B+cK5B+cK6B+cKUB;
(*Now calculate the final probability of interest for the B isoform*)
cPrFFBgre=(1+cZgre+cK1B+cK2B+cK2B*cZgre+cK6B)/cPartFunBg;
cdPrFFB=cPrFFBgre-cPrFFB;

Section 14.  Calculate partition function for the simulated C1 isoform.

(*Calculate the statistical weight of each domain/interaction for the C1 isoform*)
cSWdbdC1=Exp[-(dGDBD)/(R*T)];
cSWRC1=Exp[-(dGRC1)/(R*T)];
cSWFC1=Exp[-(dGF)/(R*T)];
cSWdbdRC1=Exp[-(0)/(R*T)];
cSWRFC1=Exp[-(dgRF)/(R*T)];
cSWdbdFC1=Exp[-(dgDBDF)/(R*T)];
(*Now calculate the statistical weight of each state for the C1 isoform*)
cK1C1=cSWdbdC1*cSWdbdRC1*cSWdbdFC1;
cK2C1=cSWRC1*cSWdbdRC1*cSWRFC1;
cK3C1=cSWFC1*cSWRFC1*cSWdbdFC1;
cK4C1=cSWRC1*cSWFC1*cSWdbdRC1*cSWRFC1*cSWdbdFC1;
cK5C1=cSWdbdC1*cSWFC1*cSWdbdRC1*cSWRFC1*cSWdbdFC1;
cK6C1=cSWdbdC1*cSWRC1*cSWdbdRC1*cSWRFC1*cSWdbdFC1;
cKUC1=cSWdbdC1*cSWRC1*cSWFC1*cSWdbdRC1*cSWRFC1*cSWdbdFC1;
cPartFunC1=1+cK1C1+cK2C1+cK3C1+cK4C1+cK5C1+cK6C1+cKUC1;
(*C1ased on these,calculate the probabilities of interest for the C1 isoform*)
cPrdbdFC1=(1+cK2C1+cK3C1+cK4C1)/cPartFunC1;
cPrFFC1=(1+cK1C1+cK2C1+cK6C1)/cPartFunC1;
(*Now recalculate the cSW's in the presence of the GRE for the C1 isoform*)

cPartFunC1g=(1+cZgre)*(1+cK2C1+cK3C1+cK4C1)+cK1C1+cK5C1+cK6C1+cKUC1;
(*Now calculate the final probability of interest for the C1 isoform*)
cPrFFC1gre=(1+cZgre+cK1C1+cK2C1+cZgre*cK2C1+cK6C1)/cPartFunC1g;
cdPrFFC1=cPrFFC1gre-cPrFFC1;

Section 15.  Calculate partition function for the simulated C2 isoform.

(*Calculate the statistical weight of each domain/interaction for the C2 isoform*)
cSWdbdC2=Exp[-(dGDBD)/(R*T)];
cSWRC2=Exp[-(dGRC2)/(R*T)];
cSWFC2=Exp[-(dGF)/(R*T)];
cSWdbdRC2=Exp[-(0)/(R*T)];
cSWRFC2=Exp[-(dgRF)/(R*T)];
cSWdbdFC2=Exp[-(dgDBDF)/(R*T)];
(*Now calculate the statistical weight of each state for the C2 isoform*)
cK1C2=cSWdbdC2*cSWdbdRC2*cSWdbdFC2;
cK2C2=cSWRC2*cSWdbdRC2*cSWRFC2;
cK3C2=cSWFC2*cSWRFC2*cSWdbdFC2;
cK4C2=cSWRC2*cSWFC2*cSWdbdRC2*cSWRFC2*cSWdbdFC2;
cK5C2=cSWdbdC2*cSWFC2*cSWdbdRC2*cSWRFC2*cSWdbdFC2;
cK6C2=cSWdbdC2*cSWRC2*cSWdbdRC2*cSWRFC2*cSWdbdFC2;
cKUC2=cSWdbdC2*cSWRC2*cSWFC2*cSWdbdRC2*cSWRFC2*cSWdbdFC2;
cPartFunC2=1+cK1C2+cK2C2+cK3C2+cK4C2+cK5C2+cK6C2+cKUC2;
(*C2ased on these,calculate the probabilities of interest for the C2 isoform*)
cPrdbdFC2=(1+cK2C2+cK3C2+cK4C2)/cPartFunC2;
cPrFFC2=(1+cK1C2+cK2C2+cK6C2)/cPartFunC2;
(*Now recalculate the cSW's in the presence of the GRE for the C2 isoform*)

cPartFunC2g=(1+cZgre)*(1+cK2C2+cK3C2+cK4C2)+cK1C2+cK5C2+cK6C2+cKUC2;
(*Now calculate the final probability of interest for the C2 isoform*)
cPrFFC2gre=(1+cZgre+cK1C2+cZgre*cK2C2+cK2C2+cK6C2)/cPartFunC2g;
cdPrFFC2=cPrFFC2gre-cPrFFC2;

Section 16.  Plot the simulated values, from global optimization of the EAM, versus the experimental data.

expdata = {{27.6,Agre},{35.3,Bgre},{31.4,C1gre},{24.0,C2gre},{124.0,C3gre}};
modeldata={{a*cdPrFFA,ΔgGRE*((((1+cZgre)*(1+cK2A+cK3A+cK4A))/cPartFunAg))},{a*cdPrFFB,ΔgGRE*((((1+cZgre)*(1+cK2B+cK3B+cK4B))/cPartFunBg))},{a*cdPrFFC1,ΔgGRE*((((1+cZgre)*(1+cK2C1+cK3C1+cK4C1))/cPartFunC1g))},{a*cdPrFFC2,ΔgGRE*((((1+cZgre)*(1+cK2C2+cK3C2+cK4C2))/cPartFunC2g))},{a*cdPrFFC3,ΔgGRE*((((1+cZgre)*(1+cK1C3))/cPartFunC3g))}};
Sqrt[(((((expdata[[1]][[1]]-modeldata[[1]][[1]])/(expdata[[1]][[1]]))))^2)]+Sqrt[(((((expdata[[1]][[2]]-modeldata[[1]][[2]])/(expdata[[1]][[2]]))))^2)]+Sqrt[(((((expdata[[2]][[1]]-modeldata[[2]][[1]])/(expdata[[2]][[1]]))))^2)]+Sqrt[(((((expdata[[2]][[2]]-modeldata[[2]][[2]])/(expdata[[2]][[2]]))))^2)]+Sqrt[(((((expdata[[3]][[1]]-modeldata[[3]][[1]])/(expdata[[3]][[1]]))))^2)]+Sqrt[(((((expdata[[3]][[2]]-modeldata[[3]][[2]])/(expdata[[3]][[2]]))))^2)]+Sqrt[(((((expdata[[4]][[1]]-modeldata[[4]][[1]])/(expdata[[4]][[1]]))))^2)]+Sqrt[(((((expdata[[4]][[2]]-modeldata[[4]][[2]])/(expdata[[4]][[2]]))))^2)]+Sqrt[(((((expdata[[5]][[1]]-modeldata[[5]][[1]])/(expdata[[5]][[1]]))))^2)]+Sqrt[(((((expdata[[5]][[2]]-modeldata[[5]][[2]])/(expdata[[5]][[2]]))))^2)](*RMSD*)

SetOptions[ListPlot,BaseStyle->{FontFamily->"Arial",FontSize->18}];
ListPlot[{expdata,modeldata},PlotRange->{{-0.1,130},{-8400,-7900}},PlotStyle->{Blue,Red},PlotMarkers->{Automatic,Medium},Frame->True,FrameLabel->{"Transcription Activity (Fold Induction)","Binding Affinity (cal/mol)"},PlotLabel->"Simulation (Red) vs. Experiment (Blue)"]
Print["Experimental Data: ",expdata];
Print["Simulated Data: ",modeldata];