napistu 0.4.0__tar.gz → 0.4.2__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 (150) hide show
  1. {napistu-0.4.0/src/napistu.egg-info → napistu-0.4.2}/PKG-INFO +6 -1
  2. {napistu-0.4.0 → napistu-0.4.2}/README.md +5 -0
  3. {napistu-0.4.0 → napistu-0.4.2}/setup.cfg +1 -1
  4. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/constants.py +2 -0
  5. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/gcs/constants.py +15 -15
  6. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/network/constants.py +23 -1
  7. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/network/ig_utils.py +161 -1
  8. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/network/net_create.py +3 -3
  9. napistu-0.4.2/src/napistu/network/net_propagation.py +696 -0
  10. napistu-0.4.2/src/napistu/ontologies/id_tables.py +282 -0
  11. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/sbml_dfs_core.py +53 -63
  12. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/sbml_dfs_utils.py +82 -18
  13. napistu-0.4.2/src/napistu/statistics/__init__.py +10 -0
  14. napistu-0.4.2/src/napistu/statistics/quantiles.py +82 -0
  15. {napistu-0.4.0 → napistu-0.4.2/src/napistu.egg-info}/PKG-INFO +6 -1
  16. {napistu-0.4.0 → napistu-0.4.2}/src/napistu.egg-info/SOURCES.txt +5 -0
  17. napistu-0.4.2/src/tests/test_network_ig_utils.py +192 -0
  18. napistu-0.4.2/src/tests/test_network_net_propagation.py +380 -0
  19. napistu-0.4.2/src/tests/test_ontologies_id_tables.py +198 -0
  20. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_sbml_dfs_core.py +30 -19
  21. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_sbml_dfs_utils.py +70 -0
  22. napistu-0.4.2/src/tests/test_statistics_quantiles.py +133 -0
  23. napistu-0.4.0/src/napistu/network/net_propagation.py +0 -146
  24. napistu-0.4.0/src/tests/test_network_ig_utils.py +0 -59
  25. napistu-0.4.0/src/tests/test_network_net_propagation.py +0 -89
  26. {napistu-0.4.0 → napistu-0.4.2}/LICENSE +0 -0
  27. {napistu-0.4.0 → napistu-0.4.2}/pyproject.toml +0 -0
  28. {napistu-0.4.0 → napistu-0.4.2}/setup.py +0 -0
  29. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/__init__.py +0 -0
  30. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/__main__.py +0 -0
  31. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/consensus.py +0 -0
  32. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/context/__init__.py +0 -0
  33. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/context/discretize.py +0 -0
  34. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/context/filtering.py +0 -0
  35. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/gcs/__init__.py +0 -0
  36. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/gcs/downloads.py +0 -0
  37. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/gcs/utils.py +0 -0
  38. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/identifiers.py +0 -0
  39. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/indices.py +0 -0
  40. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/ingestion/__init__.py +0 -0
  41. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/ingestion/bigg.py +0 -0
  42. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/ingestion/constants.py +0 -0
  43. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/ingestion/gtex.py +0 -0
  44. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/ingestion/hpa.py +0 -0
  45. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/ingestion/identifiers_etl.py +0 -0
  46. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/ingestion/napistu_edgelist.py +0 -0
  47. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/ingestion/obo.py +0 -0
  48. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/ingestion/psi_mi.py +0 -0
  49. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/ingestion/reactome.py +0 -0
  50. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/ingestion/sbml.py +0 -0
  51. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/ingestion/string.py +0 -0
  52. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/ingestion/trrust.py +0 -0
  53. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/ingestion/yeast.py +0 -0
  54. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/matching/__init__.py +0 -0
  55. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/matching/constants.py +0 -0
  56. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/matching/interactions.py +0 -0
  57. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/matching/mount.py +0 -0
  58. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/matching/species.py +0 -0
  59. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/mcp/__init__.py +0 -0
  60. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/mcp/__main__.py +0 -0
  61. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/mcp/client.py +0 -0
  62. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/mcp/codebase.py +0 -0
  63. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/mcp/codebase_utils.py +0 -0
  64. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/mcp/component_base.py +0 -0
  65. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/mcp/config.py +0 -0
  66. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/mcp/constants.py +0 -0
  67. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/mcp/documentation.py +0 -0
  68. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/mcp/documentation_utils.py +0 -0
  69. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/mcp/execution.py +0 -0
  70. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/mcp/health.py +0 -0
  71. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/mcp/profiles.py +0 -0
  72. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/mcp/server.py +0 -0
  73. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/mcp/tutorials.py +0 -0
  74. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/mcp/tutorials_utils.py +0 -0
  75. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/mcp/utils.py +0 -0
  76. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/modify/__init__.py +0 -0
  77. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/modify/constants.py +0 -0
  78. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/modify/curation.py +0 -0
  79. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/modify/gaps.py +0 -0
  80. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/modify/pathwayannot.py +0 -0
  81. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/modify/uncompartmentalize.py +0 -0
  82. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/network/__init__.py +0 -0
  83. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/network/data_handling.py +0 -0
  84. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/network/neighborhoods.py +0 -0
  85. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/network/net_create_utils.py +0 -0
  86. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/network/ng_core.py +0 -0
  87. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/network/ng_utils.py +0 -0
  88. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/network/paths.py +0 -0
  89. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/network/precompute.py +0 -0
  90. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/ontologies/__init__.py +0 -0
  91. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/ontologies/constants.py +0 -0
  92. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/ontologies/dogma.py +0 -0
  93. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/ontologies/genodexito.py +0 -0
  94. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/ontologies/mygene.py +0 -0
  95. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/ontologies/renaming.py +0 -0
  96. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/rpy2/__init__.py +0 -0
  97. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/rpy2/callr.py +0 -0
  98. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/rpy2/constants.py +0 -0
  99. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/rpy2/rids.py +0 -0
  100. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/scverse/__init__.py +0 -0
  101. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/scverse/constants.py +0 -0
  102. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/scverse/loading.py +0 -0
  103. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/source.py +0 -0
  104. {napistu-0.4.0 → napistu-0.4.2}/src/napistu/utils.py +0 -0
  105. {napistu-0.4.0 → napistu-0.4.2}/src/napistu.egg-info/dependency_links.txt +0 -0
  106. {napistu-0.4.0 → napistu-0.4.2}/src/napistu.egg-info/entry_points.txt +0 -0
  107. {napistu-0.4.0 → napistu-0.4.2}/src/napistu.egg-info/requires.txt +0 -0
  108. {napistu-0.4.0 → napistu-0.4.2}/src/napistu.egg-info/top_level.txt +0 -0
  109. {napistu-0.4.0 → napistu-0.4.2}/src/tests/__init__.py +0 -0
  110. {napistu-0.4.0 → napistu-0.4.2}/src/tests/conftest.py +0 -0
  111. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_consensus.py +0 -0
  112. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_constants.py +0 -0
  113. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_context_discretize.py +0 -0
  114. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_context_filtering.py +0 -0
  115. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_curation.py +0 -0
  116. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_data/__init__.py +0 -0
  117. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_gaps.py +0 -0
  118. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_gcs.py +0 -0
  119. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_identifiers.py +0 -0
  120. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_indices.py +0 -0
  121. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_ingestion_napistu_edgelist.py +0 -0
  122. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_ingestion_obo.py +0 -0
  123. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_matching_interactions.py +0 -0
  124. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_matching_mount.py +0 -0
  125. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_matching_species.py +0 -0
  126. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_mcp_config.py +0 -0
  127. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_mcp_documentation_utils.py +0 -0
  128. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_mcp_server.py +0 -0
  129. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_network_data_handling.py +0 -0
  130. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_network_neighborhoods.py +0 -0
  131. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_network_net_create.py +0 -0
  132. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_network_net_create_utils.py +0 -0
  133. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_network_ng_core.py +0 -0
  134. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_network_ng_utils.py +0 -0
  135. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_network_paths.py +0 -0
  136. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_network_precompute.py +0 -0
  137. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_ontologies_genodexito.py +0 -0
  138. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_ontologies_mygene.py +0 -0
  139. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_ontologies_renaming.py +0 -0
  140. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_pathwayannot.py +0 -0
  141. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_rpy2_callr.py +0 -0
  142. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_rpy2_init.py +0 -0
  143. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_sbml.py +0 -0
  144. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_sbo.py +0 -0
  145. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_scverse_loading.py +0 -0
  146. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_set_coverage.py +0 -0
  147. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_source.py +0 -0
  148. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_uncompartmentalize.py +0 -0
  149. {napistu-0.4.0 → napistu-0.4.2}/src/tests/test_utils.py +0 -0
  150. {napistu-0.4.0 → napistu-0.4.2}/src/tests/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: napistu
3
- Version: 0.4.0
3
+ Version: 0.4.2
4
4
  Summary: Connecting high-dimensional data to curated pathways
5
5
  Home-page: https://github.com/napistu/napistu-py
6
6
  Author: Sean Hackett
@@ -61,7 +61,12 @@ Dynamic: license-file
61
61
 
62
62
  # Napistu Python Library
63
63
 
64
+ [![PyPI version](https://badge.fury.io/py/napistu.svg)](https://badge.fury.io/py/napistu)
64
65
  [![Documentation Status](https://readthedocs.org/projects/napistu/badge/?version=latest)](https://napistu.readthedocs.io/en/latest/?badge=latest)
66
+ [![CI](https://github.com/napistu/napistu-py/actions/workflows/ci.yml/badge.svg)](https://github.com/napistu/napistu-py/actions/workflows/ci.yml)
67
+ [![Release](https://github.com/napistu/napistu-py/actions/workflows/release.yml/badge.svg)](https://github.com/napistu/napistu-py/actions/workflows/release.yml)
68
+ [![Deploy to Cloud Run](https://github.com/napistu/napistu-py/actions/workflows/deploy.yml/badge.svg)](https://github.com/napistu/napistu-py/actions/workflows/deploy.yml)
69
+ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
65
70
 
66
71
  This Python package hosts the majority of the algorithmic code for the [Napistu project](https://github.com/napistu/napistu).
67
72
 
@@ -1,6 +1,11 @@
1
1
  # Napistu Python Library
2
2
 
3
+ [![PyPI version](https://badge.fury.io/py/napistu.svg)](https://badge.fury.io/py/napistu)
3
4
  [![Documentation Status](https://readthedocs.org/projects/napistu/badge/?version=latest)](https://napistu.readthedocs.io/en/latest/?badge=latest)
5
+ [![CI](https://github.com/napistu/napistu-py/actions/workflows/ci.yml/badge.svg)](https://github.com/napistu/napistu-py/actions/workflows/ci.yml)
6
+ [![Release](https://github.com/napistu/napistu-py/actions/workflows/release.yml/badge.svg)](https://github.com/napistu/napistu-py/actions/workflows/release.yml)
7
+ [![Deploy to Cloud Run](https://github.com/napistu/napistu-py/actions/workflows/deploy.yml/badge.svg)](https://github.com/napistu/napistu-py/actions/workflows/deploy.yml)
8
+ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
4
9
 
5
10
  This Python package hosts the majority of the algorithmic code for the [Napistu project](https://github.com/napistu/napistu).
6
11
 
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = napistu
3
- version = 0.4.0
3
+ version = 0.4.2
4
4
  description = Connecting high-dimensional data to curated pathways
5
5
  long_description = file: README.md
6
6
  long_description_content_type = text/markdown
@@ -402,12 +402,14 @@ ONTOLOGIES = SimpleNamespace(
402
402
  ENSEMBL_PROTEIN_VERSION="ensembl_protein_version",
403
403
  GENE_NAME="gene_name",
404
404
  GO="go",
405
+ KEGG="kegg",
405
406
  MIRBASE="mirbase",
406
407
  NCBI_ENTREZ_GENE="ncbi_entrez_gene",
407
408
  PHAROS="pharos",
408
409
  REACTOME="reactome",
409
410
  SYMBOL="symbol",
410
411
  UNIPROT="uniprot",
412
+ WIKIPATHWAYS="wikipathways",
411
413
  )
412
414
 
413
415
  ONTOLOGIES_LIST = list(ONTOLOGIES.__dict__.values())
@@ -5,17 +5,17 @@ from types import SimpleNamespace
5
5
 
6
6
  GCS_SUBASSET_NAMES = SimpleNamespace(
7
7
  SBML_DFS="sbml_dfs",
8
- IDENTIFIERS="identifiers",
9
- REGULATORY_GRAPH="regulatory_graph",
10
- REGULATORY_DISTANCES="regulatory_distances",
8
+ NAPISTU_GRAPH="napistu_graph",
9
+ SPECIES_IDENTIFIERS="species_identifiers",
10
+ PRECOMPUTED_DISTANCES="precomputed_distances",
11
11
  )
12
12
 
13
13
 
14
14
  GCS_FILETYPES = SimpleNamespace(
15
15
  SBML_DFS="sbml_dfs.pkl",
16
- IDENTIFIERS="identifiers.tsv",
17
- REGULATORY_GRAPH="regulatory_graph.pkl",
18
- REGULATORY_DISTANCES="regulatory_distances.json",
16
+ NAPISTU_GRAPH="napistu_graph.pkl",
17
+ SPECIES_IDENTIFIERS="species_identifiers.tsv",
18
+ PRECOMPUTED_DISTANCES="precomputed_distances.parquet",
19
19
  )
20
20
 
21
21
 
@@ -27,9 +27,9 @@ GCS_ASSETS = SimpleNamespace(
27
27
  "file": "test_pathway.tar.gz",
28
28
  "subassets": {
29
29
  GCS_SUBASSET_NAMES.SBML_DFS: GCS_FILETYPES.SBML_DFS,
30
- GCS_SUBASSET_NAMES.IDENTIFIERS: GCS_FILETYPES.IDENTIFIERS,
31
- GCS_SUBASSET_NAMES.REGULATORY_GRAPH: GCS_FILETYPES.REGULATORY_GRAPH,
32
- GCS_SUBASSET_NAMES.REGULATORY_DISTANCES: GCS_FILETYPES.REGULATORY_DISTANCES,
30
+ GCS_SUBASSET_NAMES.NAPISTU_GRAPH: GCS_FILETYPES.NAPISTU_GRAPH,
31
+ GCS_SUBASSET_NAMES.SPECIES_IDENTIFIERS: GCS_FILETYPES.SPECIES_IDENTIFIERS,
32
+ GCS_SUBASSET_NAMES.PRECOMPUTED_DISTANCES: GCS_FILETYPES.PRECOMPUTED_DISTANCES,
33
33
  },
34
34
  "public_url": "https://storage.googleapis.com/shackett-napistu-public/test_pathway.tar.gz",
35
35
  },
@@ -37,8 +37,8 @@ GCS_ASSETS = SimpleNamespace(
37
37
  "file": "human_consensus.tar.gz",
38
38
  "subassets": {
39
39
  GCS_SUBASSET_NAMES.SBML_DFS: GCS_FILETYPES.SBML_DFS,
40
- GCS_SUBASSET_NAMES.IDENTIFIERS: GCS_FILETYPES.IDENTIFIERS,
41
- GCS_SUBASSET_NAMES.REGULATORY_GRAPH: GCS_FILETYPES.REGULATORY_GRAPH,
40
+ GCS_SUBASSET_NAMES.NAPISTU_GRAPH: GCS_FILETYPES.NAPISTU_GRAPH,
41
+ GCS_SUBASSET_NAMES.SPECIES_IDENTIFIERS: GCS_FILETYPES.SPECIES_IDENTIFIERS,
42
42
  },
43
43
  "public_url": "https://storage.googleapis.com/shackett-napistu-public/human_consensus.tar.gz",
44
44
  },
@@ -46,11 +46,11 @@ GCS_ASSETS = SimpleNamespace(
46
46
  "file": "human_consensus_w_distances.tar.gz",
47
47
  "subassets": {
48
48
  GCS_SUBASSET_NAMES.SBML_DFS: GCS_FILETYPES.SBML_DFS,
49
- GCS_SUBASSET_NAMES.IDENTIFIERS: GCS_FILETYPES.IDENTIFIERS,
50
- GCS_SUBASSET_NAMES.REGULATORY_GRAPH: GCS_FILETYPES.REGULATORY_GRAPH,
51
- GCS_SUBASSET_NAMES.REGULATORY_DISTANCES: GCS_FILETYPES.REGULATORY_DISTANCES,
49
+ GCS_SUBASSET_NAMES.NAPISTU_GRAPH: GCS_FILETYPES.NAPISTU_GRAPH,
50
+ GCS_SUBASSET_NAMES.SPECIES_IDENTIFIERS: GCS_FILETYPES.SPECIES_IDENTIFIERS,
51
+ GCS_SUBASSET_NAMES.PRECOMPUTED_DISTANCES: GCS_FILETYPES.PRECOMPUTED_DISTANCES,
52
52
  },
53
- "public_url": "https://storage.googleapis.com/calico-cpr-public/human_consensus_w_distances.tar.gz",
53
+ "public_url": "https://storage.googleapis.com/shackett-napistu-public/human_consensus_w_distances.tar.gz",
54
54
  },
55
55
  "reactome_members": {
56
56
  "file": "external_pathways/external_pathways_reactome_neo4j_members.csv",
@@ -4,6 +4,7 @@ from __future__ import annotations
4
4
 
5
5
  from types import SimpleNamespace
6
6
 
7
+
7
8
  from napistu.constants import SBML_DFS
8
9
  from napistu.constants import SBOTERM_NAMES
9
10
 
@@ -13,7 +14,7 @@ NAPISTU_GRAPH_DIRECTEDNESS = SimpleNamespace(
13
14
  DIRECTED="directed", UNDIRECTED="undirected"
14
15
  )
15
16
 
16
- NAPISTU_GRAPH_NODES = SimpleNamespace(NAME="name")
17
+ NAPISTU_GRAPH_VERTICES = SimpleNamespace(NAME="name")
17
18
 
18
19
  NAPISTU_GRAPH_EDGES = SimpleNamespace(
19
20
  DIRECTED="directed",
@@ -198,3 +199,24 @@ SCORE_CALIBRATION_POINTS_DICT = {
198
199
  }
199
200
 
200
201
  SOURCE_VARS_DICT = {"string_wt": 10}
202
+
203
+ # network propagation
204
+ NET_PROPAGATION_DEFS = SimpleNamespace(PERSONALIZED_PAGERANK="personalized_pagerank")
205
+
206
+ # null distributions
207
+ NULL_STRATEGIES = SimpleNamespace(
208
+ UNIFORM="uniform",
209
+ PARAMETRIC="parametric",
210
+ NODE_PERMUTATION="node_permutation",
211
+ EDGE_PERMUTATION="edge_permutation",
212
+ )
213
+
214
+ VALID_NULL_STRATEGIES = NULL_STRATEGIES.__dict__.values()
215
+
216
+ PARAMETRIC_NULL_DEFAULT_DISTRIBUTION = "norm"
217
+
218
+ # masks
219
+
220
+ MASK_KEYWORDS = SimpleNamespace(
221
+ ATTR="attr",
222
+ )
@@ -9,7 +9,7 @@ from __future__ import annotations
9
9
 
10
10
  import logging
11
11
  import random
12
- from typing import Any, Optional, Sequence
12
+ from typing import Any, Optional, Sequence, List, Dict, Union
13
13
 
14
14
  import igraph as ig
15
15
  import numpy as np
@@ -384,3 +384,163 @@ def _get_top_n_nodes(
384
384
  top_node_attrs = [graph.vs[idx].attributes() for idx in top_idxs]
385
385
  top_vals = [vals[idx] for idx in top_idxs]
386
386
  return [{val_name: val, **node} for val, node in zip(top_vals, top_node_attrs)]
387
+
388
+
389
+ def _parse_mask_input(
390
+ mask_input: Optional[Union[str, np.ndarray, List, Dict]], attributes: List[str]
391
+ ) -> Dict[str, Union[str, np.ndarray, List, None]]:
392
+ """
393
+ Parse mask input and convert to attribute-specific mask specifications.
394
+
395
+ Parameters
396
+ ----------
397
+ mask_input : str, np.ndarray, List, Dict, or None
398
+ Mask specification that can be:
399
+ - None: use all nodes for all attributes
400
+ - "attr": use each attribute as its own mask
401
+ - np.ndarray/List: use same mask for all attributes
402
+ - Dict: attribute-specific mask specifications
403
+ attributes : List[str]
404
+ List of attribute names.
405
+
406
+ Returns
407
+ -------
408
+ Dict[str, Union[str, np.ndarray, List, None]]
409
+ Dictionary mapping each attribute to its mask specification.
410
+ """
411
+ if mask_input is None:
412
+ return {attr: None for attr in attributes}
413
+ elif isinstance(mask_input, str):
414
+ if mask_input == "attr":
415
+ return {attr: attr for attr in attributes}
416
+ else:
417
+ # Single attribute name used for all
418
+ return {attr: mask_input for attr in attributes}
419
+ elif isinstance(mask_input, (np.ndarray, list)):
420
+ # Same mask for all attributes
421
+ return {attr: mask_input for attr in attributes}
422
+ elif isinstance(mask_input, dict):
423
+ # Validate all attributes are present
424
+ for attr in attributes:
425
+ if attr not in mask_input:
426
+ raise ValueError(f"Attribute '{attr}' not found in mask dictionary")
427
+ return mask_input
428
+ else:
429
+ raise ValueError(f"Invalid mask input type: {type(mask_input)}")
430
+
431
+
432
+ def _get_attribute_masks(
433
+ graph: ig.Graph,
434
+ mask_specs: Dict[str, Union[str, np.ndarray, List, None]],
435
+ ) -> Dict[str, np.ndarray]:
436
+ """
437
+ Generate boolean masks for each attribute based on specifications.
438
+
439
+ Parameters
440
+ ----------
441
+ graph : ig.Graph
442
+ Input graph.
443
+ attributes : List[str]
444
+ List of attribute names.
445
+ mask_specs : Dict[str, Union[str, np.ndarray, List, None]]
446
+ Dictionary mapping each attribute to its mask specification.
447
+
448
+ Returns
449
+ -------
450
+ Dict[str, np.ndarray]
451
+ Dictionary mapping each attribute to its boolean mask array.
452
+ """
453
+ n_nodes = graph.vcount()
454
+ masks = {}
455
+
456
+ invalid_attrs = set(mask_specs.keys()).difference(graph.vs.attributes())
457
+ if invalid_attrs:
458
+ raise ValueError(f"Attributes {invalid_attrs} not found in graph")
459
+
460
+ for attr in mask_specs.keys():
461
+
462
+ mask_spec = mask_specs[attr]
463
+
464
+ if mask_spec is None:
465
+ masks[attr] = np.ones(n_nodes, dtype=bool)
466
+ elif isinstance(mask_spec, str):
467
+ attr_values = np.array(graph.vs[mask_spec])
468
+ masks[attr] = attr_values > 0
469
+ elif isinstance(mask_spec, np.ndarray):
470
+ masks[attr] = mask_spec.astype(bool)
471
+ elif isinstance(mask_spec, list):
472
+ mask_array = np.zeros(n_nodes, dtype=bool)
473
+ if isinstance(mask_spec[0], str):
474
+ # Node names
475
+ node_names = (
476
+ graph.vs["name"] if "name" in graph.vs.attributes() else None
477
+ )
478
+ if node_names is None:
479
+ raise ValueError("Graph has no 'name' attribute for string mask")
480
+ for name in mask_spec:
481
+ idx = node_names.index(name)
482
+ mask_array[idx] = True
483
+ else:
484
+ # Node indices
485
+ mask_array[mask_spec] = True
486
+ masks[attr] = mask_array
487
+ else:
488
+ raise ValueError(
489
+ f"Invalid mask specification for attribute '{attr}': {type(mask_spec)}"
490
+ )
491
+
492
+ return masks
493
+
494
+
495
+ def _ensure_valid_attribute(graph: ig.Graph, attribute: str, non_negative: bool = True):
496
+ """
497
+ Ensure a vertex attribute is present, numeric, and optionally non-negative for all vertices.
498
+
499
+ This utility checks that the specified vertex attribute exists, is numeric, and (optionally) non-negative
500
+ for all vertices in the graph. Missing or None values are treated as 0. Raises ValueError
501
+ if the attribute is missing for all vertices, if all values are zero, or if any value is negative (if non_negative=True).
502
+
503
+ Parameters
504
+ ----------
505
+ graph : NapistuGraph or ig.Graph
506
+ The input graph (NapistuGraph or igraph.Graph).
507
+ attribute : str
508
+ The name of the vertex attribute to check.
509
+ non_negative : bool, default True
510
+ Whether to require all values to be non-negative.
511
+
512
+ Returns
513
+ -------
514
+ np.ndarray
515
+ Array of attribute values (with missing/None replaced by 0).
516
+
517
+ Raises
518
+ ------
519
+ ValueError
520
+ If the attribute is missing for all vertices, all values are zero, or any value is negative (if non_negative=True).
521
+ """
522
+ all_missing = all(
523
+ (attribute not in v.attributes() or v[attribute] is None) for v in graph.vs
524
+ )
525
+ if all_missing:
526
+ raise ValueError(f"Vertex attribute '{attribute}' is missing for all vertices.")
527
+
528
+ values = [
529
+ (
530
+ v[attribute]
531
+ if (attribute in v.attributes() and v[attribute] is not None)
532
+ else 0.0
533
+ )
534
+ for v in graph.vs
535
+ ]
536
+
537
+ arr = np.array(values, dtype=float)
538
+
539
+ if np.all(arr == 0):
540
+ raise ValueError(
541
+ f"Vertex attribute '{attribute}' is zero for all vertices; cannot use as reset vector."
542
+ )
543
+ if non_negative and np.any(arr < 0):
544
+ raise ValueError(f"Attribute '{attribute}' contains negative values.")
545
+
546
+ return arr
@@ -26,7 +26,7 @@ from napistu.constants import (
26
26
  )
27
27
 
28
28
  from napistu.network.constants import (
29
- NAPISTU_GRAPH_NODES,
29
+ NAPISTU_GRAPH_VERTICES,
30
30
  NAPISTU_GRAPH_EDGES,
31
31
  NAPISTU_GRAPH_EDGE_DIRECTIONS,
32
32
  NAPISTU_GRAPH_NODE_TYPES,
@@ -152,7 +152,7 @@ def create_napistu_graph(
152
152
 
153
153
  # rename nodes to name since it is treated specially
154
154
  network_nodes_df = pd.concat(network_nodes).rename(
155
- columns={"node_id": NAPISTU_GRAPH_NODES.NAME}
155
+ columns={"node_id": NAPISTU_GRAPH_VERTICES.NAME}
156
156
  )
157
157
 
158
158
  logger.info(f"Formatting edges as a {wiring_approach} graph")
@@ -234,7 +234,7 @@ def create_napistu_graph(
234
234
  vertices=network_nodes_df.to_dict("records"),
235
235
  edges=unique_edges.to_dict("records"),
236
236
  directed=directed,
237
- vertex_name_attr=NAPISTU_GRAPH_NODES.NAME,
237
+ vertex_name_attr=NAPISTU_GRAPH_VERTICES.NAME,
238
238
  edge_foreign_keys=(NAPISTU_GRAPH_EDGES.FROM, NAPISTU_GRAPH_EDGES.TO),
239
239
  )
240
240