-
Notifications
You must be signed in to change notification settings - Fork 1
/
mxdepo.html
136 lines (133 loc) · 5.51 KB
/
mxdepo.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
<!doctype html>
<html style="max-width:800px;">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>merged + unmerged MX data ➜ mmCIF for deposition</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<nav><a href="./">◀ contents</a></nav>
<h1>merged + unmerged MX data ➜ mmCIF for deposition</h1>
<div id="sub">
This page can convert files inside your web browser,<br>
which must be recent enough (from 2018 or later).<br>
Once this page is loaded, no server is contacted.<br>
</div>
<p>
This page prepares a reflection mmCIF file with both merged and unmerged data,
in a format accepted by OneDep
(<a href="https://www.wwpdb.org/news/news?year=2021#60638da1931d5660393084c3">since 2021</a>).
Use it if your software suite does not prepare such files yet.
<ul class="rules">
<li>Merged file must contain intensities – either <I> or I(+)/I(-),<br>
amplitudes (if used for refinement) and free-set flags.
<li>Unmerged data must be scaled.
<li>Both files must have the same space group settings.
In the future, this app may recognize compatible space groups and
reindex unmerged data if needed. For now, it's on you.
<li>Both files must have the same unit cell parameters.
<li>All merged intensities are checked against the unmerged data.
(But you can include unmerged reflections beyond the resolution limit
used in merging).
<li>If your files are more complex, or if you have comments, suggestions,
problems to report – either email
<a href="mailto:[email protected]">[email protected]</a> or
<a href="https://github.com/project-gemmi/gemmi/discussions/categories/about-wwpdb-depositions">discuss</a> it publicly. <b class="caps">← contact</b>
</ul>
<form>
<p>
Merged MTZ or mmCIF file:
<input id="fileInput" type="file" onchange="read_file()" disabled>
<p>
Scaled unmerged MTZ or XDS_ASCII file:
<input id="fileInput2" type="file" onchange="read_file()" disabled>
</form>
<textarea class="emscripten" id="output" rows="10"></textarea>
<p id="pget"> <a id="get" hidden>Download mmCIF</a> </p>
<hr>
<div id="footer">
This tool is based on <a href="https://project-gemmi.github.io/">GEMMI</a>.
For technical details see the
<a href="https://github.com/project-gemmi/wasm">source code repository</a>.
<br/>GEMMI is funded by <a href="https://www.ccp4.ac.uk/">CCP4</a>
and <a href="https://www.globalphasing.com/">Global Phasing Ltd</a>.
</div>
<script type='text/javascript'>
var fileInput = document.getElementById('fileInput');
var fileInput2 = document.getElementById('fileInput2');
var link = document.getElementById('get');
var element = document.getElementById('output');
var Module = {
print: function(text) {
console.log(text);
element.value += text + '\n';
element.scrollTop = element.scrollHeight; // focus on bottom
},
setStatus: function(text) {
Module.print(text);
if (text === '') fileInput.disabled = fileInput2.disabled = false;
},
onRuntimeInitialized: function() {
var version = Module.ccall('get_version', 'string', [], []);
Module.print('Powered by GEMMI ' + version + '.');
}
};
Module['printErr'] = Module['print'];
Module.print('Downloading the converter...');
window.onerror = function() {
Module.print('Exception thrown, see JavaScript console');
};
function read_file() {
var start = new Date();
link.hidden = true;
if (!fileInput || fileInput.files.length === 0) return;
if (!fileInput2 || fileInput2.files.length === 0) return;
var f = fileInput.files[0];
var f2 = fileInput2.files[0];
Module.print('Converting ' + f.name + ' (' + f.size + ' bytes) and ' +
f2.name + ' (' + f2.size + ' bytes)...');
var reader = new FileReader();
var reader2 = new FileReader();
var args = null;
reader.onload = function(evt) {
var arr = new Uint8Array(evt.target.result);
var buffer = Module._malloc(arr.length); // to be free'd in convert.js
Module.writeArrayToMemory(arr, buffer);
args = [buffer, arr.length];
reader2.readAsArrayBuffer(f2);
};
reader2.onload = function(evt) {
var arr = new Uint8Array(evt.target.result);
var buffer = Module._malloc(arr.length);
Module.writeArrayToMemory(arr, buffer);
args.push(buffer);
args.push(arr.length);
args.push(window.location.hash === '#no-intensity-check');
var ret = Module.ccall('mxdepo', 'string',
['number', 'number', 'number', 'number', 'boolean'], args);
var validation_str = Module.ccall('get_str2', 'string', [], []);
Module.print(validation_str);
finalize(ret);
};
function finalize(ret) {
Module.ccall('clear_string', null, [], []);
if (ret[0] == 'E') {
Module.print(ret);
return;
}
Module.print('Resulting mmCIF file has ' + ret.length + ' bytes.');
var now = new Date();
var mb = Math.round(HEAP8.length / (1024 * 102.4)) / 10;
Module.print((now - start) + ' ms elapsed. WASM memory: ' + mb + ' MB.\n');
link.download = f.name.substr(0, f.name.lastIndexOf('.')) + '.cif';
var blob = new Blob([ret], {type: 'text/plain'});
link.href = window.URL.createObjectURL(blob);
link.hidden = false;
//link.click();
}
reader.readAsArrayBuffer(f);
}
</script>
<script type="text/javascript" src="convert/convert.js"></script>
</body>
</html>