napistu 0.2.5.dev7__py3-none-any.whl → 0.3.1__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.
Files changed (107) hide show
  1. napistu/__main__.py +126 -96
  2. napistu/constants.py +35 -41
  3. napistu/context/__init__.py +10 -0
  4. napistu/context/discretize.py +462 -0
  5. napistu/context/filtering.py +387 -0
  6. napistu/gcs/__init__.py +1 -1
  7. napistu/identifiers.py +74 -15
  8. napistu/indices.py +68 -0
  9. napistu/ingestion/__init__.py +1 -1
  10. napistu/ingestion/bigg.py +47 -62
  11. napistu/ingestion/constants.py +18 -133
  12. napistu/ingestion/gtex.py +113 -0
  13. napistu/ingestion/hpa.py +147 -0
  14. napistu/ingestion/sbml.py +0 -97
  15. napistu/ingestion/string.py +2 -2
  16. napistu/matching/__init__.py +10 -0
  17. napistu/matching/constants.py +18 -0
  18. napistu/matching/interactions.py +518 -0
  19. napistu/matching/mount.py +529 -0
  20. napistu/matching/species.py +510 -0
  21. napistu/mcp/__init__.py +7 -4
  22. napistu/mcp/__main__.py +128 -72
  23. napistu/mcp/client.py +16 -25
  24. napistu/mcp/codebase.py +201 -145
  25. napistu/mcp/component_base.py +170 -0
  26. napistu/mcp/config.py +223 -0
  27. napistu/mcp/constants.py +45 -2
  28. napistu/mcp/documentation.py +253 -136
  29. napistu/mcp/documentation_utils.py +13 -48
  30. napistu/mcp/execution.py +372 -305
  31. napistu/mcp/health.py +47 -65
  32. napistu/mcp/profiles.py +10 -6
  33. napistu/mcp/server.py +161 -80
  34. napistu/mcp/tutorials.py +139 -87
  35. napistu/modify/__init__.py +1 -1
  36. napistu/modify/gaps.py +1 -1
  37. napistu/network/__init__.py +1 -1
  38. napistu/network/constants.py +101 -34
  39. napistu/network/data_handling.py +388 -0
  40. napistu/network/ig_utils.py +351 -0
  41. napistu/network/napistu_graph_core.py +354 -0
  42. napistu/network/neighborhoods.py +40 -40
  43. napistu/network/net_create.py +373 -309
  44. napistu/network/net_propagation.py +47 -19
  45. napistu/network/{net_utils.py → ng_utils.py} +124 -272
  46. napistu/network/paths.py +67 -51
  47. napistu/network/precompute.py +11 -11
  48. napistu/ontologies/__init__.py +10 -0
  49. napistu/ontologies/constants.py +129 -0
  50. napistu/ontologies/dogma.py +243 -0
  51. napistu/ontologies/genodexito.py +649 -0
  52. napistu/ontologies/mygene.py +369 -0
  53. napistu/ontologies/renaming.py +198 -0
  54. napistu/rpy2/__init__.py +229 -86
  55. napistu/rpy2/callr.py +47 -77
  56. napistu/rpy2/constants.py +24 -23
  57. napistu/rpy2/rids.py +61 -648
  58. napistu/sbml_dfs_core.py +587 -222
  59. napistu/scverse/__init__.py +15 -0
  60. napistu/scverse/constants.py +28 -0
  61. napistu/scverse/loading.py +727 -0
  62. napistu/utils.py +118 -10
  63. {napistu-0.2.5.dev7.dist-info → napistu-0.3.1.dist-info}/METADATA +8 -3
  64. napistu-0.3.1.dist-info/RECORD +133 -0
  65. tests/conftest.py +22 -0
  66. tests/test_context_discretize.py +56 -0
  67. tests/test_context_filtering.py +267 -0
  68. tests/test_identifiers.py +100 -0
  69. tests/test_indices.py +65 -0
  70. tests/{test_edgelist.py → test_ingestion_napistu_edgelist.py} +2 -2
  71. tests/test_matching_interactions.py +108 -0
  72. tests/test_matching_mount.py +305 -0
  73. tests/test_matching_species.py +394 -0
  74. tests/test_mcp_config.py +193 -0
  75. tests/test_mcp_documentation_utils.py +12 -3
  76. tests/test_mcp_server.py +156 -19
  77. tests/test_network_data_handling.py +397 -0
  78. tests/test_network_ig_utils.py +23 -0
  79. tests/test_network_neighborhoods.py +19 -0
  80. tests/test_network_net_create.py +459 -0
  81. tests/test_network_ng_utils.py +30 -0
  82. tests/test_network_paths.py +56 -0
  83. tests/{test_precomputed_distances.py → test_network_precompute.py} +8 -6
  84. tests/test_ontologies_genodexito.py +58 -0
  85. tests/test_ontologies_mygene.py +39 -0
  86. tests/test_ontologies_renaming.py +110 -0
  87. tests/test_rpy2_callr.py +79 -0
  88. tests/test_rpy2_init.py +151 -0
  89. tests/test_sbml.py +0 -31
  90. tests/test_sbml_dfs_core.py +134 -10
  91. tests/test_scverse_loading.py +778 -0
  92. tests/test_set_coverage.py +2 -2
  93. tests/test_utils.py +121 -1
  94. napistu/mechanism_matching.py +0 -1353
  95. napistu/rpy2/netcontextr.py +0 -467
  96. napistu-0.2.5.dev7.dist-info/RECORD +0 -98
  97. tests/test_igraph.py +0 -367
  98. tests/test_mechanism_matching.py +0 -784
  99. tests/test_net_utils.py +0 -149
  100. tests/test_netcontextr.py +0 -105
  101. tests/test_rpy2.py +0 -61
  102. /napistu/ingestion/{cpr_edgelist.py → napistu_edgelist.py} +0 -0
  103. {napistu-0.2.5.dev7.dist-info → napistu-0.3.1.dist-info}/WHEEL +0 -0
  104. {napistu-0.2.5.dev7.dist-info → napistu-0.3.1.dist-info}/entry_points.txt +0 -0
  105. {napistu-0.2.5.dev7.dist-info → napistu-0.3.1.dist-info}/licenses/LICENSE +0 -0
  106. {napistu-0.2.5.dev7.dist-info → napistu-0.3.1.dist-info}/top_level.txt +0 -0
  107. /tests/{test_obo.py → test_ingestion_obo.py} +0 -0
napistu/mcp/tutorials.py CHANGED
@@ -7,118 +7,170 @@ import logging
7
7
 
8
8
  from fastmcp import FastMCP
9
9
 
10
+ from napistu.mcp.component_base import ComponentState, MCPComponent
10
11
  from napistu.mcp import tutorials_utils
11
12
  from napistu.mcp import utils as mcp_utils
12
- from napistu.mcp.constants import TUTORIALS
13
13
  from napistu.mcp.constants import TUTORIAL_URLS
14
- from napistu.mcp.constants import TOOL_VARS
15
-
16
- # Global cache for tutorial content
17
- _tutorial_cache: Dict[str, Dict[str, str]] = {
18
- TUTORIALS.TUTORIALS: {},
19
- }
20
14
 
21
15
  logger = logging.getLogger(__name__)
22
16
 
23
17
 
24
- async def initialize_components() -> bool:
25
- """
26
- Initialize tutorial components by preloading all tutorials into the cache.
18
+ class TutorialsState(ComponentState):
19
+ """State management for tutorials component."""
27
20
 
28
- Returns
29
- -------
30
- bool
31
- True if initialization is successful.
32
- """
33
- global _tutorial_cache
34
- for k, v in TUTORIAL_URLS.items():
35
- _tutorial_cache[TUTORIALS.TUTORIALS][k] = (
36
- await tutorials_utils.get_tutorial_markdown(k)
37
- )
38
- return True
21
+ def __init__(self):
22
+ super().__init__()
23
+ self.tutorials: Dict[str, str] = {}
39
24
 
25
+ def is_healthy(self) -> bool:
26
+ """Component is healthy if it has loaded tutorials."""
27
+ return bool(self.tutorials)
40
28
 
41
- def register_components(mcp: FastMCP) -> None:
42
- """
43
- Register tutorial components with the MCP server.
29
+ def get_health_details(self) -> Dict[str, Any]:
30
+ """Provide tutorials-specific health details."""
31
+ return {
32
+ "tutorial_count": len(self.tutorials),
33
+ "tutorial_ids": list(self.tutorials.keys()),
34
+ }
44
35
 
45
- Parameters
46
- ----------
47
- mcp : FastMCP
48
- FastMCP server instance.
49
- """
50
36
 
51
- # Register resources
52
- @mcp.resource("napistu://tutorials/index")
53
- async def get_tutorials_index() -> List[Dict[str, Any]]:
54
- """
55
- Get the index of all available tutorials.
37
+ class TutorialsComponent(MCPComponent):
38
+ """MCP component for tutorial management and search."""
56
39
 
57
- Returns
58
- -------
59
- List[dict]
60
- List of dictionaries with tutorial IDs and URLs.
61
- """
62
- return [
63
- {"id": tutorial_id, "url": url}
64
- for tutorial_id, url in TUTORIAL_URLS.items()
65
- ]
40
+ def _create_state(self) -> TutorialsState:
41
+ """Create tutorials-specific state."""
42
+ return TutorialsState()
66
43
 
67
- @mcp.resource("napistu://tutorials/content/{tutorial_id}")
68
- async def get_tutorial_content_resource(tutorial_id: str) -> Dict[str, Any]:
44
+ async def initialize(self) -> bool:
69
45
  """
70
- Get the content of a specific tutorial as markdown.
71
-
72
- Parameters
73
- ----------
74
- tutorial_id : str
75
- ID of the tutorial.
46
+ Initialize tutorials component by loading all tutorials.
76
47
 
77
48
  Returns
78
49
  -------
79
- dict
80
- Dictionary with markdown content and format.
81
-
82
- Raises
83
- ------
84
- Exception
85
- If the tutorial cannot be loaded.
50
+ bool
51
+ True if at least one tutorial was loaded successfully
86
52
  """
87
- content = _tutorial_cache[TUTORIALS.TUTORIALS].get(tutorial_id)
88
- if content is None:
53
+ tutorials_loaded = 0
54
+
55
+ for tutorial_id, url in TUTORIAL_URLS.items():
89
56
  try:
90
57
  content = await tutorials_utils.get_tutorial_markdown(tutorial_id)
91
- _tutorial_cache[TUTORIALS.TUTORIALS][tutorial_id] = content
58
+ self.state.tutorials[tutorial_id] = content
59
+ tutorials_loaded += 1
60
+ logger.debug(f"Loaded tutorial: {tutorial_id}")
92
61
  except Exception as e:
93
- logger.error(f"Tutorial {tutorial_id} could not be loaded: {e}")
94
- raise
95
- return {
96
- "content": content,
97
- "format": "markdown",
98
- }
62
+ logger.warning(f"Failed to load tutorial {tutorial_id}: {e}")
63
+ # Continue loading other tutorials even if one fails
99
64
 
100
- @mcp.tool()
101
- async def search_tutorials(query: str) -> List[Dict[str, Any]]:
65
+ logger.info(f"Loaded {tutorials_loaded}/{len(TUTORIAL_URLS)} tutorials")
66
+
67
+ # Consider successful if at least one tutorial loaded
68
+ return tutorials_loaded > 0
69
+
70
+ def register(self, mcp: FastMCP) -> None:
102
71
  """
103
- Search tutorials for a specific query.
72
+ Register tutorial resources and tools with the MCP server.
104
73
 
105
74
  Parameters
106
75
  ----------
107
- query : str
108
- Search term.
109
-
110
- Returns
111
- -------
112
- List[dict]
113
- List of matching tutorials with metadata and snippet.
76
+ mcp : FastMCP
77
+ FastMCP server instance
114
78
  """
115
- results: List[Dict[str, Any]] = []
116
- for tutorial_id, content in _tutorial_cache[TUTORIALS.TUTORIALS].items():
117
- if query.lower() in content.lower():
118
- results.append(
119
- {
120
- TOOL_VARS.ID: tutorial_id,
121
- TOOL_VARS.SNIPPET: mcp_utils.get_snippet(content, query),
122
- }
123
- )
124
- return results
79
+
80
+ # Register resources
81
+ @mcp.resource("napistu://tutorials/index")
82
+ async def get_tutorials_index() -> List[Dict[str, Any]]:
83
+ """
84
+ Get the index of all available tutorials.
85
+
86
+ Returns
87
+ -------
88
+ List[dict]
89
+ List of dictionaries with tutorial IDs and URLs.
90
+ """
91
+ return [
92
+ {"id": tutorial_id, "url": url}
93
+ for tutorial_id, url in TUTORIAL_URLS.items()
94
+ ]
95
+
96
+ @mcp.resource("napistu://tutorials/content/{tutorial_id}")
97
+ async def get_tutorial_content_resource(tutorial_id: str) -> Dict[str, Any]:
98
+ """
99
+ Get the content of a specific tutorial as markdown.
100
+
101
+ Parameters
102
+ ----------
103
+ tutorial_id : str
104
+ ID of the tutorial.
105
+
106
+ Returns
107
+ -------
108
+ dict
109
+ Dictionary with markdown content and format.
110
+
111
+ Raises
112
+ ------
113
+ Exception
114
+ If the tutorial cannot be loaded.
115
+ """
116
+ # Check local state first
117
+ content = self.state.tutorials.get(tutorial_id)
118
+
119
+ if content is None:
120
+ # Fallback: try to load on-demand
121
+ try:
122
+ logger.info(f"Loading tutorial {tutorial_id} on-demand")
123
+ content = await tutorials_utils.get_tutorial_markdown(tutorial_id)
124
+ self.state.tutorials[tutorial_id] = content # Cache for future use
125
+ except Exception as e:
126
+ logger.error(f"Tutorial {tutorial_id} could not be loaded: {e}")
127
+ raise
128
+
129
+ return {
130
+ "content": content,
131
+ "format": "markdown",
132
+ }
133
+
134
+ @mcp.tool()
135
+ async def search_tutorials(query: str) -> List[Dict[str, Any]]:
136
+ """
137
+ Search tutorials for a specific query.
138
+
139
+ Parameters
140
+ ----------
141
+ query : str
142
+ Search term.
143
+
144
+ Returns
145
+ -------
146
+ List[dict]
147
+ List of matching tutorials with metadata and snippet.
148
+ """
149
+ results: List[Dict[str, Any]] = []
150
+
151
+ for tutorial_id, content in self.state.tutorials.items():
152
+ if query.lower() in content.lower():
153
+ results.append(
154
+ {
155
+ "id": tutorial_id,
156
+ "snippet": mcp_utils.get_snippet(content, query),
157
+ }
158
+ )
159
+
160
+ return results
161
+
162
+
163
+ # Module-level component instance
164
+ _component = TutorialsComponent()
165
+
166
+
167
+ def get_component() -> TutorialsComponent:
168
+ """
169
+ Get the tutorials component instance.
170
+
171
+ Returns
172
+ -------
173
+ TutorialsComponent
174
+ The tutorials component instance
175
+ """
176
+ return _component
@@ -4,7 +4,7 @@ from importlib.metadata import PackageNotFoundError
4
4
  from importlib.metadata import version
5
5
 
6
6
  try:
7
- __version__ = version("calicolabs-cpr")
7
+ __version__ = version("napistu")
8
8
  except PackageNotFoundError:
9
9
  # package is not installed
10
10
  pass
napistu/modify/gaps.py CHANGED
@@ -462,7 +462,7 @@ def _identify_species_needing_transport_reactions(
462
462
  )
463
463
 
464
464
  # create a directed graph
465
- directed_graph = net_create.create_cpr_graph(
465
+ directed_graph = net_create.create_napistu_graph(
466
466
  sbml_dfs, directed=True, graph_type="bipartite"
467
467
  )
468
468
 
@@ -4,7 +4,7 @@ from importlib.metadata import PackageNotFoundError
4
4
  from importlib.metadata import version
5
5
 
6
6
  try:
7
- __version__ = version("calicolabs-cpr")
7
+ __version__ = version("napistu")
8
8
  except PackageNotFoundError:
9
9
  # package is not installed
10
10
  pass
@@ -7,10 +7,28 @@ from types import SimpleNamespace
7
7
  from napistu.constants import SBML_DFS
8
8
  from napistu.constants import SBOTERM_NAMES
9
9
 
10
- CPR_GRAPH_NODES = SimpleNamespace(NAME="name")
10
+ # Graph types
11
+ NAPISTU_GRAPH_TYPES = SimpleNamespace(
12
+ BIPARTITE="bipartite", REGULATORY="regulatory", SURROGATE="surrogate"
13
+ )
14
+
15
+ VALID_NAPISTU_GRAPH_TYPES = [
16
+ NAPISTU_GRAPH_TYPES.BIPARTITE,
17
+ NAPISTU_GRAPH_TYPES.REGULATORY,
18
+ NAPISTU_GRAPH_TYPES.SURROGATE,
19
+ ]
20
+
21
+ NAPISTU_GRAPH = SimpleNamespace(VERTICES="vertices", EDGES="edges", METADATA="metadata")
22
+
23
+ NAPISTU_GRAPH_DIRECTEDNESS = SimpleNamespace(
24
+ DIRECTED="directed", UNDIRECTED="undirected"
25
+ )
26
+
27
+ NAPISTU_GRAPH_NODES = SimpleNamespace(NAME="name")
11
28
 
12
- CPR_GRAPH_EDGES = SimpleNamespace(
29
+ NAPISTU_GRAPH_EDGES = SimpleNamespace(
13
30
  DIRECTED="directed",
31
+ DIRECTION="direction",
14
32
  FROM="from",
15
33
  R_ID=SBML_DFS.R_ID,
16
34
  R_ISREVERSIBLE=SBML_DFS.R_ISREVERSIBLE,
@@ -26,50 +44,76 @@ CPR_GRAPH_EDGES = SimpleNamespace(
26
44
  WEIGHTS="weights",
27
45
  )
28
46
 
29
- # variables which should be in cpr graph's edges
30
- CPR_GRAPH_REQUIRED_EDGE_VARS = {
31
- CPR_GRAPH_EDGES.FROM,
32
- CPR_GRAPH_EDGES.TO,
33
- CPR_GRAPH_EDGES.SBO_TERM,
34
- CPR_GRAPH_EDGES.STOICHIOMETRY,
35
- CPR_GRAPH_EDGES.SC_PARENTS,
36
- CPR_GRAPH_EDGES.SC_CHILDREN,
47
+ NAPISTU_GRAPH_REQUIRED_EDGE_VARS = {
48
+ NAPISTU_GRAPH_EDGES.FROM,
49
+ NAPISTU_GRAPH_EDGES.TO,
50
+ NAPISTU_GRAPH_EDGES.DIRECTION,
37
51
  }
38
52
 
39
- # nomenclature for individual fields
53
+ NAPISTU_GRAPH_NODE_TYPES = SimpleNamespace(SPECIES="species", REACTION="reaction")
40
54
 
41
- CPR_GRAPH_NODE_TYPES = SimpleNamespace(REACTION="reaction", SPECIES="species")
55
+ VALID_NAPISTU_GRAPH_NODE_TYPES = [
56
+ NAPISTU_GRAPH_NODE_TYPES.REACTION,
57
+ NAPISTU_GRAPH_NODE_TYPES.SPECIES,
58
+ ]
59
+
60
+ NAPISTU_WEIGHTING_STRATEGIES = SimpleNamespace(
61
+ CALIBRATED="calibrated", MIXED="mixed", TOPOLOGY="topology", UNWEIGHTED="unweighted"
62
+ )
42
63
 
43
- VALID_CPR_GRAPH_NODE_TYPES = [
44
- CPR_GRAPH_NODE_TYPES.REACTION,
45
- CPR_GRAPH_NODE_TYPES.SPECIES,
64
+ VALID_WEIGHTING_STRATEGIES = [
65
+ NAPISTU_WEIGHTING_STRATEGIES.UNWEIGHTED,
66
+ NAPISTU_WEIGHTING_STRATEGIES.TOPOLOGY,
67
+ NAPISTU_WEIGHTING_STRATEGIES.MIXED,
68
+ NAPISTU_WEIGHTING_STRATEGIES.CALIBRATED,
46
69
  ]
47
70
 
48
- CPR_GRAPH_EDGE_DIRECTIONS = SimpleNamespace(
71
+ # edge reversal
72
+
73
+ NAPISTU_GRAPH_EDGE_DIRECTIONS = SimpleNamespace(
49
74
  FORWARD="forward", REVERSE="reverse", UNDIRECTED="undirected"
50
75
  )
51
76
 
52
- # network-level nomenclature
77
+ EDGE_REVERSAL_ATTRIBUTE_MAPPING = {
78
+ NAPISTU_GRAPH_EDGES.FROM: NAPISTU_GRAPH_EDGES.TO,
79
+ NAPISTU_GRAPH_EDGES.TO: NAPISTU_GRAPH_EDGES.FROM,
80
+ NAPISTU_GRAPH_EDGES.SC_PARENTS: NAPISTU_GRAPH_EDGES.SC_CHILDREN,
81
+ NAPISTU_GRAPH_EDGES.SC_CHILDREN: NAPISTU_GRAPH_EDGES.SC_PARENTS,
82
+ NAPISTU_GRAPH_EDGES.WEIGHTS: NAPISTU_GRAPH_EDGES.UPSTREAM_WEIGHTS,
83
+ NAPISTU_GRAPH_EDGES.UPSTREAM_WEIGHTS: NAPISTU_GRAPH_EDGES.WEIGHTS,
84
+ # Note: stoichiometry requires special handling (* -1)
85
+ }
53
86
 
54
- CPR_GRAPH_TYPES = SimpleNamespace(
55
- BIPARTITE="bipartite", REGULATORY="regulatory", SURROGATE="surrogate"
87
+ # Direction enum values
88
+ EDGE_DIRECTION_MAPPING = {
89
+ NAPISTU_GRAPH_EDGE_DIRECTIONS.FORWARD: NAPISTU_GRAPH_EDGE_DIRECTIONS.REVERSE,
90
+ NAPISTU_GRAPH_EDGE_DIRECTIONS.REVERSE: NAPISTU_GRAPH_EDGE_DIRECTIONS.FORWARD,
91
+ NAPISTU_GRAPH_EDGE_DIRECTIONS.UNDIRECTED: NAPISTU_GRAPH_EDGE_DIRECTIONS.UNDIRECTED, # unchanged
92
+ }
93
+
94
+ # Net edge direction
95
+ NET_POLARITY = SimpleNamespace(
96
+ LINK_POLARITY="link_polarity",
97
+ NET_POLARITY="net_polarity",
98
+ ACTIVATION="activation",
99
+ INHIBITION="inhibition",
100
+ AMBIGUOUS="ambiguous",
101
+ AMBIGUOUS_ACTIVATION="ambiguous activation",
102
+ AMBIGUOUS_INHIBITION="ambiguous inhibition",
56
103
  )
57
104
 
58
- VALID_CPR_GRAPH_TYPES = [
59
- CPR_GRAPH_TYPES.BIPARTITE,
60
- CPR_GRAPH_TYPES.REGULATORY,
61
- CPR_GRAPH_TYPES.SURROGATE,
105
+ VALID_LINK_POLARITIES = [
106
+ NET_POLARITY.ACTIVATION,
107
+ NET_POLARITY.INHIBITION,
108
+ NET_POLARITY.AMBIGUOUS,
62
109
  ]
63
110
 
64
- CPR_WEIGHTING_STRATEGIES = SimpleNamespace(
65
- CALIBRATED="calibrated", MIXED="mixed", TOPOLOGY="topology", UNWEIGHTED="unweighted"
66
- )
67
-
68
- VALID_WEIGHTING_STRATEGIES = [
69
- CPR_WEIGHTING_STRATEGIES.UNWEIGHTED,
70
- CPR_WEIGHTING_STRATEGIES.TOPOLOGY,
71
- CPR_WEIGHTING_STRATEGIES.MIXED,
72
- CPR_WEIGHTING_STRATEGIES.CALIBRATED,
111
+ VALID_NET_POLARITIES = [
112
+ NET_POLARITY.ACTIVATION,
113
+ NET_POLARITY.INHIBITION,
114
+ NET_POLARITY.AMBIGUOUS,
115
+ NET_POLARITY.AMBIGUOUS_ACTIVATION,
116
+ NET_POLARITY.AMBIGUOUS_INHIBITION,
73
117
  ]
74
118
 
75
119
  # the regulatory graph defines a hierarchy of upstream and downstream
@@ -80,7 +124,7 @@ REGULATORY_GRAPH_HIERARCHY = [
80
124
  [SBOTERM_NAMES.MODIFIER, SBOTERM_NAMES.STIMULATOR, SBOTERM_NAMES.INHIBITOR],
81
125
  [SBOTERM_NAMES.CATALYST],
82
126
  [SBOTERM_NAMES.REACTANT],
83
- [CPR_GRAPH_NODE_TYPES.REACTION],
127
+ [NAPISTU_GRAPH_NODE_TYPES.REACTION],
84
128
  # normally we don't expect interactors to be defined because they are handled by
85
129
  # net_create._format_interactors_for_regulatory_graph() but include them here
86
130
  # until Issue #102 is solved
@@ -98,7 +142,7 @@ SURROGATE_GRAPH_HIERARCHY = [
98
142
  [SBOTERM_NAMES.MODIFIER, SBOTERM_NAMES.STIMULATOR, SBOTERM_NAMES.INHIBITOR],
99
143
  [SBOTERM_NAMES.REACTANT],
100
144
  [SBOTERM_NAMES.CATALYST],
101
- [CPR_GRAPH_NODE_TYPES.REACTION],
145
+ [NAPISTU_GRAPH_NODE_TYPES.REACTION],
102
146
  # normally we don't expect interactors to be defined because they are handled by
103
147
  # net_create._format_interactors_for_regulatory_graph() but include them here
104
148
  # until Issue #102 is solved
@@ -115,3 +159,26 @@ VALID_NEIGHBORHOOD_NETWORK_TYPES = [
115
159
  NEIGHBORHOOD_NETWORK_TYPES.HOURGLASS,
116
160
  NEIGHBORHOOD_NETWORK_TYPES.UPSTREAM,
117
161
  ]
162
+
163
+ # weighting networks and transforming attributes
164
+
165
+ WEIGHTING_SPEC = SimpleNamespace(
166
+ TABLE="table",
167
+ VARIABLE="variable",
168
+ TRANSFORMATION="trans",
169
+ )
170
+
171
+ DEFAULT_WT_TRANS = "identity"
172
+
173
+ DEFINED_WEIGHT_TRANSFORMATION = {
174
+ DEFAULT_WT_TRANS: "_wt_transformation_identity",
175
+ "string": "_wt_transformation_string",
176
+ "string_inv": "_wt_transformation_string_inv",
177
+ }
178
+
179
+ SCORE_CALIBRATION_POINTS_DICT = {
180
+ "weights": {"strong": 3, "good": 7, "okay": 20, "weak": 40},
181
+ "string_wt": {"strong": 950, "good": 400, "okay": 230, "weak": 150},
182
+ }
183
+
184
+ SOURCE_VARS_DICT = {"string_wt": 10}