emdbva 0.0.1.dev136__py3-none-any.whl → 0.0.1.dev137__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: emdbva
3
- Version: 0.0.1.dev136
3
+ Version: 0.0.1.dev137
4
4
  Summary: CryoEM validation toolkit
5
5
  Home-page: https://test.pypi.org/project/va/
6
6
  Author: Zhe Wang
@@ -1,9 +1,9 @@
1
1
  va/__init__.py,sha256=gHi6sjjnvd4J1-hcYShVW1RQAAZOcbHYxhQZzo7SX4E,268
2
- va/mainva.py,sha256=pfO8f9-UKW75Nl5QAb76RTWWuJUvxubuCGchHdY4BRo,12871
2
+ va/mainva.py,sha256=sqcX41PB47A8ppGFbYvVBfzqHtwQPLxV_PJZDrKKKyM,12915
3
3
  va/preparation.py,sha256=yUH8CJJ-lz3yvvgjvcP7ErLBEdVMsyLiXxlV5hzmJeE,111052
4
4
  va/qscores.csv,sha256=O_4JWiqyu6g6AgndbWExD7tSbFYGF-HK2VdnS9zBYuw,1283930
5
- va/validationanalysis.py,sha256=AQWut9RxjqqYHhBLrgjwE0DA0X4ZQOBLqsfoOT1v2e0,325383
6
- va/version.py,sha256=f4k2xWh9g6-wsQmRTu8gDpXKeU_HntlZKvT9yAvzKbc,760
5
+ va/validationanalysis.py,sha256=Q_ctRXP6S81EjRRScGbdzwd3-Va36hcSVM10-zZRuZs,326741
6
+ va/version.py,sha256=YVrnM0X_5pWfBiX2e3T-E6IGNd9ncnPR-rFLUCWvctM,760
7
7
  va/metrics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  va/metrics/bars.py,sha256=MPrVnaf7pr6Q6c4XDVdwnm8Ix1tVQeW2rJEKOGC15nU,23577
9
9
  va/metrics/connected_percentage.py,sha256=HwsuC-Ehi767R57AE9NBGW7s-NwcJI0BGJA-3f0ZgsU,2209
@@ -11,6 +11,7 @@ va/metrics/contour_level_predicator.py,sha256=J7d5DCF8Xx1L0T6JC2DcT2G3izh3EHp6QA
11
11
  va/metrics/emda_mmcc.py,sha256=gH43N3J9uroyvVzgJg30cNztxgaolA3NC67H0IldsxY,447
12
12
  va/metrics/emringer.py,sha256=IkybpIg2HG-qVfQvemouWpCLpSuVZem4tYYlnb4D4ig,1297
13
13
  va/metrics/inclusion.py,sha256=pRpAIXRRutOt_1VfwFL9OiN2QH3eK4rQF6p7XziYbVY,45550
14
+ va/metrics/map_data_validation.py,sha256=YQziNQjl6Ab28eZVnAVbKjiN4jFHqCkjTOAvO_ZI0g8,1483
14
15
  va/metrics/overlap_percentage.py,sha256=WSbJXq3R_ezf5tzoQte-y1oFDAzbUdYTU7-r9BzN3WE,5966
15
16
  va/metrics/phaserandomization.py,sha256=tDL06TGW956VpGgQt7ctiVDWSE5NFRCn1662qkBCSX0,9600
16
17
  va/metrics/phenix_cc.py,sha256=sagK8svWJF15NkyrJdsdlo9s8UwM3qQvEqx2e4jabVU,10804
@@ -33,9 +34,9 @@ va/utils/log_utils.py,sha256=6ercMPRiiy_IITkHfgOO4ydyoIp97QV-KB4pUdEy4KY,520
33
34
  va/utils/misc.py,sha256=dYcZf7J6ubzsvwfpy_QP-6R22RexS8ZawzWasOl7PIE,22010
34
35
  va/utils/rescolor.py,sha256=kOcjd1m7ItLGt4dMfJiH-MLRQOzqUVOSTyiKO1vvmV4,1847
35
36
  va/utils/stars.py,sha256=oV3zzxp3rty36MwBhTdP8RrZegFOX6Gu9RJfxxfP42U,26462
36
- emdbva-0.0.1.dev136.dist-info/LICENSE,sha256=EKRtSIAJIDq0FaOStnUlRfcyVCRaNuXBEZWfcjSoAYo,11338
37
- emdbva-0.0.1.dev136.dist-info/METADATA,sha256=S4p1-4wRUIPGcsE98SpwBAxbMYSxJSgAnZHPdTAxawo,1474
38
- emdbva-0.0.1.dev136.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
39
- emdbva-0.0.1.dev136.dist-info/entry_points.txt,sha256=3GDgE_RPnedndxYSN7AbQ6ojnQR8dYM3VvJrR_mShSw,38
40
- emdbva-0.0.1.dev136.dist-info/top_level.txt,sha256=XkRzdik-cabgu1rSDVUmRKNy0pF_RGh-XAviUV9H0p8,3
41
- emdbva-0.0.1.dev136.dist-info/RECORD,,
37
+ emdbva-0.0.1.dev137.dist-info/LICENSE,sha256=EKRtSIAJIDq0FaOStnUlRfcyVCRaNuXBEZWfcjSoAYo,11338
38
+ emdbva-0.0.1.dev137.dist-info/METADATA,sha256=GVnGZDQo2tsNxWJLCwwphxDUdzHZmfkoYN__7kynIXg,1474
39
+ emdbva-0.0.1.dev137.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
40
+ emdbva-0.0.1.dev137.dist-info/entry_points.txt,sha256=3GDgE_RPnedndxYSN7AbQ6ojnQR8dYM3VvJrR_mShSw,38
41
+ emdbva-0.0.1.dev137.dist-info/top_level.txt,sha256=XkRzdik-cabgu1rSDVUmRKNy0pF_RGh-XAviUV9H0p8,3
42
+ emdbva-0.0.1.dev137.dist-info/RECORD,,
va/mainva.py CHANGED
@@ -58,6 +58,7 @@ def allruns(validationobj, runs):
58
58
 
59
59
  # Projections
60
60
  if 'projection' in runs:
61
+ validationobj.map_data_validation()
61
62
  validationobj.new_projection()
62
63
  validationobj.relion_mask_evaluation()
63
64
 
@@ -0,0 +1,59 @@
1
+ import io
2
+ import os
3
+ from collections import OrderedDict
4
+ from pathlib import Path
5
+ import mrcfile
6
+
7
+
8
+ def _normalise_map_input(map_input):
9
+ if hasattr(map_input, "fullname"):
10
+ return map_input.fullname
11
+ if hasattr(map_input, "filename"):
12
+ return map_input.filename
13
+ return str(map_input)
14
+
15
+
16
+ def validate_single_map(map_input):
17
+ map_path = Path(_normalise_map_input(map_input))
18
+ messages = io.StringIO()
19
+
20
+ result = OrderedDict([
21
+ ("file", str(map_path)),
22
+ ("exists", map_path.exists()),
23
+ ("valid", False),
24
+ ("messages", ""),
25
+ ("error", None),
26
+ ])
27
+
28
+ if not map_path.exists():
29
+ result["error"] = "File does not exist"
30
+ return result
31
+
32
+ try:
33
+ valid = mrcfile.validate(str(map_path), print_file=messages)
34
+ result["valid"] = bool(valid)
35
+ result["messages"] = messages.getvalue().strip()
36
+ except Exception as exc:
37
+ result["error"] = str(exc)
38
+ result["messages"] = messages.getvalue().strip()
39
+
40
+ return result
41
+
42
+
43
+ def run_map_data_validation(map_inputs):
44
+ map_results = OrderedDict()
45
+
46
+ for map_input in map_inputs:
47
+ if map_input is None:
48
+ continue
49
+
50
+ map_path = _normalise_map_input(map_input)
51
+ map_name = os.path.basename(map_path)
52
+
53
+ map_results[map_name] = validate_single_map(map_input)
54
+
55
+ return OrderedDict([
56
+ ("data_validation", OrderedDict([
57
+ ("map_data_validation", map_results)
58
+ ]))
59
+ ])
va/validationanalysis.py CHANGED
@@ -77,6 +77,7 @@ from va.metrics.qscore import *
77
77
  from va.metrics.inclusion import *
78
78
  from va.metrics.connected_percentage import *
79
79
  from va.metrics.overlap_percentage import *
80
+ from metrics.map_data_validation import run_map_data_validation
80
81
  import va
81
82
 
82
83
  try:
@@ -1158,6 +1159,48 @@ class ValidationAnalysis:
1158
1159
  viewer.new_surface_view_chimerax(primary_input_map, primary_input_contour, 'mask', '',
1159
1160
  mask_name, mask_contour)
1160
1161
 
1162
+ @profile_peak_memory()
1163
+ def map_data_validation(self):
1164
+ """
1165
+ Validate map/header data using mrcfile.validate().
1166
+
1167
+ Output JSON structure:
1168
+ data_validation -> map_data_validation -> mapname -> validation results
1169
+ """
1170
+
1171
+ start = timeit.default_timer()
1172
+ map_inputs = []
1173
+
1174
+ for attr in ("map", "rawmap", "hmodd", "hmeven"):
1175
+ try:
1176
+ value = getattr(self, attr, None)
1177
+ if value is not None:
1178
+ map_inputs.append(value)
1179
+ except AttributeError:
1180
+ pass
1181
+
1182
+ try:
1183
+ result_dict = run_map_data_validation(map_inputs)
1184
+
1185
+ out_json = os.path.join(
1186
+ self.workdir,
1187
+ f"{self.mapname}_map_data_validation.json"
1188
+ )
1189
+
1190
+ with codecs.open(out_json, "w", encoding="utf-8") as f:
1191
+ json.dump(result_dict, f)
1192
+
1193
+ print("Map data validation results were collected.")
1194
+
1195
+ except:
1196
+ err = "Map data validation error: {}.".format(sys.exc_info()[1])
1197
+ sys.stderr.write(err + "\n")
1198
+
1199
+ end = timeit.default_timer()
1200
+ print("Map data validation time: %s" % (end - start))
1201
+ print("------------------------------------")
1202
+
1203
+ return None
1161
1204
 
1162
1205
  # Surface Chimera way
1163
1206
  # def new_surface_view_chimerax(self, input_map, input_contour, type='surface', raw='', mask_map=None,
va/version.py CHANGED
@@ -18,5 +18,5 @@ under the License.
18
18
 
19
19
  """
20
20
 
21
- __version__ = '0.0.1.dev136'
21
+ __version__ = '0.0.1.dev137'
22
22
  __em_statistics_version__ = '202505.v01'