/
trends.html
245 lines (229 loc) · 7.94 KB
/
trends.html
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
<!DOCTYPE html>
<html lang="en">
<head>
<title>Trends in X-ray data processing</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="css/dc.css"/>
<style>
html { margin: 0 auto; max-width: 1500px; overflow-y: scroll; }
body { font: 14px sans-serif; line-height: 20px; margin: 0; }
.clearfix:before, .clearfix:after {
display: table; line-height: 0; content: ""; }
.clearfix:after { clear: both; }
h2 { text-align: center; margin-bottom: 10px; color: #444; }
h1#loading { text-align: center; color: #aaa; font-size: 40px; }
strong { color: #333; }
a.reset { text-decoration: none; padding: 0 3px;
color: white; background: teal; }
a.reset:hover { text-decoration: underline; }
#subh { text-align:center; font-size:14px; color:#444; margin-top: 0; }
#footnote { font-size: 12px; text-align: center; color:#444; padding: 8px 0; }
#chart-facility select { min-width: 180px; min-height: 440px; }
#chart-facility { margin-right: 80px; margin-bottom: 10px; }
.dc-chart g.chart-body { clip-path: none; }
text.x-axis-label { font-size: 12px; }
</style>
</head>
<body>
<h2>Trends in the PDB entries</h2>
<p id="subh">
A different presentation of the same data as on
<a href="xray.html">the main page</a>.
<h1 id="loading">LOADING DATA...</h1>
<div id="chart-facility" style="visibility: hidden;">
<strong>Facility</strong>
<a class="reset" href="#">reset</a>
<div class="clearfix"></div>
</div>
<div id="all-data" style="visibility: hidden;">
<div id="chart-detec">
<strong>Detector Technology</strong>
<div class="clearfix"></div>
</div>
<div id="chart-solution">
<strong>Solution Technique</strong>
<div class="clearfix"></div>
</div>
<div id="chart-reduc">
<strong>Reduction Software</strong>
<div class="clearfix"></div>
</div>
<div id="chart-scaling">
<strong>Scaling Software</strong>
<div class="clearfix"></div>
</div>
<div id="chart-refinement">
<strong>Refinement Software</strong>
<div class="clearfix"></div>
</div>
</div>
<div id="footnote" style="clear:both;">
<a href="https://github.com/project-gemmi/pdb-stats">
Source code and info...</a>
</div>
<script type="text/javascript" src="https://d3js.org/d3.v3.min.js"></script>
<!--script type="text/javascript" src="js/d3.js"></script-->
<script type="text/javascript" src="js/crossfilter.js"></script>
<script type="text/javascript" src="js/dc.min.js"></script>
<script type="text/javascript">
"use strict";
var facility_chart = dc.selectMenu('#chart-facility');
var detec_chart = dc.seriesChart('#chart-detec');
var reduc_chart = dc.seriesChart('#chart-reduc');
var scaling_chart = dc.seriesChart('#chart-scaling');
var solution_chart = dc.seriesChart('#chart-solution');
var refinement_chart = dc.seriesChart('#chart-refinement');
var YEARS = [2009, 2021.00];
var DATE_FIELD = 9; // d[9] is release date
var params = window.location.hash.substr(1).split('&');
var PER_QUARTER = (params.indexOf('quarter') !== -1);
var TIMESPAN = PER_QUARTER ? 'Quarter' : 'Year';
var X_LABEL = 'Release ' + TIMESPAN;
if (params.indexOf('depos') !== -1) { // deposition date
YEARS = [2008, 2020.0];
DATE_FIELD = 8; // d[8] is deposition date
X_LABEL = 'Deposition ' + TIMESPAN;
}
if (PER_QUARTER) {
YEARS[1] += 0.125;
}
var AS_PERCENT = (params.indexOf('percent') !== -1);
d3.json('data.json', function(json) {
var SOURCES = {
'H': 'home source',
'F': 'XFEL (any)',
'?': 'synchrotron',
'-': 'unspecified',
'a': 'APS (US, IL)',
'e': 'ESRF (FR)',
'd': 'Diamond LS (UK)',
's': 'Swiss LS (CH)',
'A': 'ALS (US, Cal)',
'S': 'Stanford SRL (US)',
'n': 'NSLS (US, NY)',
'h': 'Shanghai SRF (CN)',
'p': 'Photon Factory (JP)',
'8': 'SPring-8 (JP)',
'b': 'BESSY (DE)',
'u': 'Australian S (AU)',
'f': 'SOLEIL (FR)',
'k': 'PAL/PLS (KR)',
'c': 'CLSI (CA)',
't': 'NSRRC (TW)',
'C': 'CHESS (US, NY)',
'm': 'MAX (SE)',
'D': 'DESY (DE)',
'L': 'LNLS (BR)',
'Z': 'ALBA (ES)',
'E': 'Elettra (IT)',
'B': 'Beijing SRF (CN)',
'U': 'SRS (UK)',
'I': 'Indus (IN)',
'y': 'SLAC (US, Cal)',
'K': 'KSRS (RU, Moscow)',
'z': 'CAMD (US, LA)',
'i': 'AichiSR (JP)',
'g': 'SAGA-LS (JP)',
'T': 'Siam Photon P. (TH)',
};
var DETECT = ['?', 'CCD', 'PAD', 'IP'];
var DETECT_FULL = ['Not specified', 'CCD', 'Pixel Array Detector',
'Image Plate'];
var REDUC_SOFT = { 'X':'XDS', 'H':'HKL', 'M':'Mosflm', 'd':'d*TREK',
'D':'DIALS', 'O': 'Other', '-':'unknown' };
var SCALE_SOFT = { 'A':'Aimless', 'S':'SCALA', 'H':'HKL', 'X':'XSCALE',
'd':'d*TREK', 'O': 'Other', '-':'unknown' };
var REF_SOFT = { 'R':'Refmac', 'P':'Phenix', 'B':'BUSTER', 'C': 'CNS',
'-':'other/mix' };
var STRUCT_SOL = ['known structure', 'MR', 'SAD', 'MAD', 'MIR/SIR',
'SIRAS', 'MIRAS', 'unspecified / other'];
if (PER_QUARTER) {
json.forEach(function (d) {
d[0] = 1989.125 + (((d[DATE_FIELD] >> 5) / 3) | 0) / 4;
});
} else {
json.forEach(function (d) {
d[0] = (1989 + (d[DATE_FIELD] >> 5) / 12) | 0;
});
}
var data = crossfilter(json);
var facil_dim = data.dimension(function(d) { return d[1]; });
var detec_dim = data.dimension(function(d) { return [d[2], d[0]]; });
var reduc_dim = data.dimension(function(d) { return [d[3][0], d[0]]; });
var scaling_dim = data.dimension(function(d) { return [d[3][1], d[0]]; });
var solution_dim = data.dimension(function(d) { return [d[6], d[0]]; });
var ref_dim = data.dimension(function(d) { return [d[3][2], d[0]]; });
d3.select('#loading').remove();
d3.select('#chart-facility').style('visibility', null);
d3.select('#all-data').style('visibility', null);
function setup_reset(chart) {
var root_el = chart.root()[0][0];
var reset_el = root_el.getElementsByClassName('reset')[0];
reset_el.style.visibility = 'hidden';
reset_el.onclick = function() {
chart.filterAll();
dc.redrawAll();
return false;
};
}
function setup_plot(chart, dim) {
var gr = dim.group();
chart
.width(480)
.height(480)
.chart(function(c) { return dc.lineChart(c).renderDataPoints(true); })
.dimension(dim)
.group(gr)
.x(d3.scale.linear().domain(YEARS))
.brushOn(false)
.xAxisLabel(X_LABEL)
.clipPadding(10)
.elasticY(true)
.mouseZoomable(false)
.keyAccessor(function(p) {return p.key[1];})
.legend(dc.legend().x(60).y(30));
if (AS_PERCENT) {
chart.valueAccessor(function(p) {
var all = gr.all();
var total = 0;
for (var i = 0; i < all.length; i++) {
if (all[i].key[1] === p.key[1]) total += all[i].value;
}
return total !== 0 ? 100 * p.value / total : 0;
})
} else {
chart.valueAccessor(function(p) { return p.value; })
}
chart.xAxis().tickFormat(d3.format('d'));
chart.yAxis().tickFormat(d3.format('d'));
chart.margins().left += 10;
return chart;
}
facility_chart
.dimension(facil_dim)
.group(facil_dim.group())
.title(function(p) { return SOURCES[p.key] + ': ' + p.value; })
.order(function(a, b){ return b.value - a.value; })
.controlsUseVisibility(true)
.multiple(true).numberVisible(20);
setup_reset(facility_chart);
setup_plot(detec_chart, detec_dim)
.seriesAccessor(function(p) { return DETECT_FULL[p.key[0]]; });
setup_plot(reduc_chart, reduc_dim)
.seriesAccessor(function(p) { return REDUC_SOFT[p.key[0]]; });
setup_plot(scaling_chart, scaling_dim)
.seriesAccessor(function(p) { return SCALE_SOFT[p.key[0]]; });
setup_plot(solution_chart, solution_dim)
.seriesAccessor(function(p) { return STRUCT_SOL[p.key[0]]; });
setup_plot(refinement_chart, ref_dim)
.seriesAccessor(function(p) { return REF_SOFT[p.key[0]]; });
var on_resize = function() {
dc.renderAll();
};
on_resize();
d3.select(window).on('resize', on_resize);
});
</script>
</body>
</html>