-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchromatogram.py
46 lines (38 loc) · 1.36 KB
/
chromatogram.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
def make_normalized_chromatogram(self, drug, name):
svgs = sb.NormalChroms(name)
fwhm = self.rdata[drug]['max fwhm']
arrt = self.rdata[drug]['avg rrt']
art = self.rdata[drug]['avg rt']
airt = art / arrt
# Find Max Peak in Cals
drt = 2 * fwhm
ymax = 0
xmin = (art - drt) / airt
xmax = (art + drt) / airt
yp = str(100 * (1 - 1 / p.mult)) + '%'
xp = str(50 + (100 * arrt * 0.02 / drt)) + '%'
svgs.add_line(xp, yp, xp, '100%')
xp = str(50 - (100 * arrt * 0.02 / drt)) + '%'
svgs.add_line(xp, yp, xp, '100%')
for inj in self.rdata[drug]['cals'].values():
cal = inj['chrom-target']
if ymax < cal.ymax:
ymax = cal.ymax
for inj in self.rdata[drug]['cals'].values():
cal = inj['chrom-target']
rt = inj['rt']
rrt = inj['rrt']
if rt is not None and rrt is not None:
irt = rt / rrt
body = cal.get_body(xmin * irt, cal.ymin, xmax * irt, ymax, divx=irt)
svgs.add_calibrator(0, p.chrom_y, body)
# Sample
inj = self.rdata[drug]['smpls'][name]
smpl = inj['chrom-target']
rt = inj['rt']
rrt = inj['rrt']
if rt is not None and rrt is not None:
irt = rt / rrt
body = smpl.get_body(xmin * irt, smpl.ymin, xmax * irt, smpl.ymax, divx=irt)
svgs.add_sample(0, p.chrom_y, body)
return svgs