risk-network 0.0.9b17__tar.gz → 0.0.9b19__tar.gz

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.
Files changed (46) hide show
  1. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/PKG-INFO +1 -1
  2. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk/__init__.py +1 -1
  3. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk/annotations/annotations.py +1 -1
  4. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk/network/plot/labels.py +30 -36
  5. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk_network.egg-info/PKG-INFO +1 -1
  6. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/LICENSE +0 -0
  7. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/MANIFEST.in +0 -0
  8. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/README.md +0 -0
  9. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/pyproject.toml +0 -0
  10. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk/annotations/__init__.py +0 -0
  11. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk/annotations/io.py +0 -0
  12. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk/constants.py +0 -0
  13. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk/log/__init__.py +0 -0
  14. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk/log/console.py +0 -0
  15. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk/log/parameters.py +0 -0
  16. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk/neighborhoods/__init__.py +0 -0
  17. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk/neighborhoods/community.py +0 -0
  18. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk/neighborhoods/domains.py +0 -0
  19. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk/neighborhoods/neighborhoods.py +0 -0
  20. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk/network/__init__.py +0 -0
  21. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk/network/geometry.py +0 -0
  22. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk/network/graph/__init__.py +0 -0
  23. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk/network/graph/network.py +0 -0
  24. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk/network/graph/summary.py +0 -0
  25. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk/network/io.py +0 -0
  26. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk/network/plot/__init__.py +0 -0
  27. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk/network/plot/canvas.py +0 -0
  28. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk/network/plot/contour.py +0 -0
  29. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk/network/plot/network.py +0 -0
  30. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk/network/plot/plotter.py +0 -0
  31. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk/network/plot/utils/colors.py +0 -0
  32. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk/network/plot/utils/layout.py +0 -0
  33. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk/risk.py +0 -0
  34. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk/stats/__init__.py +0 -0
  35. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk/stats/hypergeom.py +0 -0
  36. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk/stats/permutation/__init__.py +0 -0
  37. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk/stats/permutation/permutation.py +0 -0
  38. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk/stats/permutation/test_functions.py +0 -0
  39. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk/stats/poisson.py +0 -0
  40. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk/stats/stats.py +0 -0
  41. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk_network.egg-info/SOURCES.txt +0 -0
  42. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk_network.egg-info/dependency_links.txt +0 -0
  43. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk_network.egg-info/requires.txt +0 -0
  44. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/risk_network.egg-info/top_level.txt +0 -0
  45. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/setup.cfg +0 -0
  46. {risk_network-0.0.9b17 → risk_network-0.0.9b19}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: risk-network
3
- Version: 0.0.9b17
3
+ Version: 0.0.9b19
4
4
  Summary: A Python package for biological network analysis
5
5
  Author: Ira Horecka
6
6
  Author-email: Ira Horecka <ira89@icloud.com>
@@ -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.17"
10
+ __version__ = "0.0.9-beta.19"
@@ -67,7 +67,7 @@ def load_annotations(
67
67
  index="node", columns="annotations", values="is_member", fill_value=0, dropna=False
68
68
  )
69
69
  # Reindex the annotations matrix based on the node labels from the network
70
- node_label_order = list(nx.get_node_attributes(network, "label").values())
70
+ node_label_order = (attr["label"] for _, attr in network.nodes(data=True) if "label" in attr)
71
71
  annotations_pivot = annotations_pivot.reindex(index=node_label_order)
72
72
  # Raise an error if no valid annotations are found for the nodes in the network
73
73
  if annotations_pivot.notnull().sum().sum() == 0:
@@ -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 = [
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: risk-network
3
- Version: 0.0.9b17
3
+ Version: 0.0.9b19
4
4
  Summary: A Python package for biological network analysis
5
5
  Author: Ira Horecka
6
6
  Author-email: Ira Horecka <ira89@icloud.com>
File without changes