-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patht1-multi-exp.py
executable file
·61 lines (53 loc) · 1.66 KB
/
t1-multi-exp.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env python3
#
# Calculates max between exp var in Kapplinger and Tan
#
import base
filename = 't1-multi-exp.tex'
nooocytes = True
qo = 'where cell != "Oocyte"' if nooocytes else ''
# Collect journal references
refs = {}
with base.connect() as con:
c = con.cursor()
q = 'select key, tex from publication_tex'
for k, row in enumerate(c.execute(q)):
refs[row['key']] = row['tex']
caption = """
All reviewed studies containing more than one experiment.
""".strip()
print(f'Writing to {filename}...')
with open(filename, 'w') as f:
# Head
eol = '\n'
f.write(r'\startrowcolors' + eol)
f.write(r'\begin{longtable}{p{6cm}|l}' + eol)
f.write(r'\caption{' + caption + r'} \\' + eol)
f.write(r'\hline' + eol)
f.write(r'\rowcolor{white}' + eol)
f.write(r'Publication')
f.write(r' & Number of experiments')
f.write(r'\\ \hline' + eol)
f.write(r'\endfirsthead' + eol)
f.write(r'\hline' + eol)
f.write(r'\rowcolor{white}' + eol)
f.write(r'Publication')
f.write(r' & Number of experiments')
f.write(r'\\ \hline' + eol)
f.write(r'\endhead' + eol)
f.write(r'\hline' + eol)
f.write(r'\endfoot' + eol)
# Body
form = '{:.3g}'
with base.connect() as con:
c = con.cursor()
rows = c.execute(f'select pub, count(*) as c from midpoints_wt {qo}'
' group by pub having c > 1 order by c desc;')
for row in rows:
x = []
x.append(r'\citet{' + refs[row['pub']] + '}')
x.append(form.format(row['c']))
f.write(' & '.join(x) + r' \\' + eol)
# Footer
f.write(r'\end{longtable}' + eol)
print('Done.')