napistu 0.3.7__py3-none-any.whl → 0.4.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 +8 -4
- napistu/constants.py +30 -35
- napistu/gcs/constants.py +11 -11
- napistu/ingestion/napistu_edgelist.py +4 -4
- napistu/matching/interactions.py +41 -39
- napistu/modify/gaps.py +2 -1
- napistu/network/constants.py +61 -45
- napistu/network/data_handling.py +1 -1
- napistu/network/neighborhoods.py +3 -3
- napistu/network/net_create.py +440 -616
- napistu/network/net_create_utils.py +734 -0
- napistu/network/net_propagation.py +1 -1
- napistu/network/{napistu_graph_core.py → ng_core.py} +57 -15
- napistu/network/ng_utils.py +28 -21
- napistu/network/paths.py +4 -4
- napistu/network/precompute.py +35 -74
- napistu/ontologies/id_tables.py +282 -0
- napistu/sbml_dfs_core.py +53 -63
- napistu/sbml_dfs_utils.py +126 -16
- napistu/utils.py +80 -5
- {napistu-0.3.7.dist-info → napistu-0.4.1.dist-info}/METADATA +7 -2
- {napistu-0.3.7.dist-info → napistu-0.4.1.dist-info}/RECORD +39 -34
- tests/conftest.py +102 -1
- tests/test_network_data_handling.py +5 -2
- tests/test_network_net_create.py +92 -201
- tests/test_network_net_create_utils.py +538 -0
- tests/test_network_ng_core.py +19 -0
- tests/test_network_ng_utils.py +1 -1
- tests/test_network_precompute.py +4 -3
- tests/test_ontologies_id_tables.py +198 -0
- tests/test_rpy2_callr.py +0 -1
- tests/test_rpy2_init.py +0 -1
- tests/test_sbml_dfs_core.py +30 -19
- tests/test_sbml_dfs_utils.py +115 -0
- tests/test_utils.py +26 -2
- {napistu-0.3.7.dist-info → napistu-0.4.1.dist-info}/WHEEL +0 -0
- {napistu-0.3.7.dist-info → napistu-0.4.1.dist-info}/entry_points.txt +0 -0
- {napistu-0.3.7.dist-info → napistu-0.4.1.dist-info}/licenses/LICENSE +0 -0
- {napistu-0.3.7.dist-info → napistu-0.4.1.dist-info}/top_level.txt +0 -0
napistu/utils.py
CHANGED
@@ -7,24 +7,24 @@ import logging
|
|
7
7
|
import os
|
8
8
|
import pickle
|
9
9
|
import re
|
10
|
+
import requests
|
10
11
|
import shutil
|
11
12
|
import urllib.request as request
|
12
13
|
import zipfile
|
13
14
|
from contextlib import closing
|
14
15
|
from itertools import starmap
|
15
16
|
from textwrap import fill
|
16
|
-
from typing import Any
|
17
|
-
from typing import Union
|
18
|
-
from typing import Optional
|
19
|
-
from typing import List
|
17
|
+
from typing import Any, List, Optional, Union
|
20
18
|
from urllib.parse import urlparse
|
21
|
-
import
|
19
|
+
from pathlib import Path
|
22
20
|
from requests.adapters import HTTPAdapter
|
23
21
|
from requests.adapters import Retry
|
24
22
|
|
25
23
|
import igraph as ig
|
26
24
|
import numpy as np
|
27
25
|
import pandas as pd
|
26
|
+
import pyarrow as pa
|
27
|
+
import pyarrow.parquet as pq
|
28
28
|
from fs import open_fs
|
29
29
|
from fs.copy import copy_dir
|
30
30
|
from fs.copy import copy_file
|
@@ -604,6 +604,81 @@ def load_json(uri: str) -> Any:
|
|
604
604
|
return json.loads(txt)
|
605
605
|
|
606
606
|
|
607
|
+
def save_parquet(
|
608
|
+
df: pd.DataFrame, uri: Union[str, Path], compression: str = "snappy"
|
609
|
+
) -> None:
|
610
|
+
"""
|
611
|
+
Write a DataFrame to a single Parquet file.
|
612
|
+
|
613
|
+
Parameters
|
614
|
+
----------
|
615
|
+
df : pd.DataFrame
|
616
|
+
The DataFrame to save
|
617
|
+
uri : Union[str, Path]
|
618
|
+
Path where to save the Parquet file. Can be a local path or a GCS URI.
|
619
|
+
Recommended extensions: .parquet or .pq
|
620
|
+
compression : str, default 'snappy'
|
621
|
+
Compression algorithm. Options: 'snappy', 'gzip', 'brotli', 'lz4', 'zstd'
|
622
|
+
|
623
|
+
Raises
|
624
|
+
------
|
625
|
+
OSError
|
626
|
+
If the file cannot be written to (permission issues, etc.)
|
627
|
+
"""
|
628
|
+
|
629
|
+
uri_str = str(uri)
|
630
|
+
|
631
|
+
# Warn about non-standard extensions
|
632
|
+
if not any(uri_str.endswith(ext) for ext in [".parquet", ".pq"]):
|
633
|
+
logger.warning(
|
634
|
+
f"File '{uri_str}' doesn't have a standard Parquet extension (.parquet or .pq)"
|
635
|
+
)
|
636
|
+
|
637
|
+
target_base, target_path = get_target_base_and_path(uri_str)
|
638
|
+
|
639
|
+
with open_fs(target_base, create=True) as target_fs:
|
640
|
+
with target_fs.openbin(target_path, "w") as f:
|
641
|
+
# Convert to Arrow table and write as single file
|
642
|
+
table = pa.Table.from_pandas(df)
|
643
|
+
pq.write_table(
|
644
|
+
table,
|
645
|
+
f,
|
646
|
+
compression=compression,
|
647
|
+
use_dictionary=True, # Efficient for repeated values
|
648
|
+
write_statistics=True, # Enables query optimization
|
649
|
+
)
|
650
|
+
|
651
|
+
|
652
|
+
def load_parquet(uri: Union[str, Path]) -> pd.DataFrame:
|
653
|
+
"""
|
654
|
+
Read a DataFrame from a Parquet file.
|
655
|
+
|
656
|
+
Parameters
|
657
|
+
----------
|
658
|
+
uri : Union[str, Path]
|
659
|
+
Path to the Parquet file to load
|
660
|
+
|
661
|
+
Returns
|
662
|
+
-------
|
663
|
+
pd.DataFrame
|
664
|
+
The DataFrame loaded from the Parquet file
|
665
|
+
|
666
|
+
Raises
|
667
|
+
------
|
668
|
+
FileNotFoundError
|
669
|
+
If the specified file does not exist
|
670
|
+
"""
|
671
|
+
try:
|
672
|
+
target_base, target_path = get_target_base_and_path(str(uri))
|
673
|
+
|
674
|
+
with open_fs(target_base) as target_fs:
|
675
|
+
with target_fs.openbin(target_path, "r") as f:
|
676
|
+
return pd.read_parquet(f, engine="pyarrow")
|
677
|
+
|
678
|
+
except ResourceNotFound as e:
|
679
|
+
raise FileNotFoundError(f"File not found: {uri}") from e
|
680
|
+
|
681
|
+
|
607
682
|
def extract_regex_search(regex: str, query: str, index_value: int = 0) -> str:
|
608
683
|
"""
|
609
684
|
Match an identifier substring and otherwise throw an error
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: napistu
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.4.1
|
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
|
@@ -27,6 +27,7 @@ Requires-Dist: mygene<4.0.0,>=3.0.0
|
|
27
27
|
Requires-Dist: numpy<3.0.0,>=1.24.0
|
28
28
|
Requires-Dist: pandas<3.0.0,>=1.5.0
|
29
29
|
Requires-Dist: pydantic<3.0.0,>=2.0.0
|
30
|
+
Requires-Dist: pyarrow<20.0.0,>=15.0.0
|
30
31
|
Requires-Dist: python-libsbml
|
31
32
|
Requires-Dist: requests>=2.25.0
|
32
33
|
Requires-Dist: scipy<2.0.0,>=1.10.0
|
@@ -51,7 +52,6 @@ Requires-Dist: markdown>=3.4.0; extra == "mcp"
|
|
51
52
|
Requires-Dist: jupyter-client>=7.0.0; extra == "mcp"
|
52
53
|
Requires-Dist: nbformat>=5.0.0; extra == "mcp"
|
53
54
|
Provides-Extra: rpy2
|
54
|
-
Requires-Dist: pyarrow<19.0.0,>=15.0.0; extra == "rpy2"
|
55
55
|
Requires-Dist: rpy2<4.0.0,>=3.5.0; extra == "rpy2"
|
56
56
|
Requires-Dist: rpy2-arrow<1.0.0,>=0.1.0; extra == "rpy2"
|
57
57
|
Provides-Extra: scverse
|
@@ -61,7 +61,12 @@ Dynamic: license-file
|
|
61
61
|
|
62
62
|
# Napistu Python Library
|
63
63
|
|
64
|
+
[](https://badge.fury.io/py/napistu)
|
64
65
|
[](https://napistu.readthedocs.io/en/latest/?badge=latest)
|
66
|
+
[](https://github.com/napistu/napistu-py/actions/workflows/ci.yml)
|
67
|
+
[](https://github.com/napistu/napistu-py/actions/workflows/release.yml)
|
68
|
+
[](https://github.com/napistu/napistu-py/actions/workflows/deploy.yml)
|
69
|
+
[](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,18 +1,18 @@
|
|
1
1
|
napistu/__init__.py,sha256=dFXAhIqlTLJMwowS4BUDT08-Vy3Q0u1L0CMCErSZT1Y,239
|
2
|
-
napistu/__main__.py,sha256=
|
2
|
+
napistu/__main__.py,sha256=xwlbh_0Ig3a-yG6BIJRiDPSN9R2HnX2pEBvlodlO6h4,29015
|
3
3
|
napistu/consensus.py,sha256=xWXiqIM6ot-SSPJZXTrVpohbINSCkZXBtRi-5REfk_g,69897
|
4
|
-
napistu/constants.py,sha256=
|
4
|
+
napistu/constants.py,sha256=8sp1l0cxu2rsnCrWBEEwhcBKvDtc4u0D0f_72zILLW0,13427
|
5
5
|
napistu/identifiers.py,sha256=e2-nTVzr5AINa0y1ER9218bKXyF2kAeJ9At22S4Z00o,33914
|
6
6
|
napistu/indices.py,sha256=Zjg3gE0JQ3T879lCPazYg-WXVE6hvcAr713ZKpJ32rk,9830
|
7
|
-
napistu/sbml_dfs_core.py,sha256=
|
8
|
-
napistu/sbml_dfs_utils.py,sha256=
|
7
|
+
napistu/sbml_dfs_core.py,sha256=s0OyoHs-AjOcbZu1d3KNkW_PI7Rxbhu5ZLpfQeO4iY8,72639
|
8
|
+
napistu/sbml_dfs_utils.py,sha256=w5dFcJFDKnKDK9jxPOCuCW8IccxdXmyNmP9vCUhVdf8,46184
|
9
9
|
napistu/source.py,sha256=UGpN70bqbC9gnKmM0ivSdQYim9hfzgABeXoQKzRr9oU,13646
|
10
|
-
napistu/utils.py,sha256=
|
10
|
+
napistu/utils.py,sha256=PEAsLn7VGN8JlNJQcAMYpjF1gr2mWmb5IqBsypP9hi0,35768
|
11
11
|
napistu/context/__init__.py,sha256=LQBEqipcHKK0E5UlDEg1ct-ymCs93IlUrUaH8BCevf0,242
|
12
12
|
napistu/context/discretize.py,sha256=Qq7zg46F_I-PvQIT2_pEDQV7YEtUQCxKoRvT5Gu9QsE,15052
|
13
13
|
napistu/context/filtering.py,sha256=l1oq-43ysSGqU9VmhTOO_pYT4DSMf20yxvktPC1MI0I,13696
|
14
14
|
napistu/gcs/__init__.py,sha256=dFXAhIqlTLJMwowS4BUDT08-Vy3Q0u1L0CMCErSZT1Y,239
|
15
|
-
napistu/gcs/constants.py,sha256=
|
15
|
+
napistu/gcs/constants.py,sha256=5hLp1pL7SHEiscLNKcdI4IeOP4vUaasBCIHJrEedl0o,2909
|
16
16
|
napistu/gcs/downloads.py,sha256=SvGv9WYr_Vt3guzyz1QiAuBndeKPTBtWSFLj1-QbLf4,6348
|
17
17
|
napistu/gcs/utils.py,sha256=eLSsvewWJdCguyj2k0ozUGP5BTemaE1PZg41Z3aY5kM,571
|
18
18
|
napistu/ingestion/__init__.py,sha256=dFXAhIqlTLJMwowS4BUDT08-Vy3Q0u1L0CMCErSZT1Y,239
|
@@ -21,7 +21,7 @@ napistu/ingestion/constants.py,sha256=9UP47VImZ11q0kz17N3EJg2155USqLewwNWyKpA-cb
|
|
21
21
|
napistu/ingestion/gtex.py,sha256=X0hSC1yrpf4xSJWFhpeNcnHwJzKDII2MvjfUqYA0JN8,3720
|
22
22
|
napistu/ingestion/hpa.py,sha256=R27ExrryKQ4Crxv9ATXmBJCa-yd01TMOrDjkeBhIQac,5054
|
23
23
|
napistu/ingestion/identifiers_etl.py,sha256=6ppDUA6lEZurdmVbiFLOUzphYbr-hndMhtqsQnq_yAc,5009
|
24
|
-
napistu/ingestion/napistu_edgelist.py,sha256=
|
24
|
+
napistu/ingestion/napistu_edgelist.py,sha256=4RLXsoIk_-Atu-Nqme_t1JpEpBET26VIY2Y_Hcd3sMw,3580
|
25
25
|
napistu/ingestion/obo.py,sha256=AQkIPWbjA464Lma0tx91JucWkIwLjC7Jgv5VHGRTDkE,9601
|
26
26
|
napistu/ingestion/psi_mi.py,sha256=5eJjm7XWogL9oTyGqR52kntHClLwLsTePKqCvUGyi-w,10111
|
27
27
|
napistu/ingestion/reactome.py,sha256=Hn9X-vDp4o_HK-OtaQvel3vJeZ8_TC1-4N2rruK9Oks,7099
|
@@ -31,7 +31,7 @@ napistu/ingestion/trrust.py,sha256=_6hIS48O3tRpMxX-FdIC57ekhCcV7J4owUzoaYnRqZo,9
|
|
31
31
|
napistu/ingestion/yeast.py,sha256=7XwdkmgOnG1MYauKSk9nSK6fHemDrtXEPcS4ebs1_so,5268
|
32
32
|
napistu/matching/__init__.py,sha256=dFXAhIqlTLJMwowS4BUDT08-Vy3Q0u1L0CMCErSZT1Y,239
|
33
33
|
napistu/matching/constants.py,sha256=j4XSOE9Bpma9F6apVJ1LijKOUPgRk8Geo_u_rvNtpSU,610
|
34
|
-
napistu/matching/interactions.py,sha256=
|
34
|
+
napistu/matching/interactions.py,sha256=NatrboXH0B7Jc2pics6mgmnVvp_bXFGBhVsYE1a-JKo,18992
|
35
35
|
napistu/matching/mount.py,sha256=8JEtiDIy7qdjWyDAs0vuVwEQkpwRf5ah4xMLZ4jKHag,19428
|
36
36
|
napistu/matching/species.py,sha256=U8OfzmDN9dMwemdnzQdV19bWfjY8MLJ9-wf83siK1bM,18888
|
37
37
|
napistu/mcp/__init__.py,sha256=EmtcdtYyfhXdxxPB5cY_pshXnFv6XZ5CtRU0JMHn3aQ,2074
|
@@ -54,24 +54,26 @@ napistu/mcp/utils.py,sha256=WB4c6s8aPZLgi_Wvhhq0DE8Cnz2QGff0V8hrF1feVRg,1296
|
|
54
54
|
napistu/modify/__init__.py,sha256=dFXAhIqlTLJMwowS4BUDT08-Vy3Q0u1L0CMCErSZT1Y,239
|
55
55
|
napistu/modify/constants.py,sha256=H6K6twzPlxt0yp6QLAxIx0Tp8YzYhtKKXPdmXi5V_QQ,3689
|
56
56
|
napistu/modify/curation.py,sha256=sQeSO53ZLdn14ww2GSKkoP0vJnDpAoSWb-YDjUf5hDQ,21743
|
57
|
-
napistu/modify/gaps.py,sha256=
|
57
|
+
napistu/modify/gaps.py,sha256=CV-bdSfanhrnCIFVWfNuQJbtjvj4hsEwheKYR-Z3tNA,26844
|
58
58
|
napistu/modify/pathwayannot.py,sha256=xuBSMDFWbg_d6-Gzv0Td3Q5nnFTa-Qzic48g1b1AZtQ,48081
|
59
59
|
napistu/modify/uncompartmentalize.py,sha256=y5LkXn5x6u80dB_McfAIh88BxZGIAVFLujkP7sPNRh0,9690
|
60
60
|
napistu/network/__init__.py,sha256=dFXAhIqlTLJMwowS4BUDT08-Vy3Q0u1L0CMCErSZT1Y,239
|
61
|
-
napistu/network/constants.py,sha256=
|
62
|
-
napistu/network/data_handling.py,sha256=
|
61
|
+
napistu/network/constants.py,sha256=LPsMtbAoier9Qor9REA7UIx7vnBtDpxMbcv3yI-c-2s,6441
|
62
|
+
napistu/network/data_handling.py,sha256=KncrAKjXI3169BgVE-SnY8FkpVF60JnUwfMHtbqvsTc,14725
|
63
63
|
napistu/network/ig_utils.py,sha256=JSlf_sZtw3DiiSIiYJ2YqJFEP4hVJMwNRox2qYTA4zY,11470
|
64
|
-
napistu/network/
|
65
|
-
napistu/network/
|
66
|
-
napistu/network/
|
67
|
-
napistu/network/net_propagation.py,sha256=
|
68
|
-
napistu/network/
|
69
|
-
napistu/network/
|
70
|
-
napistu/network/
|
64
|
+
napistu/network/neighborhoods.py,sha256=g5QeGaizSfW4nNe9YZY86g8q79EQmuvSwipaNPnOVqA,56121
|
65
|
+
napistu/network/net_create.py,sha256=Ylt4osGWPfj9MSDPy67pOTmLERGtS3cStR94UaqmXes,59082
|
66
|
+
napistu/network/net_create_utils.py,sha256=zajwaz2xAij_9fEnD77SgBw_EnNAnJ8jBCmmK2rk_bA,24672
|
67
|
+
napistu/network/net_propagation.py,sha256=S70zl0W4aYu5RPf5PZh829xT1xUyeTdi3TcIaFeYMww,4924
|
68
|
+
napistu/network/ng_core.py,sha256=dGnTUKR4WtnvaYMyIHqqF55FY4mJSa7wjA2LZ4cVB6U,11720
|
69
|
+
napistu/network/ng_utils.py,sha256=c1tHXz_JcH01D5KovNQmRLTEVxpCkCe36otULq-liz8,15579
|
70
|
+
napistu/network/paths.py,sha256=r6LVKVvX7i3ctBA5r-xvHfpH5Zsd0VDHUCtin2iag20,17453
|
71
|
+
napistu/network/precompute.py,sha256=ibL0ByY7Wp5kEfIG3LUDpQKdvAeQX0DNkT_46g2YrGc,8367
|
71
72
|
napistu/ontologies/__init__.py,sha256=dFXAhIqlTLJMwowS4BUDT08-Vy3Q0u1L0CMCErSZT1Y,239
|
72
73
|
napistu/ontologies/constants.py,sha256=GyOFvezSxDK1VigATcruTKtNhjcYaid1ggulEf_HEtQ,4345
|
73
74
|
napistu/ontologies/dogma.py,sha256=VVj6NKBgNym4SdOSu8g22OohALj7cbObhIJmdY2Sfy0,8860
|
74
75
|
napistu/ontologies/genodexito.py,sha256=ZZmb7V38BmFjy9VOGdxbD3-BD5tKGl5izr0nwO_eEdA,24967
|
76
|
+
napistu/ontologies/id_tables.py,sha256=q_31eQwlkRNFzLOkJNT4Fp6ra6kkzFOByzgJu5WFh0U,8372
|
75
77
|
napistu/ontologies/mygene.py,sha256=RMFQTWsLkeYxmsOPxxmeIya2phdcUMcF5V2abaS8MVg,11109
|
76
78
|
napistu/ontologies/renaming.py,sha256=aZR5oxjeZhse026fuvFyQiKM8PVzbBT915J8AfXGv1M,7006
|
77
79
|
napistu/rpy2/__init__.py,sha256=8WzSK_tmdcbyMUtb17OmqdQqbisqIBl8OQrDsaFDeX4,8356
|
@@ -81,9 +83,9 @@ napistu/rpy2/rids.py,sha256=AfXLTfTdonfspgAHYO0Ph7jSUWv8YuyT8x3fyLfAqc8,3413
|
|
81
83
|
napistu/scverse/__init__.py,sha256=Lgxr3iMQAkTzXE9BNz93CndNP5djzerLvmHM-D0PU3I,357
|
82
84
|
napistu/scverse/constants.py,sha256=0iAkhyJUIeFGHdLLU3fCaEU1O3Oix4qAsxr3CxGTjVs,653
|
83
85
|
napistu/scverse/loading.py,sha256=jqiE71XB-wdV50GyZrauFNY0Lai4bX9Fm2Gv80VR8t8,27016
|
84
|
-
napistu-0.
|
86
|
+
napistu-0.4.1.dist-info/licenses/LICENSE,sha256=kW8wVT__JWoHjl2BbbJDAZInWa9AxzJeR_uv6-i5x1g,1063
|
85
87
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
86
|
-
tests/conftest.py,sha256=
|
88
|
+
tests/conftest.py,sha256=t-GHb0MvSsC-MyhkFpOy2K3t5fi7eaig_Rc2xEQC-t8,9678
|
87
89
|
tests/test_consensus.py,sha256=Hzfrgp4SpkRDnEMVMD3f0UInSycndB8kKzC4wDDvRas,15076
|
88
90
|
tests/test_constants.py,sha256=gJLDv7QMeeBiiupyMazj6mumk20KWvGMgm2myHMKKfc,531
|
89
91
|
tests/test_context_discretize.py,sha256=5Mr9WqwHGYMO37M1TnMmSfC64UZ73mnoCiEM2IQHVDY,1667
|
@@ -101,33 +103,36 @@ tests/test_matching_species.py,sha256=OuUWp0-X3WYXkc-g51XyOqhp4MgO8cJvUSqt8ZvqRa
|
|
101
103
|
tests/test_mcp_config.py,sha256=GTu9vywqAHTYkolywdYS_BEIW3gBzs4A4qcneMSPpRk,7007
|
102
104
|
tests/test_mcp_documentation_utils.py,sha256=OW0N2N_2IOktbYTcCWhhWz4bANi8IB60l1q3DJi8Ra4,810
|
103
105
|
tests/test_mcp_server.py,sha256=bP3PWVQsEfX6-lAgXKP32njdg__o65n2WuLvkxTTHkQ,11215
|
104
|
-
tests/test_network_data_handling.py,sha256=
|
106
|
+
tests/test_network_data_handling.py,sha256=4aS8z2AlKkVd-JhK4BQ8fjeiW8_bJ1hZ3cc71Jh7Glk,12716
|
105
107
|
tests/test_network_ig_utils.py,sha256=Buoh570mNm5pcac3Hf6f3pevCjWfBwPfKuD8IkDLg58,2120
|
106
108
|
tests/test_network_neighborhoods.py,sha256=8BV17m5X1OUd5FwasTTYUOkNYUHDPUkxOKH_VZCsyBE,631
|
107
|
-
tests/test_network_net_create.py,sha256=
|
109
|
+
tests/test_network_net_create.py,sha256=L0U91b4jVHDuC3DFo-_BUFVuv4GuSxZuLAo7r-7EJxY,12877
|
110
|
+
tests/test_network_net_create_utils.py,sha256=0J6KIh2HBc4koFsvwMaul1QRtj5x92kR9HBdDZajnAw,18971
|
108
111
|
tests/test_network_net_propagation.py,sha256=9pKkUdduWejH4iKNCJXKFzAkdNpCfrMbiUWySgI_LH4,3244
|
109
|
-
tests/
|
112
|
+
tests/test_network_ng_core.py,sha256=w-iNBTtenennJhaLFauk952pEsk7W0-Fa8lPvIRqHyY,628
|
113
|
+
tests/test_network_ng_utils.py,sha256=QVVuRnvCRfTSIlGdwQTIF9lr0wOwoc5gGeXAUY_AdgE,713
|
110
114
|
tests/test_network_paths.py,sha256=TWZnxY5bF3m6gahcxcYJGrBIawh2-_vUcec1LyPmXV8,1686
|
111
|
-
tests/test_network_precompute.py,sha256=
|
115
|
+
tests/test_network_precompute.py,sha256=zwJrKNC3s8rIrsyAQfQMYxbl8HZXUr7u09nMJ_K8jiU,9005
|
112
116
|
tests/test_ontologies_genodexito.py,sha256=6fINyUiubHZqu7qxye09DQfJXw28ZMAJc3clPb-cCoY,2298
|
117
|
+
tests/test_ontologies_id_tables.py,sha256=CpwpbmQvTc1BaVd6jbDKHAVE2etwN0vx93nC8jpnMlE,7265
|
113
118
|
tests/test_ontologies_mygene.py,sha256=VkdRcKIWmcG6V-2dpfvsBiOJN5dO-j0RqZNxtJRcyBU,1583
|
114
119
|
tests/test_ontologies_renaming.py,sha256=pawp3pV1hxW8nskWc4f2YHwMUqTilEEBD2BtpcSay5Q,3839
|
115
120
|
tests/test_pathwayannot.py,sha256=bceosccNy9tgxQei_7j7ATBSSvBSxOngJvK-mAzR_K0,3312
|
116
|
-
tests/test_rpy2_callr.py,sha256=
|
117
|
-
tests/test_rpy2_init.py,sha256=
|
121
|
+
tests/test_rpy2_callr.py,sha256=V4a-QH5krgYOQRgqzksMzIkGAFjBqKOAqgprxrH6bE0,2904
|
122
|
+
tests/test_rpy2_init.py,sha256=T3gnxC1O7XNvYM2P4018ikpPPAy-kwQLm7Erj0RfA-4,5895
|
118
123
|
tests/test_sbml.py,sha256=f25zj1NogYrmLluvBDboLameTuCiQ309433Qn3iPvhg,1483
|
119
|
-
tests/test_sbml_dfs_core.py,sha256=
|
120
|
-
tests/test_sbml_dfs_utils.py,sha256
|
124
|
+
tests/test_sbml_dfs_core.py,sha256=nnLPpZTVtCznOBohk7CX67x6sMqktJWt-sZMWQKoaDs,26521
|
125
|
+
tests/test_sbml_dfs_utils.py,sha256=gWIhzUEtQlOR9c1TiCyhlSAELmWnBSncn6vCEqH5hl0,11029
|
121
126
|
tests/test_sbo.py,sha256=x_PENFaXYsrZIzOZu9cj_Wrej7i7SNGxgBYYvcigLs0,308
|
122
127
|
tests/test_scverse_loading.py,sha256=bnU1lQSYYWhOAs0IIBoi4ZohqPokDQJ0n_rtkAfEyMU,29948
|
123
128
|
tests/test_set_coverage.py,sha256=J-6m6LuOjcQa9pxRuWglSfJk4Ltm7kt_eOrn_Q-7P6Q,1604
|
124
129
|
tests/test_source.py,sha256=hT0IlpexR5zP0OhWl5BBaho9d1aCYQlFZLwRIRRnw_Y,1969
|
125
130
|
tests/test_uncompartmentalize.py,sha256=nAk5kfAVLU9a2VWe2x2HYVcKqj-EnwmwddERIPRax8c,1289
|
126
|
-
tests/test_utils.py,sha256=
|
131
|
+
tests/test_utils.py,sha256=qPSpV-Q9b6vmdycgaDmQqtcvzKnAVnN9j5xJ9x-T6bg,23959
|
127
132
|
tests/utils.py,sha256=SoWQ_5roJteFGcMaOeEiQ5ucwq3Z2Fa3AAs9iXHTsJY,749
|
128
133
|
tests/test_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
129
|
-
napistu-0.
|
130
|
-
napistu-0.
|
131
|
-
napistu-0.
|
132
|
-
napistu-0.
|
133
|
-
napistu-0.
|
134
|
+
napistu-0.4.1.dist-info/METADATA,sha256=zl_710wCsatB3lKZAgHba-MLEOPSDOyrxs3b5FB6toA,4078
|
135
|
+
napistu-0.4.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
136
|
+
napistu-0.4.1.dist-info/entry_points.txt,sha256=_QnaPOvJNA3IltxmZgWIiBoen-L1bPYX18YQfC7oJgQ,41
|
137
|
+
napistu-0.4.1.dist-info/top_level.txt,sha256=Gpvk0a_PjrtqhYcQ9IDr3zR5LqpZ-uIHidQMIpjlvhY,14
|
138
|
+
napistu-0.4.1.dist-info/RECORD,,
|
tests/conftest.py
CHANGED
@@ -17,7 +17,7 @@ from napistu.sbml_dfs_core import SBML_dfs
|
|
17
17
|
from napistu.source import Source
|
18
18
|
from napistu.ingestion.sbml import SBML
|
19
19
|
from napistu.network.net_create import process_napistu_graph
|
20
|
-
from napistu.constants import SBML_DFS
|
20
|
+
from napistu.constants import SBML_DFS, MINI_SBO_FROM_NAME, SBOTERM_NAMES
|
21
21
|
|
22
22
|
|
23
23
|
@fixture
|
@@ -139,6 +139,107 @@ def napistu_graph_undirected(sbml_dfs):
|
|
139
139
|
)
|
140
140
|
|
141
141
|
|
142
|
+
@pytest.fixture
|
143
|
+
def reaction_species_examples():
|
144
|
+
"""
|
145
|
+
Pytest fixture providing a dictionary of example reaction species DataFrames for various test cases.
|
146
|
+
"""
|
147
|
+
|
148
|
+
d = dict()
|
149
|
+
d["valid_interactor"] = pd.DataFrame(
|
150
|
+
{
|
151
|
+
SBML_DFS.SBO_TERM: [
|
152
|
+
MINI_SBO_FROM_NAME[SBOTERM_NAMES.INTERACTOR],
|
153
|
+
MINI_SBO_FROM_NAME[SBOTERM_NAMES.INTERACTOR],
|
154
|
+
],
|
155
|
+
SBML_DFS.SC_ID: ["sc1", "sc2"],
|
156
|
+
SBML_DFS.STOICHIOMETRY: [0, 0],
|
157
|
+
}
|
158
|
+
).set_index(SBML_DFS.SBO_TERM)
|
159
|
+
|
160
|
+
d["invalid_interactor"] = pd.DataFrame(
|
161
|
+
{
|
162
|
+
SBML_DFS.SBO_TERM: [
|
163
|
+
MINI_SBO_FROM_NAME[SBOTERM_NAMES.INTERACTOR],
|
164
|
+
MINI_SBO_FROM_NAME[SBOTERM_NAMES.PRODUCT],
|
165
|
+
],
|
166
|
+
SBML_DFS.SC_ID: ["sc1", "sc2"],
|
167
|
+
SBML_DFS.STOICHIOMETRY: [0, 0],
|
168
|
+
}
|
169
|
+
).set_index(SBML_DFS.SBO_TERM)
|
170
|
+
|
171
|
+
d["sub_and_prod"] = pd.DataFrame(
|
172
|
+
{
|
173
|
+
SBML_DFS.SBO_TERM: [
|
174
|
+
MINI_SBO_FROM_NAME[SBOTERM_NAMES.REACTANT],
|
175
|
+
MINI_SBO_FROM_NAME[SBOTERM_NAMES.PRODUCT],
|
176
|
+
],
|
177
|
+
SBML_DFS.SC_ID: ["sub", "prod"],
|
178
|
+
SBML_DFS.STOICHIOMETRY: [-1, 1],
|
179
|
+
}
|
180
|
+
).set_index(SBML_DFS.SBO_TERM)
|
181
|
+
|
182
|
+
d["stimulator"] = pd.DataFrame(
|
183
|
+
{
|
184
|
+
SBML_DFS.SBO_TERM: [
|
185
|
+
MINI_SBO_FROM_NAME[SBOTERM_NAMES.REACTANT],
|
186
|
+
MINI_SBO_FROM_NAME[SBOTERM_NAMES.PRODUCT],
|
187
|
+
MINI_SBO_FROM_NAME[SBOTERM_NAMES.STIMULATOR],
|
188
|
+
],
|
189
|
+
SBML_DFS.SC_ID: ["sub", "prod", "stim"],
|
190
|
+
SBML_DFS.STOICHIOMETRY: [-1, 1, 0],
|
191
|
+
}
|
192
|
+
).set_index(SBML_DFS.SBO_TERM)
|
193
|
+
|
194
|
+
d["all_entities"] = pd.DataFrame(
|
195
|
+
{
|
196
|
+
SBML_DFS.SBO_TERM: [
|
197
|
+
MINI_SBO_FROM_NAME[SBOTERM_NAMES.REACTANT],
|
198
|
+
MINI_SBO_FROM_NAME[SBOTERM_NAMES.PRODUCT],
|
199
|
+
MINI_SBO_FROM_NAME[SBOTERM_NAMES.STIMULATOR],
|
200
|
+
MINI_SBO_FROM_NAME[SBOTERM_NAMES.CATALYST],
|
201
|
+
],
|
202
|
+
SBML_DFS.SC_ID: ["sub", "prod", "stim", "cat"],
|
203
|
+
SBML_DFS.STOICHIOMETRY: [-1, 1, 0, 0],
|
204
|
+
}
|
205
|
+
).set_index(SBML_DFS.SBO_TERM)
|
206
|
+
|
207
|
+
d["no_substrate"] = pd.DataFrame(
|
208
|
+
{
|
209
|
+
SBML_DFS.SBO_TERM: [
|
210
|
+
MINI_SBO_FROM_NAME[SBOTERM_NAMES.PRODUCT],
|
211
|
+
MINI_SBO_FROM_NAME[SBOTERM_NAMES.STIMULATOR],
|
212
|
+
MINI_SBO_FROM_NAME[SBOTERM_NAMES.STIMULATOR],
|
213
|
+
MINI_SBO_FROM_NAME[SBOTERM_NAMES.INHIBITOR],
|
214
|
+
MINI_SBO_FROM_NAME[SBOTERM_NAMES.CATALYST],
|
215
|
+
],
|
216
|
+
SBML_DFS.SC_ID: ["prod", "stim1", "stim2", "inh", "cat"],
|
217
|
+
SBML_DFS.STOICHIOMETRY: [1, 0, 0, 0, 0],
|
218
|
+
}
|
219
|
+
).set_index(SBML_DFS.SBO_TERM)
|
220
|
+
|
221
|
+
d["single_species"] = pd.DataFrame(
|
222
|
+
{
|
223
|
+
SBML_DFS.SBO_TERM: [MINI_SBO_FROM_NAME[SBOTERM_NAMES.PRODUCT]],
|
224
|
+
SBML_DFS.SC_ID: ["lone_prod"],
|
225
|
+
SBML_DFS.STOICHIOMETRY: [1],
|
226
|
+
}
|
227
|
+
).set_index(SBML_DFS.SBO_TERM)
|
228
|
+
|
229
|
+
d["activator_and_inhibitor_only"] = pd.DataFrame(
|
230
|
+
{
|
231
|
+
SBML_DFS.SBO_TERM: [
|
232
|
+
MINI_SBO_FROM_NAME[SBOTERM_NAMES.STIMULATOR], # activator
|
233
|
+
MINI_SBO_FROM_NAME[SBOTERM_NAMES.INHIBITOR], # inhibitor
|
234
|
+
],
|
235
|
+
SBML_DFS.SC_ID: ["act", "inh"],
|
236
|
+
SBML_DFS.STOICHIOMETRY: [0, 0],
|
237
|
+
}
|
238
|
+
).set_index(SBML_DFS.SBO_TERM)
|
239
|
+
|
240
|
+
return d
|
241
|
+
|
242
|
+
|
142
243
|
# Define custom markers for platforms
|
143
244
|
def pytest_configure(config):
|
144
245
|
config.addinivalue_line("markers", "skip_on_windows: mark test to skip on Windows")
|
@@ -6,6 +6,7 @@ import igraph as ig
|
|
6
6
|
import pandas as pd
|
7
7
|
|
8
8
|
from napistu.network import data_handling, net_create
|
9
|
+
from napistu.network.constants import GRAPH_WIRING_APPROACHES
|
9
10
|
|
10
11
|
|
11
12
|
# Fixtures
|
@@ -226,7 +227,7 @@ def test_add_results_table_to_graph(sbml_dfs_glucose_metabolism):
|
|
226
227
|
"""Test adding results table to graph."""
|
227
228
|
# Create a test graph using create_napistu_graph
|
228
229
|
graph = net_create.create_napistu_graph(
|
229
|
-
sbml_dfs_glucose_metabolism, directed=True,
|
230
|
+
sbml_dfs_glucose_metabolism, directed=True, wiring_approach="regulatory"
|
230
231
|
)
|
231
232
|
|
232
233
|
# Add some test data to sbml_dfs
|
@@ -300,7 +301,9 @@ def test_add_graph_species_attribute(sbml_dfs_glucose_metabolism):
|
|
300
301
|
"""Test adding species attributes to graph."""
|
301
302
|
# Create a test graph using create_napistu_graph
|
302
303
|
graph = net_create.create_napistu_graph(
|
303
|
-
sbml_dfs_glucose_metabolism,
|
304
|
+
sbml_dfs_glucose_metabolism,
|
305
|
+
directed=True,
|
306
|
+
wiring_approach=GRAPH_WIRING_APPROACHES.REGULATORY,
|
304
307
|
)
|
305
308
|
|
306
309
|
# Add test data to sbml_dfs
|