napistu 0.2.5.dev6__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.
- napistu/__main__.py +126 -96
- napistu/constants.py +35 -41
- napistu/context/__init__.py +10 -0
- napistu/context/discretize.py +462 -0
- napistu/context/filtering.py +387 -0
- napistu/gcs/__init__.py +1 -1
- napistu/identifiers.py +74 -15
- napistu/indices.py +68 -0
- napistu/ingestion/__init__.py +1 -1
- napistu/ingestion/bigg.py +47 -62
- napistu/ingestion/constants.py +18 -133
- napistu/ingestion/gtex.py +113 -0
- napistu/ingestion/hpa.py +147 -0
- napistu/ingestion/sbml.py +0 -97
- napistu/ingestion/string.py +2 -2
- napistu/matching/__init__.py +10 -0
- napistu/matching/constants.py +18 -0
- napistu/matching/interactions.py +518 -0
- napistu/matching/mount.py +529 -0
- napistu/matching/species.py +510 -0
- napistu/mcp/__init__.py +7 -4
- napistu/mcp/__main__.py +128 -72
- napistu/mcp/client.py +16 -25
- napistu/mcp/codebase.py +201 -153
- napistu/mcp/component_base.py +170 -0
- napistu/mcp/config.py +223 -0
- napistu/mcp/constants.py +45 -2
- napistu/mcp/documentation.py +253 -136
- napistu/mcp/documentation_utils.py +13 -48
- napistu/mcp/execution.py +372 -305
- napistu/mcp/health.py +49 -67
- napistu/mcp/profiles.py +10 -6
- napistu/mcp/server.py +161 -80
- napistu/mcp/tutorials.py +139 -87
- napistu/modify/__init__.py +1 -1
- napistu/modify/gaps.py +1 -1
- napistu/network/__init__.py +1 -1
- napistu/network/constants.py +101 -34
- napistu/network/data_handling.py +388 -0
- napistu/network/ig_utils.py +351 -0
- napistu/network/napistu_graph_core.py +354 -0
- napistu/network/neighborhoods.py +40 -40
- napistu/network/net_create.py +373 -309
- napistu/network/net_propagation.py +47 -19
- napistu/network/{net_utils.py → ng_utils.py} +124 -272
- napistu/network/paths.py +67 -51
- napistu/network/precompute.py +11 -11
- napistu/ontologies/__init__.py +10 -0
- napistu/ontologies/constants.py +129 -0
- napistu/ontologies/dogma.py +243 -0
- napistu/ontologies/genodexito.py +649 -0
- napistu/ontologies/mygene.py +369 -0
- napistu/ontologies/renaming.py +198 -0
- napistu/rpy2/__init__.py +229 -86
- napistu/rpy2/callr.py +47 -77
- napistu/rpy2/constants.py +24 -23
- napistu/rpy2/rids.py +61 -648
- napistu/sbml_dfs_core.py +587 -222
- napistu/scverse/__init__.py +15 -0
- napistu/scverse/constants.py +28 -0
- napistu/scverse/loading.py +727 -0
- napistu/utils.py +118 -10
- {napistu-0.2.5.dev6.dist-info → napistu-0.3.1.dist-info}/METADATA +8 -3
- napistu-0.3.1.dist-info/RECORD +133 -0
- tests/conftest.py +22 -0
- tests/test_context_discretize.py +56 -0
- tests/test_context_filtering.py +267 -0
- tests/test_identifiers.py +100 -0
- tests/test_indices.py +65 -0
- tests/{test_edgelist.py → test_ingestion_napistu_edgelist.py} +2 -2
- tests/test_matching_interactions.py +108 -0
- tests/test_matching_mount.py +305 -0
- tests/test_matching_species.py +394 -0
- tests/test_mcp_config.py +193 -0
- tests/test_mcp_documentation_utils.py +12 -3
- tests/test_mcp_server.py +356 -0
- tests/test_network_data_handling.py +397 -0
- tests/test_network_ig_utils.py +23 -0
- tests/test_network_neighborhoods.py +19 -0
- tests/test_network_net_create.py +459 -0
- tests/test_network_ng_utils.py +30 -0
- tests/test_network_paths.py +56 -0
- tests/{test_precomputed_distances.py → test_network_precompute.py} +8 -6
- tests/test_ontologies_genodexito.py +58 -0
- tests/test_ontologies_mygene.py +39 -0
- tests/test_ontologies_renaming.py +110 -0
- tests/test_rpy2_callr.py +79 -0
- tests/test_rpy2_init.py +151 -0
- tests/test_sbml.py +0 -31
- tests/test_sbml_dfs_core.py +134 -10
- tests/test_scverse_loading.py +778 -0
- tests/test_set_coverage.py +2 -2
- tests/test_utils.py +121 -1
- napistu/mechanism_matching.py +0 -1353
- napistu/rpy2/netcontextr.py +0 -467
- napistu-0.2.5.dev6.dist-info/RECORD +0 -97
- tests/test_igraph.py +0 -367
- tests/test_mechanism_matching.py +0 -784
- tests/test_net_utils.py +0 -149
- tests/test_netcontextr.py +0 -105
- tests/test_rpy2.py +0 -61
- /napistu/ingestion/{cpr_edgelist.py → napistu_edgelist.py} +0 -0
- {napistu-0.2.5.dev6.dist-info → napistu-0.3.1.dist-info}/WHEEL +0 -0
- {napistu-0.2.5.dev6.dist-info → napistu-0.3.1.dist-info}/entry_points.txt +0 -0
- {napistu-0.2.5.dev6.dist-info → napistu-0.3.1.dist-info}/licenses/LICENSE +0 -0
- {napistu-0.2.5.dev6.dist-info → napistu-0.3.1.dist-info}/top_level.txt +0 -0
- /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
|
-
|
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
|
-
|
29
|
-
|
30
|
-
|
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
|
42
|
-
|
43
|
-
|
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
|
-
|
52
|
-
|
53
|
-
async def get_tutorial_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
|
-
|
58
|
-
|
59
|
-
|
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
|
-
|
68
|
-
async def get_tutorial_content_resource(tutorial_id: str) -> Dict[str, Any]:
|
44
|
+
async def initialize(self) -> bool:
|
69
45
|
"""
|
70
|
-
|
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
|
-
|
80
|
-
|
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
|
-
|
88
|
-
|
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
|
-
|
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.
|
94
|
-
|
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
|
-
|
101
|
-
|
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
|
-
|
72
|
+
Register tutorial resources and tools with the MCP server.
|
104
73
|
|
105
74
|
Parameters
|
106
75
|
----------
|
107
|
-
|
108
|
-
|
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
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
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
|
napistu/modify/__init__.py
CHANGED
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.
|
465
|
+
directed_graph = net_create.create_napistu_graph(
|
466
466
|
sbml_dfs, directed=True, graph_type="bipartite"
|
467
467
|
)
|
468
468
|
|
napistu/network/__init__.py
CHANGED
napistu/network/constants.py
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
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
|
-
|
53
|
+
NAPISTU_GRAPH_NODE_TYPES = SimpleNamespace(SPECIES="species", REACTION="reaction")
|
40
54
|
|
41
|
-
|
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
|
-
|
44
|
-
|
45
|
-
|
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
|
-
|
71
|
+
# edge reversal
|
72
|
+
|
73
|
+
NAPISTU_GRAPH_EDGE_DIRECTIONS = SimpleNamespace(
|
49
74
|
FORWARD="forward", REVERSE="reverse", UNDIRECTED="undirected"
|
50
75
|
)
|
51
76
|
|
52
|
-
|
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
|
-
|
55
|
-
|
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
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
105
|
+
VALID_LINK_POLARITIES = [
|
106
|
+
NET_POLARITY.ACTIVATION,
|
107
|
+
NET_POLARITY.INHIBITION,
|
108
|
+
NET_POLARITY.AMBIGUOUS,
|
62
109
|
]
|
63
110
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
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
|
-
[
|
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
|
-
[
|
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}
|