risk-network 0.0.8b13__py3-none-any.whl → 0.0.8b14__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.
risk/__init__.py CHANGED
@@ -7,4 +7,4 @@ RISK: RISK Infers Spatial Kinships
7
7
 
8
8
  from risk.risk import RISK
9
9
 
10
- __version__ = "0.0.8-beta.13"
10
+ __version__ = "0.0.8-beta.14"
risk/network/graph.py CHANGED
@@ -203,7 +203,8 @@ def _transform_colors(
203
203
  max_scale: float = 1.0,
204
204
  scale_factor: float = 1.0,
205
205
  ) -> np.ndarray:
206
- """Transform colors using power scaling to emphasize high enrichment sums more.
206
+ """Transform colors using power scaling to emphasize high enrichment sums more. Black colors are replaced with
207
+ very dark grey to avoid issues with color scaling (rgb(0.1, 0.1, 0.1)).
207
208
 
208
209
  Args:
209
210
  colors (np.ndarray): An array of RGBA colors.
@@ -234,22 +234,18 @@ class Network:
234
234
  network_colors[:, 3] = alpha # Apply the alpha value to the enriched nodes' A channel
235
235
  # Convert the non-enriched color to RGBA using the to_rgba helper function
236
236
  nonenriched_color = to_rgba(color=nonenriched_color, alpha=nonenriched_alpha)
237
-
238
- # Compute the sum of RGB values for each color (ignoring alpha)
239
- color_sums = network_colors[:, :3].sum(axis=1)
240
- # Find the index of the darkest color (the lowest sum of RGB values)
241
- darkest_color_index = np.argmin(color_sums)
242
- # Extract the darkest color's RGB values
243
- darkest_color = network_colors[darkest_color_index, :3]
244
- # Adjust node colors: replace the darkest color with the non-enriched color
237
+ # Adjust node colors: replace any nodes where all three RGB values are equal and less than 0.1
238
+ # 0.1 is a predefined threshold for the minimum color intensity
245
239
  adjusted_network_colors = np.where(
246
- np.all(
247
- network_colors[:, :3] == darkest_color, axis=1, keepdims=True
248
- ), # Check if the color matches the darkest color
249
- np.array(nonenriched_color), # Apply the non-enriched color with alpha
250
- network_colors, # Keep the original colors for enriched nodes
240
+ (
241
+ np.all(network_colors[:, :3] < 0.1, axis=1)
242
+ & np.all(network_colors[:, :3] == network_colors[:, 0:1], axis=1)
243
+ )[:, None],
244
+ np.tile(
245
+ np.array(nonenriched_color), (network_colors.shape[0], 1)
246
+ ), # Replace with the full RGBA non-enriched color
247
+ network_colors, # Keep the original colors where no match is found
251
248
  )
252
-
253
249
  return adjusted_network_colors
254
250
 
255
251
  def get_annotated_node_sizes(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: risk-network
3
- Version: 0.0.8b13
3
+ Version: 0.0.8b14
4
4
  Summary: A Python package for biological network analysis
5
5
  Author: Ira Horecka
6
6
  Author-email: Ira Horecka <ira89@icloud.com>
@@ -1,4 +1,4 @@
1
- risk/__init__.py,sha256=NFLV6xDRDZaq7QKj28pf0H3eQA2SphZ1FXgsKXfGbkk,113
1
+ risk/__init__.py,sha256=m9OKov65SuifezPxufH3hRsggm2xXDSzlRDR6p5FURo,113
2
2
  risk/constants.py,sha256=XInRaH78Slnw_sWgAsBFbUHkyA0h0jL0DKGuQNbOvjM,550
3
3
  risk/risk.py,sha256=slJXca_a726_D7oXwe765HaKTv3ZrOvhttyrWdCGPkA,21231
4
4
  risk/annotations/__init__.py,sha256=vUpVvMRE5if01Ic8QY6M2Ae3EFGJHdugEe9PdEkAW4Y,138
@@ -13,13 +13,13 @@ risk/neighborhoods/domains.py,sha256=D5MUIghbwyKKCAE8PN_HXvsO9NxLTGejQmyEqetD1Bk
13
13
  risk/neighborhoods/neighborhoods.py,sha256=M-wL4xB_BUTlSZg90swygO5NdrZ6hFUFqs6jsiZaqHk,18260
14
14
  risk/network/__init__.py,sha256=iEPeJdZfqp0toxtbElryB8jbz9_t_k4QQ3iDvKE8C_0,126
15
15
  risk/network/geometry.py,sha256=H1yGVVqgbfpzBzJwEheDLfvGLSA284jGQQTn612L4Vc,6759
16
- risk/network/graph.py,sha256=yuWqXG4p3Pmad_7dHcPweLgOd8t4LoeP9uQQ-ZZEdAY,16866
16
+ risk/network/graph.py,sha256=WxWh1BZvH9E_kgDb5HrwcQ-30hM8aNHPkBm2l3vzkAw,16973
17
17
  risk/network/io.py,sha256=u0PPcKjp6Xze--7eDOlvalYkjQ9S2sjiC-ac2476PUI,22942
18
18
  risk/network/plot/__init__.py,sha256=MfmaXJgAZJgXZ2wrhK8pXwzETlcMaLChhWXKAozniAo,98
19
19
  risk/network/plot/canvas.py,sha256=LXHndwanWIBShChoPag8zgGHF2P9MFWYdEnLKc2eeb0,10295
20
20
  risk/network/plot/contour.py,sha256=YPG8Uz0VlJ4skLdGaTH_FmQN6A_ArK8XSTNo1LzkSws,14276
21
21
  risk/network/plot/labels.py,sha256=PV21hig6gQJZRgfUAP9-zpn4wEmQFEjS2_X63SgzWMs,42064
22
- risk/network/plot/network.py,sha256=iikZpPKFxeIJgAlp0Wd6kXVzVp341wHpvQ2vLFdQELw,13000
22
+ risk/network/plot/network.py,sha256=t5eMh7mBJOh_Wa19aK8g_1zpL7maiXZAYw-TEFHxAVM,12819
23
23
  risk/network/plot/plotter.py,sha256=rQV4Db6Ud86FJm11uaBvgSuzpmGsrZxnsRnUKjg6w84,5572
24
24
  risk/network/plot/utils.py,sha256=jZgI8EysSjviQmdYAceZk2MwJXcdeFAkYp-odZNqV0k,6316
25
25
  risk/stats/__init__.py,sha256=WcgoETQ-hS0LQqKRsAMIPtP15xZ-4eul6VUBuUx4Wzc,220
@@ -29,8 +29,8 @@ risk/stats/stats.py,sha256=kvShov-94W6ffgDUTb522vB9hDJQSyTsYif_UIaFfSM,7059
29
29
  risk/stats/permutation/__init__.py,sha256=neJp7FENC-zg_CGOXqv-iIvz1r5XUKI9Ruxhmq7kDOI,105
30
30
  risk/stats/permutation/permutation.py,sha256=D84Rcpt6iTQniK0PfQGcw9bLcHbMt9p-ARcurUnIXZQ,10095
31
31
  risk/stats/permutation/test_functions.py,sha256=lftOude6hee0pyR80HlBD32522JkDoN5hrKQ9VEbuoY,2345
32
- risk_network-0.0.8b13.dist-info/LICENSE,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
33
- risk_network-0.0.8b13.dist-info/METADATA,sha256=_Fn1n_WLyoZ8NTHq_bfr3tnx9_16CXcmvyWWrclNNFY,47498
34
- risk_network-0.0.8b13.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
35
- risk_network-0.0.8b13.dist-info/top_level.txt,sha256=NX7C2PFKTvC1JhVKv14DFlFAIFnKc6Lpsu1ZfxvQwVw,5
36
- risk_network-0.0.8b13.dist-info/RECORD,,
32
+ risk_network-0.0.8b14.dist-info/LICENSE,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
33
+ risk_network-0.0.8b14.dist-info/METADATA,sha256=QUStGHs-tu2cPCAtumH931wZx1ll8PUaewDgPROd9hM,47498
34
+ risk_network-0.0.8b14.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
35
+ risk_network-0.0.8b14.dist-info/top_level.txt,sha256=NX7C2PFKTvC1JhVKv14DFlFAIFnKc6Lpsu1ZfxvQwVw,5
36
+ risk_network-0.0.8b14.dist-info/RECORD,,