File indexing completed on 2025-02-23 09:21:58
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 outputFile = "molecularDNAsurvival.txt"
0019 iRootFile = "../molecular-dna.root"
0020 print("\nInput file:",iRootFile,"\n")
0021
0022
0023 r3 = 7100*1e-09 * 2500*1e-09 * 7100*1e-09
0024 NBP = 6405886128
0025 mass = 997 * 4 * 3.141592 * r3 / 3
0026
0027
0028 t0 = 0.0
0029 t1 = 336
0030 dt = 0.001
0031 numpoints = int( (t1 - t0) / dt )
0032
0033
0034
0035
0036 maxDose = 9
0037 DR1 = 720
0038 bp = 1
0039
0040
0041
0042
0043 gamma = 0.19
0044
0045 Lamb1 = 0.10
0046 Lamb2 = 1
0047
0048 Beta1 = 0
0049 Beta2 = 0
0050
0051 Eta = 0.00005
0052
0053 cell = "test"
0054
0055
0056
0057 import ROOT as root
0058 import numpy as np
0059 import matplotlib.pyplot as plt
0060 from scipy.integrate import ode
0061 import threading
0062
0063
0064 def SF_system( T_, DR_, Y_, Sig1_, Sig2_, gamma_, Lamb1_, Lamb2_, Beta1_, Beta2_, Eta_ ):
0065
0066 global T
0067 global DR
0068 global Y
0069 global Sig1
0070 global Sig2
0071 global gamma
0072 global Lamb1
0073 global Lamb2
0074 global Beta1
0075 global Beta2
0076 global Eta
0077
0078 T = T_
0079 DR = DR_
0080 Y = Y_
0081 Sig1 = Sig1_
0082 Sig2 = Sig2_
0083 gamma = gamma_
0084 Lamb1 = Lamb1_
0085 Lamb2 = Lamb2_
0086 Beta1 = Beta1_
0087 Beta2 = Beta2_
0088 Eta = Eta_
0089
0090
0091 return T, DR, Y, Sig1, Sig2, gamma, Lamb1, Lamb2, Beta1, Beta2, Eta
0092
0093 def SF_function( t, x, p ):
0094 if(t<=T):
0095
0096 dx[0] = DR*Y*Sig1 - Lamb1*x[0] - Eta*x[0]*(x[0]+x[1])
0097 dx[1] = DR*Y*Sig2 - Lamb2*x[1] - Eta*x[1]*(x[0]+x[1])
0098 dx[2] = Beta1*Lamb1*x[0] + Beta2*Lamb2*x[1]+gamma*Eta*(x[0]+x[1])*(x[0]+x[1])
0099 dx[3] = (1.-Beta1)*Lamb1*x[0] + (1.-Beta2)*Lamb2*x[1]+(1.-gamma)*Eta*(x[0]+x[1])*(x[0]+x[1])
0100 else:
0101 dx[0] = - Lamb1*x[0] - Eta*x[0]*(x[0]+x[1])
0102 dx[1] = - Lamb2*x[1] - Eta*x[1]*(x[0]+x[1])
0103 dx[2] = Beta1*Lamb1*x[0] + Beta2*Lamb2*x[1]+gamma*Eta*(x[0]+x[1])*(x[0]+x[1])
0104 dx[3] = (1.-Beta1)*Lamb1*x[0] + (1.-Beta2)*Lamb2*x[1]+(1.-gamma)*Eta*(x[0]+x[1])*(x[0]+x[1])
0105 return dx
0106
0107
0108 DSBBPID = []
0109 repDSB = 0
0110 irrDSB = 0
0111 acc_edep = 0
0112 dose = 0
0113 i = 0
0114 eVtoJ = 1.60218e-19
0115
0116
0117
0118 f = root.TFile(iRootFile)
0119
0120 fTree = f.Get("tuples/damage")
0121 for e in fTree:
0122 if (e.TypeClassification=="DSB" or e.TypeClassification=="DSB+" or e.TypeClassification=="DSB++"):
0123 DSBBPID.append((e.Event, e.BasePair))
0124 i += 1
0125
0126 gTree = f.Get("tuples/classification")
0127 for e in gTree:
0128 repDSB += e.DSB
0129 irrDSB += e.DSBp + 2*e.DSBpp
0130
0131 ffTree = f.Get("tuples/chromosome_hits")
0132 for ev in ffTree:
0133 acc_edep += (ev.e_chromosome_kev + ev.e_dna_kev) *1e3
0134
0135
0136
0137 totalDSB = repDSB + irrDSB
0138
0139 dose = acc_edep * eVtoJ / mass
0140
0141
0142
0143
0144 NBP_of_cell = 4682000000
0145 NBPcell = NBP/NBP_of_cell
0146 totalDSBperGyCell = totalDSB/NBPcell/dose
0147
0148 print ("Dose :", dose, "\nTotal DSB/Gy/Cell :", totalDSBperGyCell)
0149
0150 kFactor = 1
0151 S1 = repDSB/NBPcell/dose/kFactor
0152 S2 = irrDSB/NBPcell/dose/kFactor
0153 print("Repairable DSBs/Gy/cell :", S1, "\nIrrepairable DSBs/Gy/cell :", S2, "\n\n")
0154
0155
0156
0157
0158
0159 T = 0
0160 DR = 0
0161 Y = 0
0162 kozi = False
0163 sum = [0]*(maxDose+1)
0164 outputfile = [""] * (maxDose+1)
0165
0166
0167
0168
0169
0170 t = np.linspace(t0, t1, numpoints)
0171
0172 dx = np.zeros(4)
0173 x = np.zeros(4)
0174 dsbs = 0.0
0175 Sig1 = S1
0176 Sig2 = S2
0177
0178 filename = "txt/molecularDNAsurvival_"+cell+".dat"
0179 outputfile1 = open(filename,"w")
0180 outputfile1.write("Dose \t Survival Fraction\n")
0181
0182 for j in range(maxDose+1):
0183
0184 sol = []
0185 time = []
0186 dose = j
0187 expEndTime = dose/DR1
0188
0189
0190
0191 arguments = SF_system( expEndTime, DR1,bp,Sig1,Sig2,gamma,Lamb1,Lamb2,Beta1,Beta2,Eta )
0192 p = [ T, DR, Y, Sig1, Sig2, gamma, Lamb1, Lamb2, Beta1, Beta2, Eta ]
0193
0194 Stepper = "dopri5"
0195
0196 if (j==0):
0197 solver = ode(SF_function).set_integrator(Stepper, nsteps=1)
0198 print("#*#*#*#*#*# Ignore this warning #*#*#*#*#*#")
0199 else:
0200 solver = ode(SF_function).set_integrator(Stepper, nsteps=numpoints)
0201 solver.set_initial_value( x, t0 ).set_f_params(p)
0202
0203
0204
0205
0206 while solver.t < t1:
0207 solver.integrate(solver.t+dt)
0208
0209 sum[j] = solver.y[2]
0210 print("Survival probability of cell ("+cell+") after",j,"Gy is", np.exp(-sum[j]) )
0211 outputfile1.write(str(dose) +"\t"+ str(np.exp(-(solver.y[2]))) +"\n")
0212
0213 c = np.linspace(0, maxDose, num=maxDose+1)
0214 sum=np.array(sum)
0215 outputfile1.close()
0216
0217 print("\nCalculation concluded. Check the final image and close it to end the program.!")
0218
0219 plt.yscale('log')
0220 plt.xlim([0, 8])
0221 plt.ylim([1e-2, 1])
0222 plt.plot(c,np.exp(-sum[:]))
0223 plt.show()
0224
0225 print("\nThank you for using molecularDNAsurvival.!\n")
0226