emdbva 0.0.1.dev1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "{}"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2017 EMBL-EBI
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,32 @@
1
+ Metadata-Version: 2.1
2
+ Name: emdbva
3
+ Version: 0.0.1.dev1
4
+ Summary: CryoEM validation toolkit
5
+ Home-page: https://test.pypi.org/project/va/
6
+ Author: Zhe Wang
7
+ Author-email: zhe@ebi.ac.uk
8
+ License: Apache License
9
+ Keywords: EMDB,Cryoem,Validation
10
+ Classifier: Development Status :: 2 - Pre-Alpha
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.7
17
+ Classifier: Programming Language :: Python :: 2.7
18
+ Description-Content-Type: text/x-rst; charset=UTF-8
19
+ License-File: LICENSE
20
+ Requires-Dist: numpy
21
+ Requires-Dist: scipy >=0.14
22
+ Requires-Dist: scikit-learn
23
+ Requires-Dist: Pillow
24
+ Requires-Dist: memory-profiler
25
+ Requires-Dist: matplotlib
26
+ Requires-Dist: pandas
27
+ Requires-Dist: biopython
28
+ Requires-Dist: mrcfile
29
+ Requires-Dist: opencv-python
30
+
31
+ CryoEM validation analysis pipeline
32
+
@@ -0,0 +1,27 @@
1
+ va/__init__.py,sha256=gHi6sjjnvd4J1-hcYShVW1RQAAZOcbHYxhQZzo7SX4E,268
2
+ va/mainva.py,sha256=w0Xp6iTuzfSHVfm-QDAm7kmfhmYiWj9uUKytoCbJBh8,10026
3
+ va/preparation.py,sha256=HzX6YUB345t84qe1sbWGPawpPEUuyOgN2mwBh98fRsE,72917
4
+ va/qscores.csv,sha256=mZ28YdqnIRywBc6gq_iuiHYBc6zmESIhdXWfx8ZWm0A,902326
5
+ va/validationanalysis.py,sha256=oBufOIl0oOESt_F14iKwgfP56fpab3kMnajWfdZICqQ,343456
6
+ va/version.py,sha256=LCoemN7z7w1sFn6-Dndv1YBASgq8B-b8xYd2uEfNxDs,904
7
+ va/metrics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ va/metrics/bars.py,sha256=WbW7xxbnXR8oXV482Vxiu0EfayDaxEMLe6LLXJ8sT3g,11710
9
+ va/metrics/emda_mmcc.py,sha256=4PZUmPdKSCmsbQMnEXyNUJkyjL08_8vqxqww4sXtB9I,417
10
+ va/metrics/emringer.py,sha256=IkybpIg2HG-qVfQvemouWpCLpSuVZem4tYYlnb4D4ig,1297
11
+ va/metrics/phaserandomization.py,sha256=KtLYlBeusicpuWSxomGxSkJ3RJygWqbxM6NuiqZkMrI,15167
12
+ va/metrics/phenix_cc.py,sha256=sJ-ftYsPDymLoKgD1NmN-6aphsJjgS60941E3hCLuLI,4406
13
+ va/metrics/phenix_mm.py,sha256=rNIsbSqzsWE0wz47yvX9u37KVbh4jEtg3WyHxs9JAno,5916
14
+ va/metrics/qscore.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
+ va/metrics/resmap.py,sha256=uTR048nnwVpYRt_FhVHGmfO7Pw77NArIy2uindOY-04,17951
16
+ va/metrics/smoc.py,sha256=YZPXGLHRgvqJSmLBRkz2ig_Q6QIyXA-eGl48pr4nNxM,3670
17
+ va/metrics/strudel.py,sha256=ki5ocH94U2GMFvDgBnVhDQcVE2CT7ejgrvSahqBthAo,4674
18
+ va/metrics/threedfsc.py,sha256=-Lp91xy_HOLvOjcXrGI1qXw-tPW7NW7WAKy_J4T41XQ,1559
19
+ va/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
+ va/utils/misc.py,sha256=IhcN1PdJr5eUsWXyXNblDV5HQKMcCAqTXKMoCxBbvXk,6753
21
+ va/utils/stars.py,sha256=15yRUZ1nzRMzzw64DOA59q8mLYuCEQOfqGQAEmLToqI,5996
22
+ emdbva-0.0.1.dev1.dist-info/LICENSE,sha256=EKRtSIAJIDq0FaOStnUlRfcyVCRaNuXBEZWfcjSoAYo,11338
23
+ emdbva-0.0.1.dev1.dist-info/METADATA,sha256=iyvNqKAgs1C4glg8h0ITvMdIFnB7OLDHNyWAaxC4E1M,994
24
+ emdbva-0.0.1.dev1.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
25
+ emdbva-0.0.1.dev1.dist-info/entry_points.txt,sha256=3GDgE_RPnedndxYSN7AbQ6ojnQR8dYM3VvJrR_mShSw,38
26
+ emdbva-0.0.1.dev1.dist-info/top_level.txt,sha256=XkRzdik-cabgu1rSDVUmRKNy0pF_RGh-XAviUV9H0p8,3
27
+ emdbva-0.0.1.dev1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.41.2)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ va = va.mainva:main
@@ -0,0 +1 @@
1
+ va
va/__init__.py ADDED
@@ -0,0 +1,10 @@
1
+ import os
2
+ from os import path
3
+ import sys
4
+ from va.version import __version__
5
+
6
+ sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
7
+ # sys.path.append(path.dirname(path.abspath(__file__)))
8
+ BASE_DIR = os.path.dirname(os.path.realpath(__file__))
9
+
10
+ name = 'va'
va/mainva.py ADDED
@@ -0,0 +1,369 @@
1
+ #!/usr/bin/env python
2
+
3
+ """
4
+ mainva.py
5
+
6
+ mainva class used to run the main function of validation
7
+ analysis
8
+
9
+ Copyright [2013] EMBL - European Bioinformatics Institute
10
+ Licensed under the Apache License, Version 2.0 (the
11
+ "License"); you may not use this file except in
12
+ compliance with the License. You may obtain a copy of
13
+ the License at
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+ Unless required by applicable law or agreed to in writing,
16
+ software distributed under the License is distributed on
17
+ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18
+ KIND, either express or implied. See the License for the
19
+ specific language governing permissions and limitations
20
+ under the License.
21
+
22
+ """
23
+
24
+
25
+ __author__ = 'Zhe Wang'
26
+ __email__ = 'zhe@ebi.ac.uk'
27
+ __date__ = '2018-07-24'
28
+
29
+
30
+
31
+ import timeit
32
+ import os
33
+ import sys
34
+ from memory_profiler import memory_usage
35
+ from va.validationanalysis import ValidationAnalysis
36
+ from va.preparation import PreParation as prep
37
+ from va.metrics.strudel import run_strudel
38
+ import threading
39
+ try:
40
+ from PATHS import MAP_SERVER_PATH
41
+ except ImportError:
42
+ MAP_SERVER_PATH = None
43
+ from memory_profiler import profile
44
+ sys.stdout.flush()
45
+
46
+ def allruns(validationobj, runs):
47
+ """
48
+ Each single run included here
49
+
50
+ :param validationobj: validation object from ValidationAnalysis module
51
+ :param runs: list of string which represent each of the function
52
+ :return: None
53
+ """
54
+
55
+ # Projections
56
+ if 'projection' in runs:
57
+ validationobj.orthogonal_projections()
58
+ validationobj.rawmap_projections()
59
+ validationobj.orthogonal_max()
60
+ validationobj.rawmap_max()
61
+ validationobj.orthogonal_min()
62
+ validationobj.rawmap_min()
63
+ validationobj.orthogonal_median()
64
+ validationobj.rawmap_median()
65
+ validationobj.orthogonal_std()
66
+ validationobj.rawmap_std()
67
+
68
+ # Central slice
69
+ if 'central' in runs:
70
+ validationobj.central_slice()
71
+ validationobj.rawmap_central_slice()
72
+
73
+ # Largest variance
74
+ if 'largestvariance' in runs:
75
+ validationobj.largest_variance()
76
+ validationobj.rawmap_largest_variance()
77
+
78
+ # Generate atom inclusion and residue inclusion json file
79
+ if 'inclusion' in runs:
80
+ validationobj.ai_bar()
81
+
82
+ # Sureface views
83
+ if 'surface' in runs:
84
+ validationobj.surfaces()
85
+
86
+ # Masks views
87
+ if 'mask' in runs:
88
+ validationobj.masks()
89
+
90
+ # Desnity distribution
91
+ if 'density' in runs:
92
+ validationobj.mapdensity_distribution()
93
+ validationobj.rawmapdensity_distribution()
94
+
95
+ # Contour level verses volume
96
+ if 'volume' in runs:
97
+ validationobj.volumecontour()
98
+
99
+ # rmcc/CCC
100
+ if 'rmmcc' in runs:
101
+ validationobj.real_mmcc()
102
+
103
+ # RAPS
104
+ if 'raps' in runs:
105
+ validationobj.rapss()
106
+
107
+ # FSC
108
+ if 'fsc' in runs:
109
+ validationobj.fscs()
110
+
111
+ # mmFSC
112
+ if 'mmfsc' in runs:
113
+ validationobj.phenix_mmfsc()
114
+
115
+ # Symmetry
116
+ if 'symmetry' in runs:
117
+ validationobj.symmetry()
118
+
119
+ # Strudel
120
+ if 'strudel' in runs:
121
+ validationobj.strudel()
122
+
123
+ # Q-score
124
+ if 'qscore' in runs:
125
+ validationobj.qscore_bar()
126
+
127
+ # SMOC
128
+ if 'smoc' in runs:
129
+ validationobj.smoc_bar()
130
+
131
+ # Phenix residue-wise CCC
132
+ if 'resccc' in runs:
133
+ validationobj.ccc_bar()
134
+ #
135
+ # if 'phrand' in runs:
136
+ # validationobj.phrand()
137
+
138
+ # Resmap local resolution
139
+ if 'locres' in runs:
140
+ validationobj.locres_resmap()
141
+ validationobj.locres_histo()
142
+
143
+ # EMringer
144
+ if 'emringer' in runs:
145
+ validationobj.emringer()
146
+
147
+ # 3DFSC
148
+ # if '3dfsc' in runs:
149
+ # validationobj.threedfsc()
150
+
151
+ return None
152
+
153
+
154
+ def inallruns(validationobj, runs):
155
+ """
156
+ Each single run included here
157
+
158
+ :param validationobj: validation object from ValidationAnalysis module
159
+ :param runs: list of string which represent each of the function
160
+ :return: None
161
+ """
162
+
163
+ def without_strudel():
164
+ # Projections
165
+ if 'projection' in runs:
166
+ validationobj.orthogonal_projections()
167
+ validationobj.rawmap_projections()
168
+ validationobj.orthogonal_max()
169
+ validationobj.orthogonal_std()
170
+
171
+ # Central slice
172
+ if 'central' in runs:
173
+ validationobj.central_slice()
174
+ validationobj.rawmap_central_slice()
175
+
176
+ # Largest variance
177
+ if 'largestvariance' in runs:
178
+ validationobj.imgvariance()
179
+ validationobj.rawmap_imgvariance()
180
+
181
+ # Generate atom inclusion and residue inclusion json file
182
+ if 'inclusion' in runs:
183
+ validationobj.atom_inclusion()
184
+
185
+ # Sureface views
186
+ if 'surface' in runs:
187
+ validationobj.surfaces()
188
+
189
+ # Masks views
190
+ if 'mask' in runs:
191
+ validationobj.masks()
192
+
193
+ # Desnity distribution
194
+ if 'density' in runs:
195
+ validationobj.mapdensity_distribution()
196
+ validationobj.rawmapdensity_distribution()
197
+
198
+ # Contour level verses volume
199
+ if 'volume' in runs:
200
+ validationobj.volumecontour()
201
+
202
+ # rmcc/CCC
203
+ if 'rmmcc' in runs:
204
+ validationobj.real_mmcc()
205
+
206
+ # RAPS
207
+ if 'raps' in runs:
208
+ validationobj.raps()
209
+ validationobj.rawmap_raps()
210
+ # validationobj.pararaps()
211
+
212
+ # FSC
213
+ if 'fsc' in runs:
214
+ validationobj.fscs()
215
+
216
+ # mmFSC
217
+ if 'mmfsc' in runs:
218
+ validationobj.mmfsc()
219
+
220
+ # Symmetry
221
+ if 'symmetry' in runs:
222
+ validationobj.symmetry()
223
+
224
+ # # Strudel
225
+ # if 'strudel' in runs:
226
+ # validationobj.strudel()
227
+
228
+ # Q-score
229
+ if 'qscore' in runs:
230
+ validationobj.qscore()
231
+
232
+ # SMOC
233
+ if 'smoc' in runs:
234
+ validationobj.smoc()
235
+
236
+ # EMringer
237
+ if 'emringer' in runs:
238
+ validationobj.emringer()
239
+
240
+ # 3DFSC
241
+ # if '3dfsc' in runs:
242
+ # validationobj.threedfsc()
243
+
244
+ # Local resolution
245
+
246
+ return None
247
+
248
+ def strudel_only():
249
+ # Strudel
250
+ if 'strudel' in runs:
251
+ validationobj.strudel()
252
+
253
+ return None
254
+
255
+ t = threading.Thread(target=strudel_only)
256
+ t1 = threading.Thread(target=without_strudel)
257
+ t.start()
258
+ t1.start()
259
+ t.join()
260
+ t1.join()
261
+
262
+
263
+ # @profile
264
+ def main():
265
+
266
+ start_first = timeit.default_timer()
267
+
268
+ # Preparation
269
+ prepobj = prep()
270
+ position = prepobj.args.positions
271
+
272
+ if not prepobj.args.positions:
273
+ # Read map
274
+ inputmap, mapsize, mapdimension = prepobj.read_map()
275
+
276
+ # Read model
277
+ inputmodel, pid, modelsize = prepobj.read_model()
278
+
279
+ # Get model map names
280
+ # modelsmaps, _ = prepobj.modelstomaps()
281
+ modelsmaps = None
282
+ onlybar = prepobj.onlybar
283
+
284
+ # Read half map
285
+ halfeven, halfodd, rawmap, halfmapsize = prepobj.read_halfmaps()
286
+
287
+ # Contour level
288
+ contourlevel = prepobj.contourlevel
289
+
290
+ # Read run parameters
291
+ runs = prepobj.runs()
292
+
293
+ # EMDID
294
+ emdid = prepobj.emdid
295
+ dir = None if emdid is not None else prepobj.dir
296
+
297
+ # Resolution and EM method
298
+ resolution, emmethod = prepobj.resolution, prepobj.method
299
+
300
+ # fscfile
301
+ fscfile = prepobj.fscfile
302
+
303
+ # strudel lib
304
+ strudellib = prepobj.mofit_libpath
305
+
306
+ # 3DFSC root directory
307
+ threed_fsc_dir = prepobj.threedfscdir
308
+
309
+ # Masks
310
+ masks = prepobj.masks
311
+
312
+ # Memory prediction
313
+ memmsg = None
314
+ # if len(runs) == 10 and 'mask' not in runs:
315
+ memmsg = prepobj.memmsg(mapsize)
316
+
317
+ # Platform either wwpdb or emdb(default)
318
+ platform = prepobj.platform
319
+ print('Executed under: {} platform.'.format(platform))
320
+
321
+ # VA starts here on
322
+ print('%sValidation Analysis%s' % (20*'=', 20*'='))
323
+ validationobj = ValidationAnalysis(inputmap, inputmodel, pid, halfeven, halfodd, rawmap, contourlevel, emdid,
324
+ dir, emmethod, resolution, fscfile, masks, modelsmaps, onlybar, strudellib,
325
+ threed_fsc_dir, platform)
326
+
327
+ # Run all the validation piceces and give the peak memory consumption
328
+ if len(runs) == 9 and 'mask' not in runs:
329
+ mem = max(memory_usage((allruns, (validationobj, runs)), multiprocess=True, include_children=True))
330
+ print('The memory peak is: {}.'.format(mem))
331
+ else:
332
+ mem = 0.
333
+ allruns(validationobj, runs)
334
+
335
+ # Change cif file to the original one
336
+ prepobj.change_cifname()
337
+ # Merge all jsons
338
+ prepobj.finiliszejsons()
339
+
340
+ stop = timeit.default_timer()
341
+ alltime = stop - start_first
342
+ # print('Memory usage peak: %s.' % mem)
343
+ print('All time: %s' % alltime)
344
+
345
+
346
+ # Save data for memory prediction
347
+ #if runs['all'] is True:
348
+ if len(runs) == 9 and 'mask' not in runs:
349
+ if inputmodel is not None and modelsize is not None:
350
+ modelout = sum(modelsize)/len(modelsize) if len(inputmodel) != 0 else 0
351
+ vout = MAP_SERVER_PATH if emdid is not None else os.path.dirname(os.path.dirname(dir))
352
+ with open(vout + '/input.csv', 'a+') as f:
353
+ if os.stat(vout + '/input.csv').st_size == 0:
354
+ f.write('%s,%s,%s,%s,%s,%s,%s\n' % ('mapname', 'maprealsize', 'halfmapsize', 'modelrealsize', 'mapdimension', 'alltime', 'mem'))
355
+ f.write('%s,%s,%s,%s,%s,%s,%s\n' % (prepobj.mapname, mapsize, halfmapsize, modelout, mapdimension, alltime, mem))
356
+ f.close()
357
+ else:
358
+ vout = MAP_SERVER_PATH if emdid is not None else os.path.dirname(os.path.dirname(dir))
359
+ else:
360
+ vout = None
361
+
362
+ return None
363
+ elif position == 'strudel':
364
+ run_strudel(prepobj.full_modelpath, prepobj.full_mappath, prepobj.mofit_libpath, prepobj.strdout)
365
+
366
+
367
+ if __name__ == '__main__':
368
+ main()
369
+
va/metrics/__init__.py ADDED
File without changes