Skip to main content

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 engine
      • dynamics/ - Mathematical models for simulator dynamics
      • noise_models/ - Noise processes, random seeds
      • utils/ - Utility functions for simulator
      • grn/ - Code and logs of the GRN simulator
      • spatial/ - Code, model definitions and logs of the Spatial Sim
      • spatial_vec/ - Code, model definitions and logs of the vectorized version of Spatial Sim
      • run_sim.py - Run the GRN and Spatial Sim
      • run_linked_sim.py - Run the GRN and Spatial Sim together, allowing diffusion between cells and fields
    • causal/ - Causal discovery and inference modules
      • identification/ - Algorithms for structure/parameter learning
      • evaluation/ - Evaluation scripts
    • experiments/ - Scripts for running experiments
    • dashboard/ - Plotting, analysis, dashboards
      • web/ - Next.JS website for visualization of simulator outputs
      • retrieve_logger_api.py - Flask API to serve data to the website
    • tests/ - Unit & integration tests
  • configs/ - Config files for runs
  • notebooks/ - Exploratory analyses and demos
  • docs/ - Documentation
    • config_desc.md - Configuration parameters and their description
    • intervention_api.md - Working of intervention API and its configuration
    • simulator.md - Working of the GRN simulator
    • spatial_simulator.md - Working of the spatial simulator
  • examples/ - Examples scripts
    • marimo_example.py - Marimo notebook containing example scripts
    • ipynb_example.py - IPYNB notebook containing example scripts
  • pyproject.toml - For package/dependency management
  • README.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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nexusim-0.1.0b2.tar.gz (37.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nexusim-0.1.0b2-py3-none-any.whl (46.6 kB view details)

Uploaded Python 3

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

Hashes for nexusim-0.1.0b2.tar.gz
Algorithm Hash digest
SHA256 f89464391bbe87c1e3ef2d138d16c38e7727f40a9c7c719a9445d0ca0744396b
MD5 fb7520c77d4f8c53debe194117f9e37b
BLAKE2b-256 b41368d0011d11f47535f5b49e3212aadb245742758b3e84eaa67455123181ac

See more details on using hashes here.

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

Hashes for nexusim-0.1.0b2-py3-none-any.whl
Algorithm Hash digest
SHA256 8621d1530948e2c4ec6b6576049b6c304c959e289293f3b171b9ec1c0db7b263
MD5 96453dc3bc89da4f0ffed5290cca36ba
BLAKE2b-256 d48a4513870e135c5c3f02aaa2ebc72acb753079a4462d61f7b556f5fdd5e02e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page