risk-network 0.0.7b2__py3-none-any.whl → 0.0.7b3__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.7-beta.2"
10
+ __version__ = "0.0.7-beta.3"
risk/network/graph.py CHANGED
@@ -306,6 +306,7 @@ def _get_colors(
306
306
  Returns:
307
307
  List[Tuple]: List of RGBA colors.
308
308
  """
309
+ # Set random seed for reproducibility
309
310
  random.seed(random_seed)
310
311
  # Determine the number of colors to generate based on the number of domains
311
312
  num_colors_to_generate = len(domain_id_to_node_ids_map)
@@ -321,15 +322,21 @@ def _get_colors(
321
322
  # Step 2: Calculate pairwise distances between centroids
322
323
  centroid_array = np.array(centroids)
323
324
  dist_matrix = np.linalg.norm(centroid_array[:, None] - centroid_array, axis=-1)
325
+
324
326
  # Step 3: Generate positions in the colormap, with a focus on centroids that are close
325
327
  remaining_indices = set(range(num_colors_to_generate))
326
328
  # Assign distant colors to close centroids
327
329
  color_positions = _assign_distant_colors(
328
330
  remaining_indices, dist_matrix, colormap, num_colors_to_generate
329
331
  )
330
- # Step 4: Add some random jitter to color positions to avoid overly systematic results
331
- jitter = np.random.uniform(-0.05, 0.05, size=num_colors_to_generate)
332
- color_positions = np.clip(color_positions + jitter, 0, 1)
332
+
333
+ # Step 4: Randomly shuffle color positions to generate a new color palette
334
+ # while maintaining the dissimilarity between neighboring colors. This shuffling
335
+ # preserves the relative distances between centroids, ensuring that close centroids
336
+ # remain visually distinct while introducing randomness into the overall color arrangement.
337
+ random.shuffle(color_positions)
338
+ # Ensure that all positions remain between 0 and 1
339
+ color_positions = np.clip(color_positions, 0, 1)
333
340
 
334
341
  # Step 5: Generate colors based on positions
335
342
  return [colormap(pos) for pos in color_positions]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: risk-network
3
- Version: 0.0.7b2
3
+ Version: 0.0.7b3
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=zz24rmHCv_OZ2BTaD6vukHUL67ZFgDcpxy7mi6Hczrw,112
1
+ risk/__init__.py,sha256=Yoz9l74qVwPoFeWtUKqy_dgQZlDTZtaNIvtmzNx5G78,112
2
2
  risk/constants.py,sha256=XInRaH78Slnw_sWgAsBFbUHkyA0h0jL0DKGuQNbOvjM,550
3
3
  risk/risk.py,sha256=jhfOv60iZdOssCF35tAjJ_br9w8aIqPFT2owVTehgtA,20648
4
4
  risk/annotations/__init__.py,sha256=vUpVvMRE5if01Ic8QY6M2Ae3EFGJHdugEe9PdEkAW4Y,138
@@ -13,7 +13,7 @@ risk/neighborhoods/domains.py,sha256=bxJUxqFTynzX0mf3E8-AA4_Rfccje1reeVVhfzb1-pE
13
13
  risk/neighborhoods/neighborhoods.py,sha256=cEk4gDvIkBky5POZhtHnO78iV-NXu4BeV-e5XdhYOkM,17508
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=TMri3aQsWjnq8be4QCwwSke3y4ja_x-ptl1q40rbDbg,16667
16
+ risk/network/graph.py,sha256=_ZCyT2b9RtKAYzwul-Kp9__uQwTcagECf-mPMiAmP8U,16977
17
17
  risk/network/io.py,sha256=gG50kOknO-D3HkW1HsbHMkTMvjUtn3l4W4Jwd-rXNr8,21202
18
18
  risk/network/plot.py,sha256=F6KPjmBYWrThKZScHs9SuzoKQiytBvzrmGhGberHjwo,62063
19
19
  risk/stats/__init__.py,sha256=e-BE_Dr_jgiK6hKM-T-tlG4yvHnId8e5qjnM0pdwNVc,230
@@ -23,8 +23,8 @@ risk/stats/stats.py,sha256=kvShov-94W6ffgDUTb522vB9hDJQSyTsYif_UIaFfSM,7059
23
23
  risk/stats/permutation/__init__.py,sha256=neJp7FENC-zg_CGOXqv-iIvz1r5XUKI9Ruxhmq7kDOI,105
24
24
  risk/stats/permutation/permutation.py,sha256=qLWdwxEY6nmkYPxpM8HLDcd2mbqYv9Qr7CKtJvhLqIM,9220
25
25
  risk/stats/permutation/test_functions.py,sha256=HuDIM-V1jkkfE1rlaIqrWWBSKZt3dQ1f-YEDjWpnLSE,2343
26
- risk_network-0.0.7b2.dist-info/LICENSE,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
27
- risk_network-0.0.7b2.dist-info/METADATA,sha256=u4otPSVK9-85VhsLICNfP_kz4aXgnnJ_xo5UYfSv3fQ,43142
28
- risk_network-0.0.7b2.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
29
- risk_network-0.0.7b2.dist-info/top_level.txt,sha256=NX7C2PFKTvC1JhVKv14DFlFAIFnKc6Lpsu1ZfxvQwVw,5
30
- risk_network-0.0.7b2.dist-info/RECORD,,
26
+ risk_network-0.0.7b3.dist-info/LICENSE,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
27
+ risk_network-0.0.7b3.dist-info/METADATA,sha256=6D_1SuZdpPYaUQLLzctNrVLC_gdzsTrx7V1leqBvcio,43142
28
+ risk_network-0.0.7b3.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
29
+ risk_network-0.0.7b3.dist-info/top_level.txt,sha256=NX7C2PFKTvC1JhVKv14DFlFAIFnKc6Lpsu1ZfxvQwVw,5
30
+ risk_network-0.0.7b3.dist-info/RECORD,,