JAX-accelerated multi-scale simulator for biological control and causal discovery
Project description
Nexus
Nexus is a JAX-accelerated multi-scale simulator for biological control and causal discovery, capable of generating biologically-realistic data.
Table of contents
Setup
Install uv package manager before running the setup
# Install using pip
pip install nexusim
# (OR)
# Clone repo and build the package in uv
## Clone repository and
git clone https://github.com/AmoghSingh25/GeneProtSim.git
## Create venv and download packages
uv sync
Code Structure
src/nexus/simulator/- Core simulation enginedynamics/- Mathematical models for simulator dynamicsnoise_models/- Noise processes, random seedsutils/- Utility functions for simulatorgrn/- Code and logs of the GRN simulatorspatial/- Code, model definitions and logs of the Spatial Simspatial_vec/- Code, model definitions and logs of the vectorized version of Spatial Simrun_sim.py- Run the GRN and Spatial Simrun_linked_sim.py- Run the GRN and Spatial Sim together, allowing diffusion between cells and fields
causal/- Causal discovery and inference modulesidentification/- Algorithms for structure/parameter learningevaluation/- Evaluation scripts
experiments/- Scripts for running experimentsdashboard/- Plotting, analysis, dashboardsweb/- Next.JS website for visualization of simulator outputsretrieve_logger_api.py- Flask API to serve data to the website
tests/- Unit & integration tests
configs/- Config files for runsnotebooks/- Exploratory analyses and demosdocs/- Documentationconfig_desc.md- Configuration parameters and their descriptionintervention_api.md- Working of intervention API and its configurationsimulator.md- Working of the GRN simulatorspatial_simulator.md- Working of the spatial simulator
examples/- Examples scriptsmarimo_example.py- Marimo notebook containing example scriptsipynb_example.py- IPYNB notebook containing example scripts
pyproject.toml- For package/dependency managementREADME.md
Usage
A short code snippet for using the simulator is given below.
from nexus.simulator.grn.grnSim import GRNSim
from nexus.simulator.spatial.spatialSim import SpatialSim
from hydra import initialize_config_dir, compose
def get_config(config_name="test_config"): # Get config from Hydra config file
conf_path = os.path.join(os.getcwd(), "configs")
with initialize_config_dir(version_base=None, config_dir=conf_path):
cfg = compose(config_name=config_name)
return cfg
cfg = get_config()
sim = GRNSim(cfg.grn)
sim.run_sim()
spatial_sim = SpatialSim(cfg.spatial)
spatial_sim.run_sim()
Examples for running the simulator are given in a Marimo notebook and a IPYNB notebook. The simulator uses Hydra configs for the simulation parameters and the description of the config files are given in Config Description.
Intervention API
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.
Visualization
The visualization can be run by the running the two commands in seperate terminal windows.
## Runs the API for fetching the data from TileDB
uv run src/dashboard/retrieve_logger_api.py
## Runs the website to visualize the data
cd dashboard/web/
npm install # If the packages are not installed
npm run dev
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/.
Further instructions on using the dashboard is given in README
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nexusim-0.1.0b2.tar.gz.
File metadata
- Download URL: nexusim-0.1.0b2.tar.gz
- Upload date:
- Size: 37.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f89464391bbe87c1e3ef2d138d16c38e7727f40a9c7c719a9445d0ca0744396b
|
|
| MD5 |
fb7520c77d4f8c53debe194117f9e37b
|
|
| BLAKE2b-256 |
b41368d0011d11f47535f5b49e3212aadb245742758b3e84eaa67455123181ac
|
File details
Details for the file nexusim-0.1.0b2-py3-none-any.whl.
File metadata
- Download URL: nexusim-0.1.0b2-py3-none-any.whl
- Upload date:
- Size: 46.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8621d1530948e2c4ec6b6576049b6c304c959e289293f3b171b9ec1c0db7b263
|
|
| MD5 |
96453dc3bc89da4f0ffed5290cca36ba
|
|
| BLAKE2b-256 |
d48a4513870e135c5c3f02aaa2ebc72acb753079a4462d61f7b556f5fdd5e02e
|