napistu 0.3.5__tar.gz → 0.3.6__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.
- {napistu-0.3.5 → napistu-0.3.6}/PKG-INFO +2 -2
- {napistu-0.3.5 → napistu-0.3.6}/setup.cfg +2 -2
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/__main__.py +18 -18
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/consensus.py +3 -2
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/constants.py +1 -1
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/context/filtering.py +2 -1
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/identifiers.py +3 -6
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/ingestion/bigg.py +6 -6
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/ingestion/string.py +2 -1
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/ingestion/yeast.py +2 -1
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/matching/interactions.py +4 -4
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/modify/uncompartmentalize.py +1 -1
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/network/net_create.py +1 -1
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/network/paths.py +1 -1
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/ontologies/dogma.py +2 -1
- napistu-0.3.6/src/napistu/sbml_dfs_core.py +1915 -0
- napistu-0.3.6/src/napistu/sbml_dfs_utils.py +1279 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu.egg-info/PKG-INFO +2 -2
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu.egg-info/requires.txt +1 -1
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/conftest.py +43 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_consensus.py +88 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_context_filtering.py +2 -2
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_ontologies_genodexito.py +3 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_ontologies_mygene.py +3 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_sbml_dfs_core.py +102 -203
- napistu-0.3.6/src/tests/test_sbml_dfs_utils.py +221 -0
- napistu-0.3.5/src/napistu/sbml_dfs_core.py +0 -2802
- napistu-0.3.5/src/napistu/sbml_dfs_utils.py +0 -340
- napistu-0.3.5/src/tests/test_sbml_dfs_utils.py +0 -63
- {napistu-0.3.5 → napistu-0.3.6}/LICENSE +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/README.md +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/pyproject.toml +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/setup.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/__init__.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/context/__init__.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/context/discretize.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/gcs/__init__.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/gcs/constants.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/gcs/downloads.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/gcs/utils.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/indices.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/ingestion/__init__.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/ingestion/constants.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/ingestion/gtex.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/ingestion/hpa.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/ingestion/identifiers_etl.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/ingestion/napistu_edgelist.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/ingestion/obo.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/ingestion/psi_mi.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/ingestion/reactome.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/ingestion/sbml.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/ingestion/trrust.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/matching/__init__.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/matching/constants.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/matching/mount.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/matching/species.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/mcp/__init__.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/mcp/__main__.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/mcp/client.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/mcp/codebase.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/mcp/codebase_utils.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/mcp/component_base.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/mcp/config.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/mcp/constants.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/mcp/documentation.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/mcp/documentation_utils.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/mcp/execution.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/mcp/health.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/mcp/profiles.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/mcp/server.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/mcp/tutorials.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/mcp/tutorials_utils.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/mcp/utils.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/modify/__init__.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/modify/constants.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/modify/curation.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/modify/gaps.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/modify/pathwayannot.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/network/__init__.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/network/constants.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/network/data_handling.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/network/ig_utils.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/network/napistu_graph_core.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/network/neighborhoods.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/network/net_propagation.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/network/ng_utils.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/network/precompute.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/ontologies/__init__.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/ontologies/constants.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/ontologies/genodexito.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/ontologies/mygene.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/ontologies/renaming.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/rpy2/__init__.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/rpy2/callr.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/rpy2/constants.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/rpy2/rids.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/scverse/__init__.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/scverse/constants.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/scverse/loading.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/source.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu/utils.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu.egg-info/SOURCES.txt +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu.egg-info/dependency_links.txt +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu.egg-info/entry_points.txt +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/napistu.egg-info/top_level.txt +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/__init__.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_constants.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_context_discretize.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_curation.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_data/__init__.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_gaps.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_gcs.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_identifiers.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_indices.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_ingestion_napistu_edgelist.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_ingestion_obo.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_matching_interactions.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_matching_mount.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_matching_species.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_mcp_config.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_mcp_documentation_utils.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_mcp_server.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_network_data_handling.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_network_ig_utils.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_network_neighborhoods.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_network_net_create.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_network_net_propagation.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_network_ng_utils.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_network_paths.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_network_precompute.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_ontologies_renaming.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_pathwayannot.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_rpy2_callr.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_rpy2_init.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_sbml.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_sbo.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_scverse_loading.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_set_coverage.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_source.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_uncompartmentalize.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/test_utils.py +0 -0
- {napistu-0.3.5 → napistu-0.3.6}/src/tests/utils.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: napistu
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.6
|
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
|
@@ -43,7 +43,7 @@ Requires-Dist: pytest-cov; extra == "dev"
|
|
43
43
|
Requires-Dist: ruff; extra == "dev"
|
44
44
|
Requires-Dist: testcontainers; extra == "dev"
|
45
45
|
Provides-Extra: mcp
|
46
|
-
Requires-Dist: fastmcp<
|
46
|
+
Requires-Dist: fastmcp<2.9.0,>=2.0.0; extra == "mcp"
|
47
47
|
Requires-Dist: mcp<2.0.0,>=1.0.0; extra == "mcp"
|
48
48
|
Requires-Dist: httpx>=0.24.0; extra == "mcp"
|
49
49
|
Requires-Dist: beautifulsoup4<5.0.0,>=4.11.0; extra == "mcp"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[metadata]
|
2
2
|
name = napistu
|
3
|
-
version = 0.3.
|
3
|
+
version = 0.3.6
|
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
|
@@ -61,7 +61,7 @@ dev =
|
|
61
61
|
ruff
|
62
62
|
testcontainers
|
63
63
|
mcp =
|
64
|
-
fastmcp>=2.0.0,<
|
64
|
+
fastmcp>=2.0.0,<2.9.0
|
65
65
|
mcp>=1.0.0,<2.0.0
|
66
66
|
httpx>=0.24.0
|
67
67
|
beautifulsoup4>=4.11.0,<5.0.0
|
@@ -54,12 +54,12 @@ def cli():
|
|
54
54
|
|
55
55
|
|
56
56
|
@click.group()
|
57
|
-
def
|
57
|
+
def ingestion():
|
58
58
|
"""Command line tools to retrieve raw data."""
|
59
59
|
pass
|
60
60
|
|
61
61
|
|
62
|
-
@
|
62
|
+
@ingestion.command(name="reactome")
|
63
63
|
@click.argument("base_folder", type=str)
|
64
64
|
@click.option(
|
65
65
|
"--overwrite", "-o", is_flag=True, default=False, help="Overwrite existing files?"
|
@@ -70,7 +70,7 @@ def load_reactome(base_folder: str, overwrite=True):
|
|
70
70
|
reactome.reactome_sbml_download(f"{base_folder}/sbml", overwrite=overwrite)
|
71
71
|
|
72
72
|
|
73
|
-
@
|
73
|
+
@ingestion.command(name="bigg")
|
74
74
|
@click.argument("base_folder", type=str)
|
75
75
|
@click.option(
|
76
76
|
"--overwrite", "-o", is_flag=True, default=False, help="Overwrite existing files?"
|
@@ -81,7 +81,7 @@ def load_bigg(base_folder: str, overwrite: bool):
|
|
81
81
|
bigg.bigg_sbml_download(base_folder, overwrite)
|
82
82
|
|
83
83
|
|
84
|
-
@
|
84
|
+
@ingestion.command(name="trrust")
|
85
85
|
@click.argument("target_uri", type=str)
|
86
86
|
@click_logging.simple_verbosity_option(logger)
|
87
87
|
def load_ttrust(target_uri: str):
|
@@ -89,7 +89,7 @@ def load_ttrust(target_uri: str):
|
|
89
89
|
trrust.download_trrust(target_uri)
|
90
90
|
|
91
91
|
|
92
|
-
@
|
92
|
+
@ingestion.command(name="proteinatlas-subcell")
|
93
93
|
@click.argument("target_uri", type=str)
|
94
94
|
@click.option(
|
95
95
|
"--url",
|
@@ -102,7 +102,7 @@ def load_proteinatlas_subcell(target_uri: str, url: str):
|
|
102
102
|
hpa.download_hpa_data(target_uri, url)
|
103
103
|
|
104
104
|
|
105
|
-
@
|
105
|
+
@ingestion.command(name="gtex-rnaseq-expression")
|
106
106
|
@click.argument("target_uri", type=str)
|
107
107
|
@click.option(
|
108
108
|
"--url",
|
@@ -115,7 +115,7 @@ def load_gtex_rnaseq(target_uri: str, url: str):
|
|
115
115
|
gtex.download_gtex_rnaseq(target_uri, url)
|
116
116
|
|
117
117
|
|
118
|
-
@
|
118
|
+
@ingestion.command(name="string-db")
|
119
119
|
@click.argument("target_uri", type=str)
|
120
120
|
@click.option(
|
121
121
|
"--species",
|
@@ -128,7 +128,7 @@ def load_string_db(target_uri: str, species: str):
|
|
128
128
|
string.download_string(target_uri, species)
|
129
129
|
|
130
130
|
|
131
|
-
@
|
131
|
+
@ingestion.command(name="string-aliases")
|
132
132
|
@click.argument("target_uri", type=str)
|
133
133
|
@click.option(
|
134
134
|
"--species",
|
@@ -343,9 +343,9 @@ def infer_uncompartmentalized_species_location(model_uri: str, output_model_uri:
|
|
343
343
|
If the compartment of a subset of compartmentalized species was
|
344
344
|
not specified, infer an appropriate compartment from other members of reactions they particpate in
|
345
345
|
"""
|
346
|
-
|
347
|
-
|
348
|
-
utils.save_pickle(output_model_uri,
|
346
|
+
sbml_dfs = utils.load_pickle(model_uri)
|
347
|
+
sbml_dfs.infer_uncompartmentalized_species_location()
|
348
|
+
utils.save_pickle(output_model_uri, sbml_dfs)
|
349
349
|
|
350
350
|
|
351
351
|
@refine.command(name="name_compartmentalized_species")
|
@@ -357,9 +357,9 @@ def name_compartmentalized_species(model_uri: str, output_model_uri: str):
|
|
357
357
|
|
358
358
|
Rename compartmentalized species if they have the same name as their species
|
359
359
|
"""
|
360
|
-
|
361
|
-
|
362
|
-
utils.save_pickle(output_model_uri,
|
360
|
+
sbml_dfs = utils.load_pickle(model_uri)
|
361
|
+
sbml_dfs.name_compartmentalized_species()
|
362
|
+
utils.save_pickle(output_model_uri, sbml_dfs)
|
363
363
|
|
364
364
|
|
365
365
|
@refine.command(name="merge_model_compartments")
|
@@ -786,9 +786,9 @@ def export_sbml_dfs_tables(
|
|
786
786
|
logger.debug(f"nondogmatic = {nondogmatic}; dogmatic = {dogmatic}")
|
787
787
|
logger.info(f"Exporting tables with dogmatic = {dogmatic}")
|
788
788
|
|
789
|
-
|
790
|
-
|
791
|
-
model_prefix,
|
789
|
+
sbml_dfs = utils.load_pickle(model_uri)
|
790
|
+
sbml_dfs.export_sbml_dfs(
|
791
|
+
model_prefix, output_uri, overwrite=overwrite, dogmatic=dogmatic
|
792
792
|
)
|
793
793
|
|
794
794
|
|
@@ -884,7 +884,7 @@ def calculate_igraph_stats(input_uri, output_uri):
|
|
884
884
|
utils.save_json(output_uri, stats)
|
885
885
|
|
886
886
|
|
887
|
-
cli.add_command(
|
887
|
+
cli.add_command(ingestion)
|
888
888
|
cli.add_command(integrate)
|
889
889
|
cli.add_command(consensus)
|
890
890
|
cli.add_command(refine)
|
@@ -843,9 +843,10 @@ def report_consensus_merges(
|
|
843
843
|
indexed_models = merges_lookup.set_index("model").sort_index()
|
844
844
|
merges_dict = dict()
|
845
845
|
for mod in indexed_models.index.unique():
|
846
|
-
merges_dict[mod] =
|
847
|
-
|
846
|
+
merges_dict[mod] = sbml_dfs_dict[mod].reaction_formulas(
|
847
|
+
indexed_models.loc[mod]["r_id"]
|
848
848
|
)
|
849
|
+
|
849
850
|
merge_labels = pd.concat(merges_dict, names=["model", "r_id"]).rename("label")
|
850
851
|
|
851
852
|
# add labels to models + r_id
|
@@ -135,7 +135,7 @@ REQUIRED_REACTION_FROMEDGELIST_COLUMNS = [
|
|
135
135
|
"r_isreversible",
|
136
136
|
]
|
137
137
|
|
138
|
-
|
138
|
+
NAPISTU_STANDARD_OUTPUTS = SimpleNamespace(
|
139
139
|
SPECIES_IDENTIFIERS="species_identifiers.tsv",
|
140
140
|
SPECIES="species.json",
|
141
141
|
REACTIONS="reactions.json",
|
@@ -5,6 +5,7 @@ from typing import Union, List, Optional
|
|
5
5
|
import pandas as pd
|
6
6
|
|
7
7
|
from napistu import sbml_dfs_core
|
8
|
+
from napistu import sbml_dfs_utils
|
8
9
|
from napistu import utils
|
9
10
|
from napistu.constants import SBML_DFS
|
10
11
|
|
@@ -236,7 +237,7 @@ def _find_reactions_with_disconnected_cspecies(
|
|
236
237
|
sbml_dfs._validate_table(SBML_DFS.REACTION_SPECIES)
|
237
238
|
sbml_dfs._validate_table(SBML_DFS.COMPARTMENTALIZED_SPECIES)
|
238
239
|
|
239
|
-
reaction_species =
|
240
|
+
reaction_species = sbml_dfs_utils.add_sbo_role(sbml_dfs.reaction_species)
|
240
241
|
|
241
242
|
logger.info(
|
242
243
|
"Finding disconnected pairs of cspecies based on the zero values in the coccurrence_edgelist"
|
@@ -12,7 +12,6 @@ import pandas as pd
|
|
12
12
|
from pydantic import BaseModel
|
13
13
|
|
14
14
|
from napistu import sbml_dfs_core
|
15
|
-
from napistu import sbml_dfs_utils
|
16
15
|
from napistu import utils
|
17
16
|
|
18
17
|
from napistu.constants import IDENTIFIERS
|
@@ -883,9 +882,7 @@ def _prepare_species_identifiers(
|
|
883
882
|
"""Accepts and validates species_identifiers, or extracts a fresh table if None."""
|
884
883
|
|
885
884
|
if species_identifiers is None:
|
886
|
-
species_identifiers =
|
887
|
-
sbml_dfs, dogmatic=dogmatic
|
888
|
-
)
|
885
|
+
species_identifiers = sbml_dfs.get_characteristic_species_ids(dogmatic=dogmatic)
|
889
886
|
else:
|
890
887
|
# check for compatibility
|
891
888
|
try:
|
@@ -898,8 +895,8 @@ def _prepare_species_identifiers(
|
|
898
895
|
logger.warning(
|
899
896
|
f"The provided identifiers are not compatible with your `sbml_dfs` object. Extracting a fresh species identifier table. {e}"
|
900
897
|
)
|
901
|
-
species_identifiers =
|
902
|
-
|
898
|
+
species_identifiers = sbml_dfs.get_characteristic_species_ids(
|
899
|
+
dogmatic=dogmatic
|
903
900
|
)
|
904
901
|
|
905
902
|
return species_identifiers
|
@@ -122,10 +122,10 @@ def construct_bigg_consensus(
|
|
122
122
|
raise NotImplementedError("Merging of models not implemented yet for BiGG")
|
123
123
|
|
124
124
|
# In Bigg there should be only one model
|
125
|
-
|
125
|
+
sbml_dfs = list(sbml_dfs_dict.values())[0]
|
126
126
|
# fix missing compartimentalization
|
127
|
-
|
128
|
-
|
129
|
-
rename_species_ontologies(
|
130
|
-
|
131
|
-
return
|
127
|
+
sbml_dfs.infer_uncompartmentalized_species_location()
|
128
|
+
sbml_dfs.name_compartmentalized_species()
|
129
|
+
rename_species_ontologies(sbml_dfs)
|
130
|
+
sbml_dfs.validate()
|
131
|
+
return sbml_dfs
|
@@ -5,6 +5,7 @@ import logging
|
|
5
5
|
import pandas as pd
|
6
6
|
from napistu import identifiers
|
7
7
|
from napistu import sbml_dfs_core
|
8
|
+
from napistu import sbml_dfs_utils
|
8
9
|
from napistu import source
|
9
10
|
from napistu import utils
|
10
11
|
from napistu.constants import BQB
|
@@ -158,7 +159,7 @@ def convert_string_to_sbml_dfs(
|
|
158
159
|
# Define compartments
|
159
160
|
# Currently we are mapping everything to the `CELLULAR_COMPONENT`
|
160
161
|
# which is a catch-all go: for unknown localisation
|
161
|
-
compartments_df =
|
162
|
+
compartments_df = sbml_dfs_utils.stub_compartments()
|
162
163
|
|
163
164
|
# define interactions
|
164
165
|
interaction_edgelist = _build_interactor_edgelist(uq_string_edgelist)
|
@@ -3,6 +3,7 @@ from __future__ import annotations
|
|
3
3
|
import pandas as pd
|
4
4
|
from napistu import identifiers
|
5
5
|
from napistu import sbml_dfs_core
|
6
|
+
from napistu import sbml_dfs_utils
|
6
7
|
from napistu import source
|
7
8
|
from napistu import utils
|
8
9
|
from napistu.constants import BQB
|
@@ -105,7 +106,7 @@ def convert_idea_kinetics_to_sbml_dfs(
|
|
105
106
|
# Constant fields (for this data source)
|
106
107
|
|
107
108
|
# setup compartments (just treat this as uncompartmentalized for now)
|
108
|
-
compartments_df =
|
109
|
+
compartments_df = sbml_dfs_utils.stub_compartments()
|
109
110
|
|
110
111
|
# Per convention unaggregated models receive an empty source
|
111
112
|
interaction_source = source.Source(init=True)
|
@@ -40,7 +40,7 @@ def edgelist_to_pathway_species(
|
|
40
40
|
pd.Dataframe containing a "identifier_upstream" and "identifier_downstream" variables used to to match entries
|
41
41
|
species_identifiers: pd.DataFrame
|
42
42
|
A table of molecular species identifiers produced from sbml_dfs.get_identifiers("species") generally using
|
43
|
-
|
43
|
+
sbml_dfs.export_sbml_dfs()
|
44
44
|
ontologies: set
|
45
45
|
A set of ontologies used to match features to pathway species
|
46
46
|
feature_id_var: str, default=FEATURE_ID_VAR_DEFAULT
|
@@ -138,7 +138,7 @@ def edgelist_to_scids(
|
|
138
138
|
A mechanistic model
|
139
139
|
species_identifiers: pd.DataFrame
|
140
140
|
A table of molecular species identifiers produced from
|
141
|
-
sbml_dfs.get_identifiers("species") generally using
|
141
|
+
sbml_dfs.get_identifiers("species") generally using sbml_dfs.export_sbml_dfs()
|
142
142
|
ontologies: set
|
143
143
|
A set of ontologies used to match features to pathway species
|
144
144
|
|
@@ -218,7 +218,7 @@ def filter_to_direct_mechanistic_interactions(
|
|
218
218
|
species_identifiers: pd.DataFrame
|
219
219
|
A table of molecular species identifiers
|
220
220
|
produced from sbml_dfs.get_identifiers("species") generally
|
221
|
-
using
|
221
|
+
using sbml_dfs.export_sbml_dfs()
|
222
222
|
ontologies: set
|
223
223
|
A set of ontologies used to match features to pathway species
|
224
224
|
|
@@ -342,7 +342,7 @@ def filter_to_indirect_mechanistic_interactions(
|
|
342
342
|
A mechanistic model
|
343
343
|
species_identifiers: pandas.DataFrame
|
344
344
|
A table of molecular species identifiers produced from
|
345
|
-
sbml_dfs.get_identifiers("species") generally using
|
345
|
+
sbml_dfs.get_identifiers("species") generally using sbml_dfs.export_sbml_dfs()
|
346
346
|
napistu_graph: igraph.Graph
|
347
347
|
A network representation of the sbml_dfs model
|
348
348
|
ontologies: set
|
@@ -48,7 +48,7 @@ def uncompartmentalize_sbml_dfs(
|
|
48
48
|
)
|
49
49
|
|
50
50
|
# 1. update the compartments table to the stubbed default level: GO CELLULAR_COMPONENT
|
51
|
-
stubbed_compartment =
|
51
|
+
stubbed_compartment = sbml_dfs_utils.stub_compartments().assign(
|
52
52
|
c_Source=_create_stubbed_source()
|
53
53
|
)
|
54
54
|
|
@@ -1697,7 +1697,7 @@ def _create_topology_weights(
|
|
1697
1697
|
base_score (float): offset which will be added to all weights.
|
1698
1698
|
protein_multiplier (int): multiplier for non-metabolite species (lower weight paths will tend to be selected).
|
1699
1699
|
metabolite_multiplier (int): multiplier for metabolites [defined a species with a ChEBI ID).
|
1700
|
-
unknown_multiplier (int): multiplier for species without any identifier. See
|
1700
|
+
unknown_multiplier (int): multiplier for species without any identifier. See sbml_dfs_utils.species_type_types.
|
1701
1701
|
scale_multiplier_by_meandegree (bool): if True then multipliers will be rescaled by the average number of
|
1702
1702
|
connections a node has (i.e., its degree) so that weights will be relatively similar regardless of network
|
1703
1703
|
size and sparsity.
|
@@ -489,7 +489,7 @@ def _label_path_reactions(sbml_dfs: sbml_dfs_core.SBML_dfs, paths_df: pd.DataFra
|
|
489
489
|
reaction_info = (
|
490
490
|
pd.concat(
|
491
491
|
[
|
492
|
-
|
492
|
+
sbml_dfs.reaction_formulas(r_ids=x)
|
493
493
|
for x in set(reaction_paths["node"])
|
494
494
|
]
|
495
495
|
)
|
@@ -4,6 +4,7 @@ import logging
|
|
4
4
|
import pandas as pd
|
5
5
|
|
6
6
|
from napistu import sbml_dfs_core
|
7
|
+
from napistu import sbml_dfs_utils
|
7
8
|
from napistu import source
|
8
9
|
from napistu import identifiers
|
9
10
|
from napistu import utils
|
@@ -59,7 +60,7 @@ def create_dogmatic_sbml_dfs(
|
|
59
60
|
)
|
60
61
|
|
61
62
|
# stub required but invariant variables
|
62
|
-
compartments_df =
|
63
|
+
compartments_df = sbml_dfs_utils.stub_compartments()
|
63
64
|
interaction_source = source.Source(init=True)
|
64
65
|
|
65
66
|
# interactions table. This is required to create the sbml_dfs but we'll drop the info later
|