emdbva 0.0.1.dev135__py3-none-any.whl → 0.0.1.dev136__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.dev135
3
+ Version: 0.0.1.dev136
4
4
  Summary: CryoEM validation toolkit
5
5
  Home-page: https://test.pypi.org/project/va/
6
6
  Author: Zhe Wang
@@ -3,7 +3,7 @@ va/mainva.py,sha256=pfO8f9-UKW75Nl5QAb76RTWWuJUvxubuCGchHdY4BRo,12871
3
3
  va/preparation.py,sha256=yUH8CJJ-lz3yvvgjvcP7ErLBEdVMsyLiXxlV5hzmJeE,111052
4
4
  va/qscores.csv,sha256=O_4JWiqyu6g6AgndbWExD7tSbFYGF-HK2VdnS9zBYuw,1283930
5
5
  va/validationanalysis.py,sha256=AQWut9RxjqqYHhBLrgjwE0DA0X4ZQOBLqsfoOT1v2e0,325383
6
- va/version.py,sha256=Gf5EyF5O8LRPG5wXEdXuipIvJnzMJhNj0xnYLScaXxU,760
6
+ va/version.py,sha256=f4k2xWh9g6-wsQmRTu8gDpXKeU_HntlZKvT9yAvzKbc,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
@@ -15,7 +15,7 @@ va/metrics/overlap_percentage.py,sha256=WSbJXq3R_ezf5tzoQte-y1oFDAzbUdYTU7-r9BzN
15
15
  va/metrics/phaserandomization.py,sha256=tDL06TGW956VpGgQt7ctiVDWSE5NFRCn1662qkBCSX0,9600
16
16
  va/metrics/phenix_cc.py,sha256=sagK8svWJF15NkyrJdsdlo9s8UwM3qQvEqx2e4jabVU,10804
17
17
  va/metrics/phenix_mm.py,sha256=rNIsbSqzsWE0wz47yvX9u37KVbh4jEtg3WyHxs9JAno,5916
18
- va/metrics/projections.py,sha256=e7djjVS4ZKV3dyBhg-1r6eRRY3cHU26zgWN9eaCKQrU,18988
18
+ va/metrics/projections.py,sha256=vVxwGTkgDMiWX5rOdyvXQDPBMzTtGOLrRKdOBqBeR94,20721
19
19
  va/metrics/qscore.py,sha256=I4pUy3UN7FVuQpr-5YE8j1cE26QH7r5VAHXi59LpsuQ,43040
20
20
  va/metrics/residue_locres.py,sha256=dXLwyfaKVxT8ZQtkN7sOOuPsP-G8Up6k14h8sU-s9JQ,6004
21
21
  va/metrics/resmap.py,sha256=DhrXZVQegftTeVC8gzA2ho7uLiCdzYpWoYhMq8jyB3A,19960
@@ -33,9 +33,9 @@ va/utils/log_utils.py,sha256=6ercMPRiiy_IITkHfgOO4ydyoIp97QV-KB4pUdEy4KY,520
33
33
  va/utils/misc.py,sha256=dYcZf7J6ubzsvwfpy_QP-6R22RexS8ZawzWasOl7PIE,22010
34
34
  va/utils/rescolor.py,sha256=kOcjd1m7ItLGt4dMfJiH-MLRQOzqUVOSTyiKO1vvmV4,1847
35
35
  va/utils/stars.py,sha256=oV3zzxp3rty36MwBhTdP8RrZegFOX6Gu9RJfxxfP42U,26462
36
- emdbva-0.0.1.dev135.dist-info/LICENSE,sha256=EKRtSIAJIDq0FaOStnUlRfcyVCRaNuXBEZWfcjSoAYo,11338
37
- emdbva-0.0.1.dev135.dist-info/METADATA,sha256=wXVo7-ctgUo6bzHe2sP8cy0bt9KB2qTSL9M3F11qe2E,1474
38
- emdbva-0.0.1.dev135.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
39
- emdbva-0.0.1.dev135.dist-info/entry_points.txt,sha256=3GDgE_RPnedndxYSN7AbQ6ojnQR8dYM3VvJrR_mShSw,38
40
- emdbva-0.0.1.dev135.dist-info/top_level.txt,sha256=XkRzdik-cabgu1rSDVUmRKNy0pF_RGh-XAviUV9H0p8,3
41
- emdbva-0.0.1.dev135.dist-info/RECORD,,
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,,
va/metrics/projections.py CHANGED
@@ -183,7 +183,10 @@ class Projections:
183
183
  def _green_percentage(self, image_obj):
184
184
  """
185
185
  image_obj can be a file path, PIL Image, or numpy array.
186
- Returns green percentage as a float.
186
+ Returns a dictionary with:
187
+ - percentage: total green percentage in the whole image
188
+ - diff_vertical: left-half green percentage minus right-half green percentage
189
+ - diff_horizontal: top-half green percentage minus bottom-half green percentage
187
190
  """
188
191
  if isinstance(image_obj, str):
189
192
  img = Image.open(image_obj).convert("RGB")
@@ -193,10 +196,43 @@ class Projections:
193
196
  img = Image.fromarray(image_obj).convert("RGB")
194
197
 
195
198
  img_array = np.array(img)
196
- green_pixels = np.sum(np.all(img_array == [0, 138, 0], axis=-1))
197
- total_pixels = img_array.shape[0] * img_array.shape[1]
198
- proportion_green = (green_pixels / total_pixels) * 100 if total_pixels else 0.0
199
- return round(proportion_green, 2)
199
+ green_mask = np.all(img_array == [0, 138, 0], axis=-1)
200
+ height, width = green_mask.shape
201
+ total_pixels = height * width
202
+ if total_pixels == 0:
203
+ return {
204
+ 'percentage': 0.0,
205
+ 'diff_vertical': 0.0,
206
+ 'diff_horizontal': 0.0,
207
+ }
208
+
209
+ green_pixels = np.sum(green_mask)
210
+ proportion_green = (green_pixels / total_pixels) * 100
211
+
212
+ mid_vertical = width // 2
213
+ left_total = height * mid_vertical
214
+ right_total = height * (width - mid_vertical)
215
+ green_pixels_left_half = np.sum(green_mask[:, :mid_vertical])
216
+ green_pixels_right_half = np.sum(green_mask[:, mid_vertical:])
217
+ proportion_green_left_half = (green_pixels_left_half / left_total) * 100 if left_total else 0.0
218
+ proportion_green_right_half = (green_pixels_right_half / right_total) * 100 if right_total else 0.0
219
+ diff_vertical = proportion_green_left_half - proportion_green_right_half
220
+
221
+ mid_horizontal = height // 2
222
+ top_total = mid_horizontal * width
223
+ bottom_total = (height - mid_horizontal) * width
224
+ green_pixels_top_half = np.sum(green_mask[:mid_horizontal, :])
225
+ green_pixels_bottom_half = np.sum(green_mask[mid_horizontal:, :])
226
+ proportion_green_top_half = (green_pixels_top_half / top_total) * 100 if top_total else 0.0
227
+ proportion_green_bottom_half = (green_pixels_bottom_half / bottom_total) * 100 if bottom_total else 0.0
228
+ diff_horizontal = proportion_green_top_half - proportion_green_bottom_half
229
+
230
+ return {
231
+ 'percentage': round(proportion_green, 2),
232
+ 'diff_vertical': round(diff_vertical, 2),
233
+ 'diff_horizontal': round(diff_horizontal, 2),
234
+ }
235
+
200
236
 
201
237
  def orthogonal_projections(self, mapin=None, workdir=None, type=None, label=''):
202
238
  map, workdir = self.mapincheck(mapin, workdir)
va/version.py CHANGED
@@ -18,5 +18,5 @@ under the License.
18
18
 
19
19
  """
20
20
 
21
- __version__ = '0.0.1.dev135'
21
+ __version__ = '0.0.1.dev136'
22
22
  __em_statistics_version__ = '202505.v01'