risk-network 0.0.9b16__py3-none-any.whl → 0.0.9b18__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: Regional Inference of Significant Kinships
7
7
 
8
8
  from risk.risk import RISK
9
9
 
10
- __version__ = "0.0.9-beta.16"
10
+ __version__ = "0.0.9-beta.18"
@@ -242,7 +242,7 @@ class Contour:
242
242
  logger.error("Contour levels must be strictly increasing. Skipping contour plot.")
243
243
  return None
244
244
 
245
- # Set the contour color and linestyle
245
+ # Set the contour color, fill, and linestyle
246
246
  contour_colors = [color for _ in range(levels - 1)]
247
247
  # Plot the filled contours using fill_alpha for transparency
248
248
  if fill_alpha and fill_alpha > 0:
@@ -258,33 +258,19 @@ class Contour:
258
258
  alpha=fill_alpha,
259
259
  )
260
260
 
261
- # Plot the contour lines with the specified RGBA alpha for transparency
262
- c = ax.contour(
261
+ # Plot the base contour line with the specified RGBA alpha for transparency
262
+ base_contour_color = [color]
263
+ base_contour_level = [contour_levels[0]]
264
+ ax.contour(
263
265
  x,
264
266
  y,
265
267
  z,
266
- levels=contour_levels,
267
- colors=contour_colors,
268
+ levels=base_contour_level,
269
+ colors=base_contour_color,
268
270
  linestyles=linestyle,
269
271
  linewidths=linewidth,
270
272
  )
271
273
 
272
- # Set linewidth for the contour lines to 0 for levels other than the base level
273
- c.set_linewidth(0)
274
- try:
275
- # Try setting linewidth directly on the QuadContourSet
276
- c.set_linewidth(0)
277
- except AttributeError:
278
- # Fallback: Iterate over collections if the direct method fails
279
- if hasattr(c, "collections"):
280
- for i, collection in enumerate(c.collections):
281
- collection.set_linewidth(0)
282
- else:
283
- # Raise an error if 'collections' is also not available
284
- raise AttributeError(
285
- "'QuadContourSet' object has neither 'set_linewidth' nor 'collections'"
286
- )
287
-
288
274
  def get_annotated_contour_colors(
289
275
  self,
290
276
  cmap: str = "gist_rainbow",
@@ -564,39 +564,39 @@ class Labels:
564
564
 
565
565
  Returns:
566
566
  bool: True if the domain is valid and added to the filtered dictionaries, False otherwise.
567
-
568
- Note:
569
- The `filtered_domain_centroids`, `filtered_domain_terms`, and `valid_indices` are modified in-place.
570
567
  """
571
- # Process the domain terms
572
- domain_terms = self._process_terms(
573
- domain=domain,
574
- ids_to_labels=ids_to_labels,
575
- words_to_omit=words_to_omit,
576
- max_label_lines=max_label_lines,
577
- min_chars_per_line=min_chars_per_line,
578
- max_chars_per_line=max_chars_per_line,
579
- )
580
- # If domain_terms is empty, skip further processing
581
- if not domain_terms:
582
- return False
583
-
584
- # Split the terms by TERM_DELIMITER and count the number of lines
585
- num_domain_lines = len(domain_terms.split(TERM_DELIMITER))
586
- # Check if the number of lines is greater than or equal to the minimum
587
- if num_domain_lines >= min_label_lines:
588
- filtered_domain_centroids[domain] = domain_centroid
589
- filtered_domain_terms[domain] = domain_terms
590
- # Add the index of the domain to the valid indices list
591
- valid_indices.append(list(domain_id_to_centroid_map.keys()).index(domain))
592
- return True
593
-
594
- return False
568
+ if ids_to_labels and domain in ids_to_labels:
569
+ # Directly use custom labels without filtering
570
+ domain_terms = ids_to_labels[domain]
571
+ else:
572
+ # Process the domain terms automatically
573
+ domain_terms = self._process_terms(
574
+ domain=domain,
575
+ words_to_omit=words_to_omit,
576
+ max_label_lines=max_label_lines,
577
+ min_chars_per_line=min_chars_per_line,
578
+ max_chars_per_line=max_chars_per_line,
579
+ )
580
+ # If no valid terms are generated, skip further processing
581
+ if not domain_terms:
582
+ return False
583
+
584
+ # Split the terms by TERM_DELIMITER and count the number of lines
585
+ num_domain_lines = len(domain_terms.split(TERM_DELIMITER))
586
+ # Check if the number of lines meets the minimum requirement
587
+ if num_domain_lines < min_label_lines:
588
+ return False
589
+
590
+ # Store the valid terms and centroids
591
+ filtered_domain_centroids[domain] = domain_centroid
592
+ filtered_domain_terms[domain] = domain_terms
593
+ valid_indices.append(list(domain_id_to_centroid_map.keys()).index(domain))
594
+
595
+ return True
595
596
 
596
597
  def _process_terms(
597
598
  self,
598
599
  domain: str,
599
- ids_to_labels: Union[Dict[int, str], None],
600
600
  words_to_omit: Union[List[str], None],
601
601
  max_label_lines: int,
602
602
  min_chars_per_line: int,
@@ -606,7 +606,6 @@ class Labels:
606
606
 
607
607
  Args:
608
608
  domain (str): The domain being processed.
609
- ids_to_labels (Dict[int, str], None): Dictionary mapping domain IDs to custom labels.
610
609
  words_to_omit (List[str], None): List of words to omit from the labels.
611
610
  max_label_lines (int): Maximum number of lines in a label.
612
611
  min_chars_per_line (int): Minimum number of characters in a line to display.
@@ -615,13 +614,8 @@ class Labels:
615
614
  Returns:
616
615
  str: Processed terms separated by TERM_DELIMITER, with words combined if necessary to fit within constraints.
617
616
  """
618
- # Return custom labels if domain is in ids_to_labels
619
- if ids_to_labels and domain in ids_to_labels:
620
- return ids_to_labels[domain]
621
-
622
- else:
623
- terms = self.graph.domain_id_to_domain_terms_map[domain].split(" ")
624
-
617
+ # Set custom labels from significant terms
618
+ terms = self.graph.domain_id_to_domain_terms_map[domain].split(" ")
625
619
  # Apply words_to_omit and word length constraints
626
620
  if words_to_omit:
627
621
  terms = [
@@ -192,7 +192,9 @@ def _permutation_process_subset(
192
192
  local_counts_depletion = np.zeros(observed_neighborhood_scores.shape)
193
193
  local_counts_enrichment = np.zeros(observed_neighborhood_scores.shape)
194
194
 
195
- # NOTE: Limit the number of threads used by NumPy's BLAS implementation to 1 when more than one worker is used.
195
+ # Limit the number of threads used by NumPy's BLAS implementation to 1 when more than one worker is used
196
+ # NOTE: This does not work for Mac M chips due to a bug in the threadpoolctl package
197
+ # This is currently a known issue and is being addressed by the maintainers [https://github.com/joblib/threadpoolctl/issues/135]
196
198
  limits = None if max_workers == 1 else 1
197
199
  with threadpool_limits(limits=limits, user_api="blas"):
198
200
  # Initialize a local counter for batched progress updates
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: risk-network
3
- Version: 0.0.9b16
3
+ Version: 0.0.9b18
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=Y97538nwTi67cMHhP4b1tYJYhXdZHwHd4V63ET61HzA,127
1
+ risk/__init__.py,sha256=9v2jfoqP2gtVfXHiTuxLNyDIkjAfdwBx1dv421Qem_w,127
2
2
  risk/constants.py,sha256=XInRaH78Slnw_sWgAsBFbUHkyA0h0jL0DKGuQNbOvjM,550
3
3
  risk/risk.py,sha256=nodTixy31O3VK7ld-g74Fb9YEiyvKs_Vbor2lE2ADJ8,23632
4
4
  risk/annotations/__init__.py,sha256=kXgadEXaCh0z8OyhOhTj7c3qXGmWgOhaSZ4gSzSb59U,147
@@ -19,8 +19,8 @@ risk/network/graph/network.py,sha256=JzYbrgJLiNWFyPIR6_qNSjMtmXmfzRv2FwWSdyg8HjY
19
19
  risk/network/graph/summary.py,sha256=7w5gNYNspv02SscDAfHxdx-D1CWKmelSonyBnB9hbrE,9737
20
20
  risk/network/plot/__init__.py,sha256=MfmaXJgAZJgXZ2wrhK8pXwzETlcMaLChhWXKAozniAo,98
21
21
  risk/network/plot/canvas.py,sha256=W8dFv4XYTzCWXBchgsc0esOQRn4usM4LkwNGPSDMobE,13357
22
- risk/network/plot/contour.py,sha256=1Didhg9Z5seqdEITxWo7Av-Jg_TAuIHv_rPTMQZpkqo,16123
23
- risk/network/plot/labels.py,sha256=aU_ClDGVPHyQ3H5E_ygx8hsMhrpJB0i9Cn65PlLmw7s,45679
22
+ risk/network/plot/contour.py,sha256=zM2oRbiGbKHi9fWL7QNcwnTRkxCuQYEwH2mm6TaN_hw,15499
23
+ risk/network/plot/labels.py,sha256=fqBxQ1FoWI-la_7fEWAXWf0eaMWB01AeSasHYccf0gA,45452
24
24
  risk/network/plot/network.py,sha256=0j7pAZgt9PBfFCnOz4QwXnYWTlnLjTrtMm-50I_1G8o,14028
25
25
  risk/network/plot/plotter.py,sha256=eS1vHqvOA2O001Rq7WiDcgqcehJ3fg4OPfvkezH4erw,5771
26
26
  risk/network/plot/utils/colors.py,sha256=9zuU2O-Nkpljb1yVGUR_IjqD1y-wH6Bf6Vm1MMVB0Lo,18718
@@ -30,10 +30,10 @@ risk/stats/hypergeom.py,sha256=oc39f02ViB1vQ-uaDrxG_tzAT6dxQBRjc88EK2EGn78,2282
30
30
  risk/stats/poisson.py,sha256=polLgwS08MTCNzupYdmMUoEUYrJOjAbcYtYwjlfeE5Y,1803
31
31
  risk/stats/stats.py,sha256=z8NrhiVj4BzJ250bVLfytpmfC7RzYu7mBuIZD_l0aCA,7222
32
32
  risk/stats/permutation/__init__.py,sha256=neJp7FENC-zg_CGOXqv-iIvz1r5XUKI9Ruxhmq7kDOI,105
33
- risk/stats/permutation/permutation.py,sha256=meBNSrbRa9P8WJ54n485l0H7VQJlMSfHqdN4aCKYCtQ,10105
33
+ risk/stats/permutation/permutation.py,sha256=jfo7J7bjXTHH-k6_WuZ_5eB31JVynlI6SYMC_7icYyM,10320
34
34
  risk/stats/permutation/test_functions.py,sha256=lftOude6hee0pyR80HlBD32522JkDoN5hrKQ9VEbuoY,2345
35
- risk_network-0.0.9b16.dist-info/LICENSE,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
36
- risk_network-0.0.9b16.dist-info/METADATA,sha256=pGpChS9mrqjv7i21ReWmVdOK0VyuLoB9HmhDrRupWSY,47627
37
- risk_network-0.0.9b16.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
38
- risk_network-0.0.9b16.dist-info/top_level.txt,sha256=NX7C2PFKTvC1JhVKv14DFlFAIFnKc6Lpsu1ZfxvQwVw,5
39
- risk_network-0.0.9b16.dist-info/RECORD,,
35
+ risk_network-0.0.9b18.dist-info/LICENSE,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
36
+ risk_network-0.0.9b18.dist-info/METADATA,sha256=p5vaR2ISJ8R2K6HG6IBH_MzKf2MVyFrnV3Q7o55TfnQ,47627
37
+ risk_network-0.0.9b18.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
38
+ risk_network-0.0.9b18.dist-info/top_level.txt,sha256=NX7C2PFKTvC1JhVKv14DFlFAIFnKc6Lpsu1ZfxvQwVw,5
39
+ risk_network-0.0.9b18.dist-info/RECORD,,