nexusim 0.1.0b2__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 (39) hide show
  1. nexusim-0.1.0b2/LICENSE +21 -0
  2. nexusim-0.1.0b2/PKG-INFO +133 -0
  3. nexusim-0.1.0b2/README.md +107 -0
  4. nexusim-0.1.0b2/pyproject.toml +77 -0
  5. nexusim-0.1.0b2/setup.cfg +4 -0
  6. nexusim-0.1.0b2/src/nexus/simulator/__init__.py +0 -0
  7. nexusim-0.1.0b2/src/nexus/simulator/grn/grnSim.py +792 -0
  8. nexusim-0.1.0b2/src/nexus/simulator/grn/grnSim_v1.py +382 -0
  9. nexusim-0.1.0b2/src/nexus/simulator/grn/logger/grnLogger.py +151 -0
  10. nexusim-0.1.0b2/src/nexus/simulator/intervention/intervention.py +113 -0
  11. nexusim-0.1.0b2/src/nexus/simulator/noise_models/wiener_noise.py +31 -0
  12. nexusim-0.1.0b2/src/nexus/simulator/run_linked_sim.py +129 -0
  13. nexusim-0.1.0b2/src/nexus/simulator/run_sim.py +52 -0
  14. nexusim-0.1.0b2/src/nexus/simulator/spatial/__init__.py +0 -0
  15. nexusim-0.1.0b2/src/nexus/simulator/spatial/field/freeField.py +53 -0
  16. nexusim-0.1.0b2/src/nexus/simulator/spatial/field/gridField.py +53 -0
  17. nexusim-0.1.0b2/src/nexus/simulator/spatial/layers/chemical.py +120 -0
  18. nexusim-0.1.0b2/src/nexus/simulator/spatial/layers/force.py +119 -0
  19. nexusim-0.1.0b2/src/nexus/simulator/spatial/logger/mesh_logger.py +432 -0
  20. nexusim-0.1.0b2/src/nexus/simulator/spatial/logger/spatial_logger.py +126 -0
  21. nexusim-0.1.0b2/src/nexus/simulator/spatial/mesh/clustering_field.py +47 -0
  22. nexusim-0.1.0b2/src/nexus/simulator/spatial/mesh/mesh.py +904 -0
  23. nexusim-0.1.0b2/src/nexus/simulator/spatial/models/chemical.py +20 -0
  24. nexusim-0.1.0b2/src/nexus/simulator/spatial/models/reaction.py +66 -0
  25. nexusim-0.1.0b2/src/nexus/simulator/spatial/spatialSim.py +103 -0
  26. nexusim-0.1.0b2/src/nexus/simulator/spatial/utils/random_generators.py +35 -0
  27. nexusim-0.1.0b2/src/nexus/simulator/spatial/utils/verify_data.py +145 -0
  28. nexusim-0.1.0b2/src/nexus/simulator/utils/__init__.py +0 -0
  29. nexusim-0.1.0b2/src/nexus/simulator/utils/file_manager.py +12 -0
  30. nexusim-0.1.0b2/src/nexus/simulator/utils/read_network.py +130 -0
  31. nexusim-0.1.0b2/src/nexus/simulator/utils/verify_network.py +172 -0
  32. nexusim-0.1.0b2/src/nexus/tests/test_grn.py +119 -0
  33. nexusim-0.1.0b2/src/nexus/tests/test_intervention.py +83 -0
  34. nexusim-0.1.0b2/src/nexus/tests/test_spatial_vec.py +101 -0
  35. nexusim-0.1.0b2/src/nexusim.egg-info/PKG-INFO +133 -0
  36. nexusim-0.1.0b2/src/nexusim.egg-info/SOURCES.txt +37 -0
  37. nexusim-0.1.0b2/src/nexusim.egg-info/dependency_links.txt +1 -0
  38. nexusim-0.1.0b2/src/nexusim.egg-info/requires.txt +15 -0
  39. nexusim-0.1.0b2/src/nexusim.egg-info/top_level.txt +1 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Amogh Singh
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,133 @@
1
+ Metadata-Version: 2.4
2
+ Name: nexusim
3
+ Version: 0.1.0b2
4
+ Summary: JAX-accelerated multi-scale simulator for biological control and causal discovery
5
+ License-Expression: MIT
6
+ Keywords: biology,simulator,jax,causal-discovery,multi-scale
7
+ Requires-Python: >=3.10
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: fastexcel>=0.16.0
11
+ Requires-Dist: hydra-core>=1.3.2
12
+ Requires-Dist: imageio>=2.37.2
13
+ Requires-Dist: jax>=0.6.2
14
+ Requires-Dist: marimo>=0.17.0
15
+ Requires-Dist: matplotlib>=3.10.7
16
+ Requires-Dist: msgspec>=0.20.0
17
+ Requires-Dist: networkx>=3.4.2
18
+ Requires-Dist: numpy>=2.2.6
19
+ Requires-Dist: optax>=0.2.6
20
+ Requires-Dist: polars>=1.34.0
21
+ Requires-Dist: pyyaml>=6.0.3
22
+ Requires-Dist: requests>=2.32.5
23
+ Requires-Dist: tiledb>=0.35.2
24
+ Requires-Dist: tqdm>=4.67.1
25
+ Dynamic: license-file
26
+
27
+ # Nexus
28
+
29
+ Nexus is a JAX-accelerated multi-scale simulator for biological control and causal discovery, capable of generating biologically-realistic data.
30
+
31
+ ## Table of contents
32
+
33
+ - [Setup](#setup)
34
+ - [Code Structure](#code-structure)
35
+ - [Usage](#usage)
36
+ - [Visualization](#visualization)
37
+
38
+ ## Setup
39
+
40
+ Install [uv](https://docs.astral.sh/uv/getting-started/installation/) package manager before running the setup
41
+
42
+ ```bash
43
+ # Install using pip
44
+ pip install nexusim
45
+
46
+ # (OR)
47
+ # Clone repo and build the package in uv
48
+ ## Clone repository and
49
+ git clone https://github.com/AmoghSingh25/GeneProtSim.git
50
+
51
+ ## Create venv and download packages
52
+ uv sync
53
+ ```
54
+
55
+ ## Code Structure
56
+
57
+ - `src/nexus/`
58
+ - `simulator/` - Core simulation engine
59
+ - `dynamics/` - Mathematical models for simulator dynamics
60
+ - `noise_models/` - Noise processes, random seeds
61
+ - `utils/` - Utility functions for simulator
62
+ - `grn/` - Code and logs of the GRN simulator
63
+ - `spatial/` - Code, model definitions and logs of the Spatial Sim
64
+ - `spatial_vec/` - Code, model definitions and logs of the vectorized version of Spatial Sim
65
+ - `run_sim.py` - Run the GRN and Spatial Sim
66
+ - `run_linked_sim.py` - Run the GRN and Spatial Sim together, allowing diffusion between cells and fields
67
+ - `causal/` - Causal discovery and inference modules
68
+ - `identification/` - Algorithms for structure/parameter learning
69
+ - `evaluation/` - Evaluation scripts
70
+ - `experiments/` - Scripts for running experiments
71
+ - `dashboard/` - Plotting, analysis, dashboards
72
+ - `web/` - Next.JS website for visualization of simulator outputs
73
+ - `retrieve_logger_api.py` - Flask API to serve data to the website
74
+ - `tests/` - Unit & integration tests
75
+ - `configs/` - Config files for runs
76
+ - `notebooks/` - Exploratory analyses and demos
77
+ - `docs/` - Documentation
78
+ - `config_desc.md` - Configuration parameters and their description
79
+ - `intervention_api.md` - Working of intervention API and its configuration
80
+ - `simulator.md` - Working of the GRN simulator
81
+ - `spatial_simulator.md` - Working of the spatial simulator
82
+ - `examples/` - Examples scripts
83
+ - `marimo_example.py` - Marimo notebook containing example scripts
84
+ - `ipynb_example.py` - IPYNB notebook containing example scripts
85
+ - `pyproject.toml` - For package/dependency management
86
+ - `README.md`
87
+
88
+ ## Usage
89
+
90
+ A short code snippet for using the simulator is given below.
91
+ ```py
92
+ from nexus.simulator.grn.grnSim import GRNSim
93
+ from nexus.simulator.spatial.spatialSim import SpatialSim
94
+ from hydra import initialize_config_dir, compose
95
+
96
+ def get_config(config_name="test_config"): # Get config from Hydra config file
97
+ conf_path = os.path.join(os.getcwd(), "configs")
98
+ with initialize_config_dir(version_base=None, config_dir=conf_path):
99
+ cfg = compose(config_name=config_name)
100
+ return cfg
101
+
102
+ cfg = get_config()
103
+
104
+ sim = GRNSim(cfg.grn)
105
+ sim.run_sim()
106
+
107
+ spatial_sim = SpatialSim(cfg.spatial)
108
+ spatial_sim.run_sim()
109
+ ```
110
+
111
+ Examples for running the simulator are given in a [Marimo notebook](examples/marimo_example.py) and a [IPYNB notebook](examples/ipynb_example.ipynb). The simulator uses Hydra configs for the simulation parameters and the description of the config files are given in [Config Description](docs/config_desc.md).
112
+
113
+ ## Intervention API
114
+
115
+ The simulator also supports interventions on the parameters that allows for generating interventional data for causal discovery and analysis. Guidance on using interventions is given in the [Intervention Doc](docs/intevention_api.md).
116
+
117
+ ## Visualization
118
+
119
+ The visualization can be run by the running the two commands in seperate terminal windows.
120
+
121
+ ```bash
122
+ ## Runs the API for fetching the data from TileDB
123
+ uv run src/dashboard/retrieve_logger_api.py
124
+
125
+ ## Runs the website to visualize the data
126
+ cd dashboard/web/
127
+ npm install # If the packages are not installed
128
+ npm run dev
129
+ ```
130
+
131
+ After running these two commands, open the link `http://localhost:3000` and select a log file from the dropdown. This log file should be present inside the relative directory `logs/`.
132
+
133
+ Further instructions on using the dashboard is given in [README](dashboard/web/README.md)
@@ -0,0 +1,107 @@
1
+ # Nexus
2
+
3
+ Nexus is a JAX-accelerated multi-scale simulator for biological control and causal discovery, capable of generating biologically-realistic data.
4
+
5
+ ## Table of contents
6
+
7
+ - [Setup](#setup)
8
+ - [Code Structure](#code-structure)
9
+ - [Usage](#usage)
10
+ - [Visualization](#visualization)
11
+
12
+ ## Setup
13
+
14
+ Install [uv](https://docs.astral.sh/uv/getting-started/installation/) package manager before running the setup
15
+
16
+ ```bash
17
+ # Install using pip
18
+ pip install nexusim
19
+
20
+ # (OR)
21
+ # Clone repo and build the package in uv
22
+ ## Clone repository and
23
+ git clone https://github.com/AmoghSingh25/GeneProtSim.git
24
+
25
+ ## Create venv and download packages
26
+ uv sync
27
+ ```
28
+
29
+ ## Code Structure
30
+
31
+ - `src/nexus/`
32
+ - `simulator/` - Core simulation engine
33
+ - `dynamics/` - Mathematical models for simulator dynamics
34
+ - `noise_models/` - Noise processes, random seeds
35
+ - `utils/` - Utility functions for simulator
36
+ - `grn/` - Code and logs of the GRN simulator
37
+ - `spatial/` - Code, model definitions and logs of the Spatial Sim
38
+ - `spatial_vec/` - Code, model definitions and logs of the vectorized version of Spatial Sim
39
+ - `run_sim.py` - Run the GRN and Spatial Sim
40
+ - `run_linked_sim.py` - Run the GRN and Spatial Sim together, allowing diffusion between cells and fields
41
+ - `causal/` - Causal discovery and inference modules
42
+ - `identification/` - Algorithms for structure/parameter learning
43
+ - `evaluation/` - Evaluation scripts
44
+ - `experiments/` - Scripts for running experiments
45
+ - `dashboard/` - Plotting, analysis, dashboards
46
+ - `web/` - Next.JS website for visualization of simulator outputs
47
+ - `retrieve_logger_api.py` - Flask API to serve data to the website
48
+ - `tests/` - Unit & integration tests
49
+ - `configs/` - Config files for runs
50
+ - `notebooks/` - Exploratory analyses and demos
51
+ - `docs/` - Documentation
52
+ - `config_desc.md` - Configuration parameters and their description
53
+ - `intervention_api.md` - Working of intervention API and its configuration
54
+ - `simulator.md` - Working of the GRN simulator
55
+ - `spatial_simulator.md` - Working of the spatial simulator
56
+ - `examples/` - Examples scripts
57
+ - `marimo_example.py` - Marimo notebook containing example scripts
58
+ - `ipynb_example.py` - IPYNB notebook containing example scripts
59
+ - `pyproject.toml` - For package/dependency management
60
+ - `README.md`
61
+
62
+ ## Usage
63
+
64
+ A short code snippet for using the simulator is given below.
65
+ ```py
66
+ from nexus.simulator.grn.grnSim import GRNSim
67
+ from nexus.simulator.spatial.spatialSim import SpatialSim
68
+ from hydra import initialize_config_dir, compose
69
+
70
+ def get_config(config_name="test_config"): # Get config from Hydra config file
71
+ conf_path = os.path.join(os.getcwd(), "configs")
72
+ with initialize_config_dir(version_base=None, config_dir=conf_path):
73
+ cfg = compose(config_name=config_name)
74
+ return cfg
75
+
76
+ cfg = get_config()
77
+
78
+ sim = GRNSim(cfg.grn)
79
+ sim.run_sim()
80
+
81
+ spatial_sim = SpatialSim(cfg.spatial)
82
+ spatial_sim.run_sim()
83
+ ```
84
+
85
+ Examples for running the simulator are given in a [Marimo notebook](examples/marimo_example.py) and a [IPYNB notebook](examples/ipynb_example.ipynb). The simulator uses Hydra configs for the simulation parameters and the description of the config files are given in [Config Description](docs/config_desc.md).
86
+
87
+ ## Intervention API
88
+
89
+ The simulator also supports interventions on the parameters that allows for generating interventional data for causal discovery and analysis. Guidance on using interventions is given in the [Intervention Doc](docs/intevention_api.md).
90
+
91
+ ## Visualization
92
+
93
+ The visualization can be run by the running the two commands in seperate terminal windows.
94
+
95
+ ```bash
96
+ ## Runs the API for fetching the data from TileDB
97
+ uv run src/dashboard/retrieve_logger_api.py
98
+
99
+ ## Runs the website to visualize the data
100
+ cd dashboard/web/
101
+ npm install # If the packages are not installed
102
+ npm run dev
103
+ ```
104
+
105
+ After running these two commands, open the link `http://localhost:3000` and select a log file from the dropdown. This log file should be present inside the relative directory `logs/`.
106
+
107
+ Further instructions on using the dashboard is given in [README](dashboard/web/README.md)
@@ -0,0 +1,77 @@
1
+ [project]
2
+ name = "nexusim"
3
+ version = "0.1.0b2"
4
+ description = "JAX-accelerated multi-scale simulator for biological control and causal discovery"
5
+ keywords = [
6
+ "biology",
7
+ "simulator",
8
+ "jax",
9
+ "causal-discovery",
10
+ "multi-scale",
11
+ ]
12
+ readme = "README.md"
13
+ license = "MIT"
14
+ license-files = [
15
+ "LICENSE",
16
+ ]
17
+ requires-python = ">=3.10"
18
+ dependencies = [
19
+ "fastexcel>=0.16.0",
20
+ "hydra-core>=1.3.2",
21
+ "imageio>=2.37.2",
22
+ "jax>=0.6.2",
23
+ "marimo>=0.17.0",
24
+ "matplotlib>=3.10.7",
25
+ "msgspec>=0.20.0",
26
+ "networkx>=3.4.2",
27
+ "numpy>=2.2.6",
28
+ "optax>=0.2.6",
29
+ "polars>=1.34.0",
30
+ "pyyaml>=6.0.3",
31
+ "requests>=2.32.5",
32
+ "tiledb>=0.35.2",
33
+ "tqdm>=4.67.1",
34
+ ]
35
+
36
+ [dependency-groups]
37
+ dev = [
38
+ "pytest>=8.4.2",
39
+ "ruff>=0.14.0",
40
+ "pre-commit>=4.3.0",
41
+ "dash>=3.3.0",
42
+ "dash-ag-grid>=32.3.2",
43
+ "dash-bootstrap-components>=2.0.4",
44
+ "flask-cors>=6.0.2",
45
+ "diffrax>=0.7.0",
46
+ ]
47
+
48
+ [build-system]
49
+ requires = ["setuptools", "wheel"]
50
+ build-backend = "setuptools.build_meta"
51
+
52
+ [tool.ruff]
53
+ exclude = ["notebooks/", "examples/"]
54
+
55
+ [[tool.uv.index]]
56
+ name = "testpypi"
57
+ url = "https://test.pypi.org/simple/"
58
+ publish-url = "https://test.pypi.org/legacy/"
59
+ explicit = true
60
+
61
+ [tool.setuptools.package-dir]
62
+ nexus = "src/nexus"
63
+
64
+ [tool.setuptools.packages.find]
65
+ where = ["src"]
66
+ exclude = [
67
+ "tests*",
68
+ "outputs*",
69
+ "experiments*",
70
+ "simulator.archive*",
71
+ "*.egg-info*",
72
+ "dashboard*"
73
+ ]
74
+
75
+ [tool.setuptools.exclude-package-data]
76
+ simulator = ["archive/*", "outputs/*", "logs/*"]
77
+ outputs=["*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
File without changes